Class: Mihari::Clients::TheHive
- Defined in:
- lib/mihari/clients/the_hive.rb
Overview
TheHive API client
Instance Attribute Summary collapse
-
#api_version ⇒ Object
readonly
Returns the value of attribute api_version.
Attributes inherited from Base
#base_url, #headers, #pagination_interval, #timeout
Instance Method Summary collapse
- #alert(json) ⇒ Hash
-
#initialize(base_url, api_key:, api_version: "v1", headers: {}, timeout: nil) ⇒ TheHive
constructor
A new instance of TheHive.
Constructor Details
#initialize(base_url, api_key:, api_version: "v1", headers: {}, timeout: nil) ⇒ TheHive
Returns a new instance of TheHive.
18 19 20 21 22 23 24 25 |
# File 'lib/mihari/clients/the_hive.rb', line 18 def initialize(base_url, api_key:, api_version: "v1", headers: {}, timeout: nil) raise(ArgumentError, "api_key is required") unless api_key headers["authorization"] = "Bearer #{api_key}" super(base_url, headers: headers, timeout: timeout) @api_version = api_version end |
Instance Attribute Details
#api_version ⇒ Object (readonly)
Returns the value of attribute api_version.
9 10 11 |
# File 'lib/mihari/clients/the_hive.rb', line 9 def api_version @api_version end |
Instance Method Details
#alert(json) ⇒ Hash
32 33 34 35 |
# File 'lib/mihari/clients/the_hive.rb', line 32 def alert(json) json = json.to_camelback_keys.compact post_json("/api/#{api_version}/alert", json: json) end |