Class: Hachi::API
Instance Attribute Summary collapse
-
#api_endpoint ⇒ String
readonly
TheHive API endpoint.
-
#api_key ⇒ String
readonly
TheHive API key.
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["THEHIVE_API_ENDPOINT"], api_key: ENV["THEHIVE_API_KEY"]) ⇒ API
constructor
A new instance of API.
-
#user ⇒ Clients::User
User API endpoint client.
Constructor Details
#initialize(api_endpoint: ENV["THEHIVE_API_ENDPOINT"], api_key: ENV["THEHIVE_API_KEY"]) ⇒ API
Returns a new instance of API.
21 22 23 24 25 26 27 28 29 |
# File 'lib/hachi/api.rb', line 21 def initialize(api_endpoint: ENV["THEHIVE_API_ENDPOINT"], api_key: ENV["THEHIVE_API_KEY"]) @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 @base = Clients::Base.new(api_endpoint: api_endpoint, api_key: api_key) 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 |
Instance Method Details
#alert ⇒ Clients::Alert
Alert API endpoint client
38 39 40 |
# File 'lib/hachi/api.rb', line 38 def alert @alert ||= Clients::Alert.new(api_endpoint: api_endpoint, api_key: api_key) end |
#artifact ⇒ Clients::Artifact
Artifact API endpoint client
47 48 49 |
# File 'lib/hachi/api.rb', line 47 def artifact @artifact ||= Clients::Artifact.new(api_endpoint: api_endpoint, api_key: api_key) end |
#case ⇒ Clients::Case
Case API endpoint client
56 57 58 |
# File 'lib/hachi/api.rb', line 56 def case @case ||= Clients::Case.new(api_endpoint: api_endpoint, api_key: api_key) end |
#user ⇒ Clients::User
User API endpoint client
65 66 67 |
# File 'lib/hachi/api.rb', line 65 def user @user ||= Clients::User.new(api_endpoint: api_endpoint, api_key: api_key) end |