Module: LoyaltyLabSDK
- Defined in:
- lib/loyalty_lab_sdk/config.rb,
lib/loyalty_lab_sdk/version.rb,
lib/loyalty_lab_sdk/exceptions.rb,
lib/loyalty_lab_sdk/loyalty_api.rb,
lib/loyalty_lab_sdk.rb
Defined Under Namespace
Classes: AuthenticationError, ConnectionError, Error, LoyaltyAPI, UnknownError
Constant Summary collapse
- DEFAULT_TIMEOUT =
15
- DEFAULT_RETRIES =
2
- VERSION =
'0.0.3'
Class Method Summary collapse
-
.config(options = nil) ⇒ Object
Globally configures and retrieves configuration for the Loyalty Lab SDK.
Class Method Details
.config(options = nil) ⇒ Object
Globally configures and retrieves configuration for the Loyalty Lab SDK.
Environment Variables
For convenience in a command-line environment, configuration may be skipped by setting the LOYALTY_LAB_SDK_USERNAME and LOYALTY_LAB_SDK_PASSWORD environment variables, which are self-explanatory.
Rails
If running in a rails environment, this configuration will automatically use the global Rails.logger instance. This behavior may be overridden by passing in a :logger option.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/loyalty_lab_sdk/config.rb', line 35 def self.config( = nil) @config ||= { :username => ENV['LOYALTY_LAB_SDK_USERNAME'], :password => ENV['LOYALTY_LAB_SDK_PASSWORD'], :logger => default_logger, :open_timeout => DEFAULT_TIMEOUT, :read_timeout => DEFAULT_TIMEOUT, :connection_error_retries => DEFAULT_RETRIES, } @config.merge!() if @config end |