Sha256: cfc356e8b56cfc43744ec3f1b0a1162c297f233177e1448306decb31b20eb646

Contents?: true

Size: 1.15 KB

Versions: 4

Compression:

Stored size: 1.15 KB

Contents

module SparkApi
  # =API Client
  # Main class to setup and run requests on the API.  A default client is accessible globally as 
  # SparkApi::client if the global configuration has been set as well.  Otherwise, this class may 
  # be instanciated separately with the configuration information.
  class Client
    include Connection
    include Authentication
    include Request

    require File.expand_path('../configuration/oauth2_configurable', __FILE__)
    include Configuration::OAuth2Configurable
    
    attr_accessor :authenticator
    attr_accessor *Configuration::VALID_OPTION_KEYS
    
    # 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.
    def initialize(options={}, auth_klass=ApiAuth)
      options = SparkApi.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
    
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spark_api-1.1.1 lib/spark_api/client.rb
spark_api-1.1.0 lib/spark_api/client.rb
spark_api-1.0.4 lib/spark_api/client.rb
spark_api-1.0.2 lib/spark_api/client.rb