Class: Airwallex::Configuration
- Inherits:
-
Object
- Object
- Airwallex::Configuration
- Defined in:
- lib/airwallex/configuration.rb
Constant Summary collapse
- ENVIRONMENTS =
{ demo: "https://api-demo.airwallex.com/api/v1", production: "https://api.airwallex.com/api/v1" }.freeze
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#client_id ⇒ Object
Returns the value of attribute client_id.
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#login_as ⇒ Object
Returns the value of attribute login_as.
-
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Class Method Summary collapse
Instance Method Summary collapse
- #base_url ⇒ Object (also: #api_base_url)
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
13 14 15 16 17 18 |
# File 'lib/airwallex/configuration.rb', line 13 def initialize @environment = :demo @timeout = 30 @open_timeout = 10 @logger = nil end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
10 11 12 |
# File 'lib/airwallex/configuration.rb', line 10 def api_key @api_key end |
#client_id ⇒ Object
Returns the value of attribute client_id.
10 11 12 |
# File 'lib/airwallex/configuration.rb', line 10 def client_id @client_id end |
#environment ⇒ Object
Returns the value of attribute environment.
11 12 13 |
# File 'lib/airwallex/configuration.rb', line 11 def environment @environment end |
#logger ⇒ Object
Returns the value of attribute logger.
10 11 12 |
# File 'lib/airwallex/configuration.rb', line 10 def logger @logger end |
#login_as ⇒ Object
Returns the value of attribute login_as.
10 11 12 |
# File 'lib/airwallex/configuration.rb', line 10 def login_as @login_as end |
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
10 11 12 |
# File 'lib/airwallex/configuration.rb', line 10 def open_timeout @open_timeout end |
#timeout ⇒ Object
Returns the value of attribute timeout.
10 11 12 |
# File 'lib/airwallex/configuration.rb', line 10 def timeout @timeout end |
Class Method Details
.validate_environment!(environment) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/airwallex/configuration.rb', line 31 def self.validate_environment!(environment) return environment if ENVIRONMENTS.key?(environment) valid = ENVIRONMENTS.keys.map(&:inspect).join(", ") raise ConfigurationError, "Invalid environment: #{environment.inspect}. Valid environments are: #{valid}" end |
Instance Method Details
#base_url ⇒ Object Also known as: api_base_url
25 26 27 |
# File 'lib/airwallex/configuration.rb', line 25 def base_url ENVIRONMENTS.fetch(environment) end |