class Falconz::Client

Attributes

header[RW]

Client HTTP header information.

url[RW]

Client HTTP base URL.

Public Class Methods

new(url: "https://www.hybrid-analysis.com/api/v2", key: ENV["HYBRID_ANALYSIS_API_KEY"]) click to toggle source

When initializing a Client, you can optionally specify the base API (v2) URL and the API key to be used for communication. These can both be changed later on.

Note: If not specified, the HYBRID_ANALYSIS_API_KEY environment variable is used.

# File lib/falconz/client.rb, line 35
def initialize(url: "https://www.hybrid-analysis.com/api/v2", key: ENV["HYBRID_ANALYSIS_API_KEY"])
  @url = url

  @header = { 
    "User-Agent" => "Falcon Sandbox", 
    "api-key" => key
  }
end

Public Instance Methods

api_key() click to toggle source
# File lib/falconz/client.rb, line 54
def api_key
  @header["api-key"]
end
api_key=(k) click to toggle source
# File lib/falconz/client.rb, line 58
def api_key=(k)
  @header["api-key"] = k
end
api_key?() click to toggle source
# File lib/falconz/client.rb, line 49
def api_key?
  return true if @header["api-key"]
  false
end
valid_user_agent?() click to toggle source
# File lib/falconz/client.rb, line 44
def valid_user_agent?
  return true if @header["api-key"] && @header["User-Agent"] == "Falcon Sandbox"
  false
end