Class: SparkApi::Client
- Inherits:
-
Object
- Object
- SparkApi::Client
- Defined in:
- lib/spark_api/client.rb
Overview
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 instantiated separately with the configuration information.
Constant Summary
Constants included from Connection
SparkApi::Connection::ACCEPT_ENCODING, SparkApi::Connection::COMPRESS_ACCEPT_ENCODING, SparkApi::Connection::HTTPS_SCHEME, SparkApi::Connection::HTTP_SCHEME, SparkApi::Connection::MIME_JSON, SparkApi::Connection::MIME_RESO, SparkApi::Connection::REG_HTTP, SparkApi::Connection::REG_HTTPS, SparkApi::Connection::X_REQUEST_ID_CHAIN
Instance Attribute Summary collapse
-
#authenticator ⇒ Object
Returns the value of attribute authenticator.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Client
constructor
Constructor bootstraps the client with configuration and authorization class.
Methods included from SparkApi::Configuration::OAuth2Configurable
#convert_to_oauth2?, #grant_uri, #oauth2_enabled?, #oauthify!
Methods included from Request
Methods included from Authentication
#authenticate, #authenticated?, #logout, #session, #session=
Methods included from Connection
#connection, #headers, #reso_headers, #spark_headers
Constructor Details
#initialize(options = {}) ⇒ Client
Constructor bootstraps the client with configuration and authorization class. options - see Configuration::VALID_OPTION_KEYS
19 20 21 22 23 24 25 26 |
# File 'lib/spark_api/client.rb', line 19 def initialize(={}) = SparkApi..merge() Configuration::VALID_OPTION_KEYS.each do |key| send("#{key}=", [key]) end # Instantiate the authentication class passed in. @authenticator = authentication_mode.send("new", self) end |
Instance Attribute Details
#authenticator ⇒ Object
Returns the value of attribute authenticator.
14 15 16 |
# File 'lib/spark_api/client.rb', line 14 def authenticator @authenticator end |