Class: LemonwayOnboarding::Configuration
- Inherits:
-
Object
- Object
- LemonwayOnboarding::Configuration
- Defined in:
- lib/lemonway_onboarding/configuration.rb
Overview
Configuration of the LemonwayOnboarding API client gem.
Instance Attribute Summary collapse
-
#base_url ⇒ Object
Returns the value of attribute base_url.
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#proxy ⇒ Object
Returns the value of attribute proxy.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
-
#token ⇒ Object
Returns the value of attribute token.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
-
#configure {|self| ... } ⇒ void
Configures the instance with a block.
-
#initialize {|self| ... } ⇒ LemonwayOnboarding::Configuration
constructor
Initializes the configuration with default values.
-
#validate! ⇒ void
Validates the configuration values.
Constructor Details
#initialize {|self| ... } ⇒ LemonwayOnboarding::Configuration
Initializes the configuration with default values. You can pass a block to configure the instance.
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/lemonway_onboarding/configuration.rb', line 13 def initialize @environment = ENV['LEMONWAY_ONBOARDING_ENV'] || 'production' @version = 'v1' @timeout = 30 @token = nil @proxy = nil @logger = Logger.new($stdout) yield self if block_given? base_url_from_env end |
Instance Attribute Details
#base_url ⇒ Object
Returns the value of attribute base_url.
6 7 8 |
# File 'lib/lemonway_onboarding/configuration.rb', line 6 def base_url @base_url end |
#environment ⇒ Object
Returns the value of attribute environment.
6 7 8 |
# File 'lib/lemonway_onboarding/configuration.rb', line 6 def environment @environment end |
#logger ⇒ Object
Returns the value of attribute logger.
6 7 8 |
# File 'lib/lemonway_onboarding/configuration.rb', line 6 def logger @logger end |
#proxy ⇒ Object
Returns the value of attribute proxy.
6 7 8 |
# File 'lib/lemonway_onboarding/configuration.rb', line 6 def proxy @proxy end |
#timeout ⇒ Object
Returns the value of attribute timeout.
6 7 8 |
# File 'lib/lemonway_onboarding/configuration.rb', line 6 def timeout @timeout end |
#token ⇒ Object
Returns the value of attribute token.
6 7 8 |
# File 'lib/lemonway_onboarding/configuration.rb', line 6 def token @token end |
#version ⇒ Object
Returns the value of attribute version.
6 7 8 |
# File 'lib/lemonway_onboarding/configuration.rb', line 6 def version @version end |
Instance Method Details
#configure {|self| ... } ⇒ void
This method returns an undefined value.
Configures the instance with a block.
30 31 32 |
# File 'lib/lemonway_onboarding/configuration.rb', line 30 def configure yield(self) if block_given? end |
#validate! ⇒ void
This method returns an undefined value.
Validates the configuration values.
38 39 40 41 |
# File 'lib/lemonway_onboarding/configuration.rb', line 38 def validate! error_on('token') unless @token error_on('environment') unless %(sandbox production).include?(@environment) end |