class OrchestrateIo::Client

Public Class Methods

new(attrs={}) click to toggle source
# File lib/orchestrate.io/client.rb, line 19
def initialize(attrs={})
  attrs = OrchestrateIo.options.merge(attrs)

  Configuration::VALID_OPTIONS_KEYS.each do |k|
    instance_variable_set("@#{k}".to_sym, attrs[k])
  end

  initialize_client
  logger.level = verbose ? ::Logger::DEBUG : ::Logger::INFO
end

Public Instance Methods

initialize_client() click to toggle source

Updates HTTParty default settings

# File lib/orchestrate.io/client.rb, line 33
def initialize_client
  self.class.format   :json
  self.class.base_uri endpoint
  self.class.headers  request_headers
end
method_missing(name, *args, &block) click to toggle source
# File lib/orchestrate.io/client.rb, line 49
def method_missing(name, *args, &block)
  OrchestrateIo.const_get(name.to_s.camelize!).new(self, args.first, &block)
end
request(http_method, uri, options={}) click to toggle source

Entry point to HTTP request Set the username of basic auth to the API Key attribute.

# File lib/orchestrate.io/client.rb, line 43
def request(http_method, uri, options={})
  response = self.class.__send__(http_method, uri, options.merge(basic_auth))
  # Add some logger.debug here ...
  response
end

Protected Instance Methods

basic_auth() click to toggle source
# File lib/orchestrate.io/client.rb, line 55
def basic_auth
  { basic_auth: { username: api_key, password: "" } }
end