Class: Hachi::API
Instance Attribute Summary collapse
-
#api_endpoint ⇒ String
readonly
TheHive API endpoint.
-
#api_key ⇒ String
readonly
TheHive API key.
-
#api_version ⇒ String?
readonly
TheHive API version.
Instance Method Summary collapse
-
#alert ⇒ Clients::Alert
Alert API endpoint client.
-
#artifact ⇒ Clients::Artifact
Artifact API endpoint client.
-
#case ⇒ Clients::Case
Case API endpoint client.
-
#initialize(api_endpoint: ENV.fetch("THEHIVE_API_ENDPOINT", nil), api_key: ENV.fetch("THEHIVE_API_KEY", nil), api_version: ENV.fetch("THEHIVE_API_VERSION", nil)) ⇒ API
constructor
A new instance of API.
-
#observable ⇒ Clients::Observable
Observable API endpoint client.
-
#query ⇒ Clients::Query
Query API endpoint client.
-
#user ⇒ Clients::User
User API endpoint client.
Constructor Details
#initialize(api_endpoint: ENV.fetch("THEHIVE_API_ENDPOINT", nil), api_key: ENV.fetch("THEHIVE_API_KEY", nil), api_version: ENV.fetch("THEHIVE_API_VERSION", nil)) ⇒ API
Returns a new instance of API.
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/hachi/api.rb', line 25 def initialize(api_endpoint: ENV.fetch("THEHIVE_API_ENDPOINT", nil), api_key: ENV.fetch("THEHIVE_API_KEY", nil), api_version: ENV.fetch("THEHIVE_API_VERSION", nil)) @api_endpoint = api_endpoint raise ArgumentError, "api_endpoint argument is required" unless api_endpoint @api_key = api_key raise ArgumentError, "api_key argument is required" unless api_key @api_version = api_version @base = Clients::Base.new(api_endpoint: api_endpoint, api_key: api_key, api_version: api_version) end |
Instance Attribute Details
#api_endpoint ⇒ String (readonly)
Returns TheHive API endpoint.
10 11 12 |
# File 'lib/hachi/api.rb', line 10 def api_endpoint @api_endpoint end |
#api_key ⇒ String (readonly)
Returns TheHive API key.
13 14 15 |
# File 'lib/hachi/api.rb', line 13 def api_key @api_key end |
#api_version ⇒ String? (readonly)
Returns TheHive API version.
16 17 18 |
# File 'lib/hachi/api.rb', line 16 def api_version @api_version end |
Instance Method Details
#alert ⇒ Clients::Alert
Alert API endpoint client
44 45 46 |
# File 'lib/hachi/api.rb', line 44 def alert @alert ||= Clients::Alert.new(api_endpoint: api_endpoint, api_key: api_key, api_version: api_version) end |
#artifact ⇒ Clients::Artifact
Artifact API endpoint client
53 54 55 |
# File 'lib/hachi/api.rb', line 53 def artifact @artifact ||= Clients::Artifact.new(api_endpoint: api_endpoint, api_key: api_key, api_version: api_version) end |
#case ⇒ Clients::Case
Case API endpoint client
62 63 64 |
# File 'lib/hachi/api.rb', line 62 def case @case ||= Clients::Case.new(api_endpoint: api_endpoint, api_key: api_key, api_version: api_version) end |
#observable ⇒ Clients::Observable
Observable API endpoint client
80 81 82 |
# File 'lib/hachi/api.rb', line 80 def observable @observable ||= Clients::Observable.new(api_endpoint: api_endpoint, api_key: api_key, api_version: api_version) end |
#query ⇒ Clients::Query
Query API endpoint client
89 90 91 |
# File 'lib/hachi/api.rb', line 89 def query @query ||= Clients::Query.new(api_endpoint: api_endpoint, api_key: api_key, api_version: api_version) end |
#user ⇒ Clients::User
User API endpoint client
71 72 73 |
# File 'lib/hachi/api.rb', line 71 def user @user ||= Clients::User.new(api_endpoint: api_endpoint, api_key: api_key, api_version: api_version) end |