class Hachi::API

Attributes

api_endpoint[R]

@return [String] TheHive API endpoint

api_key[R]

@return [String] TheHive API key

Public Class Methods

new(api_endpoint: ENV["THEHIVE_API_ENDPOINT"], api_key: ENV["THEHIVE_API_KEY"]) click to toggle source

@param [String, nil] api_endpoint TheHive API endpoint @param [String, nil] api_key TheHive API key

@raise [ArgumentError] When given or an empty endpoint or key

# 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

Public Instance Methods

alert() click to toggle source

Alert API endpoint client

@return [Clients::Alert]

# File lib/hachi/api.rb, line 38
def alert
  @alert ||= Clients::Alert.new(api_endpoint: api_endpoint, api_key: api_key)
end
artifact() click to toggle source

Artifact API endpoint client

@return [Clients::Artifact]

# File lib/hachi/api.rb, line 47
def artifact
  @artifact ||= Clients::Artifact.new(api_endpoint: api_endpoint, api_key: api_key)
end
case() click to toggle source

Case API endpoint client

@return [Clients::Case]

# File lib/hachi/api.rb, line 56
def case
  @case ||= Clients::Case.new(api_endpoint: api_endpoint, api_key: api_key)
end
user() click to toggle source

User API endpoint client

@return [Clients::User]

# File lib/hachi/api.rb, line 65
def user
  @user ||= Clients::User.new(api_endpoint: api_endpoint, api_key: api_key)
end