Class: FlexmlsApi::Client

Inherits:
Object
  • Object
show all
Includes:
Authentication, Connection, Request
Defined in:
lib/flexmls_api/client.rb

Overview

API Client

Main class to setup and run requests on the API. A default client is accessible globally as FlexmlsApi::client if the global configuration has been set as well. Otherwise, this class may be instanciated separately with the configuration information.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Request

#delete, #get, #post, #put

Methods included from Authentication

#authenticate, #authenticated?, #logout, #session, #session=

Methods included from Connection

#connection, #headers

Constructor Details

#initialize(options = {}, auth_klass = ApiAuth) ⇒ Client

Constructor bootstraps the client with configuration and authorization class. options - see Configuration::VALID_OPTION_KEYS auth_klass - subclass of Authentication::BaseAuth Defaults to the original api auth system.



17
18
19
20
21
22
23
24
# File 'lib/flexmls_api/client.rb', line 17

def initialize(options={}, auth_klass=ApiAuth)
  options = FlexmlsApi.options.merge(options)
  Configuration::VALID_OPTION_KEYS.each do |key|
    send("#{key}=", options[key])
  end
  # Instanciate the authenication class passed in.
  @authenticator = authentication_mode.send("new", self)
end

Instance Attribute Details

#authenticatorObject

Returns the value of attribute authenticator.



11
12
13
# File 'lib/flexmls_api/client.rb', line 11

def authenticator
  @authenticator
end