Method: NexosisApi::Client#initialize

Defined in:
lib/nexosis_api/client.rb

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.

Raises:

  • (ArgumentError)
[View source]

32
33
34
35
36
37
38
# File 'lib/nexosis_api/client.rb', line 32

def initialize(options = {})
    raise ArgumentError, 'api_key was not defined' unless options[:api_key].nil? == false
    @api_key = options[:api_key]
    self.class.base_uri options[:base_uri] unless options[:base_uri].nil?
    @headers = {"api-key" => @api_key, "content-type" => "application/json"}
		    @options = {:headers => @headers, :format => :json}
end