Class: Hachi::API
- Inherits:
-
Object
- Object
- Hachi::API
- Defined in:
- lib/hachi/api.rb
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.
17 18 19 20 21 22 23 |
# File 'lib/hachi/api.rb', line 17 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 end |
Instance Attribute Details
#api_endpoint ⇒ String (readonly)
Returns TheHive API endpoint.
6 7 8 |
# File 'lib/hachi/api.rb', line 6 def api_endpoint @api_endpoint end |
#api_key ⇒ String (readonly)
Returns TheHive API key.
9 10 11 |
# File 'lib/hachi/api.rb', line 9 def api_key @api_key end |
Instance Method Details
#alert ⇒ Clients::Alert
Alert API endpoint client
30 31 32 |
# File 'lib/hachi/api.rb', line 30 def alert @alert ||= Clients::Alert.new(api_endpoint: api_endpoint, api_key: api_key) end |
#artifact ⇒ Clients::Artifact
Artifact API endpoint client
39 40 41 |
# File 'lib/hachi/api.rb', line 39 def artifact @artifact ||= Clients::Artifact.new(api_endpoint: api_endpoint, api_key: api_key) end |
#case ⇒ Clients::Case
Case API endpoint client
48 49 50 |
# File 'lib/hachi/api.rb', line 48 def case @case ||= Clients::Case.new(api_endpoint: api_endpoint, api_key: api_key) end |
#user ⇒ Clients::User
User API endpoint client
57 58 59 |
# File 'lib/hachi/api.rb', line 57 def user @user ||= Clients::User.new(api_endpoint: api_endpoint, api_key: api_key) end |