Module: PayPal::SDK::Core::Configuration
- Included in:
- Authentication, Util::HTTPHelper
- Defined in:
- lib/paypal-sdk/core/config.rb
Overview
Include Configuration module to access configuration from any object
Examples
# Include in any class
include Configuration
# Access config object and attributes
config
config.username
# Change configuration
set_config(:development)
Instance Method Summary collapse
-
#config ⇒ Object
To get default Config object.
-
#set_config(env, override_configurations = {}) ⇒ Object
(also: #config=)
To change the configuration to given environment or configuration === Arguments *
env
– Environment *override_configurations
(Optional) – To override the default configuration.
Instance Method Details
#config ⇒ Object
To get default Config object.
20 21 22 |
# File 'lib/paypal-sdk/core/config.rb', line 20 def config @config ||= Config.config end |
#set_config(env, override_configurations = {}) ⇒ Object Also known as: config=
To change the configuration to given environment or configuration
Arguments
-
env
– Environment -
override_configurations
(Optional) – To override the default configuration.
Examples
obj.set_config(api.config)
obj.set_config(:http_timeout => 30)
obj.set_config(:development)
obj.set_config(:development, :http_timeout => 30)
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/paypal-sdk/core/config.rb', line 33 def set_config(env, override_configurations = {}) @config = case env when Config env when Hash begin config.dup.merge!(env) rescue Errno::ENOENT => error Config.new(env) end else Config.config(env, override_configurations) end end |