Class: Nexio::Configuration
- Inherits:
-
Object
- Object
- Nexio::Configuration
- Defined in:
- lib/nexio/configuration.rb
Constant Summary collapse
- DEFAULTS =
{ "sandbox_url" => "https://api.nexiopaysandbox.com", "production_url" => "https://api.nexiopay.com", }.freeze
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
- #api_server_url ⇒ Object
-
#environment ⇒ Object
Returns the value of attribute environment.
Instance Method Summary collapse
- #api_key! ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
14 15 16 |
# File 'lib/nexio/configuration.rb', line 14 def initialize @api_server_url = nil end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
10 11 12 |
# File 'lib/nexio/configuration.rb', line 10 def api_key @api_key end |
#api_server_url ⇒ Object
24 25 26 |
# File 'lib/nexio/configuration.rb', line 24 def api_server_url @api_server_url || (environment == "production" ? DEFAULTS.fetch("production_url") : DEFAULTS.fetch("sandbox_url")) end |
#environment ⇒ Object
Returns the value of attribute environment.
10 11 12 |
# File 'lib/nexio/configuration.rb', line 10 def environment @environment end |
Instance Method Details
#api_key! ⇒ Object
18 19 20 21 22 |
# File 'lib/nexio/configuration.rb', line 18 def api_key! raise MissingApiKey if api_key.nil? || api_key.empty? api_key end |