Class: Smartpay::Configuration
- Inherits:
-
Object
- Object
- Smartpay::Configuration
- Defined in:
- lib/smartpay/configuration.rb
Overview
Smartpay configuration
Constant Summary collapse
- DEFAULT_TIMEOUT_SETTING =
30- DEFAULT_API_URL =
"https://api.smartpay.co/v1"- DEFAULT_RETRY_OPTIONS =
{ max_tries: 1, base_sleep_seconds: 0.5, max_sleep_seconds: 1.0, rescue: [RestClient::InternalServerError,RestClient::BadGateway, RestClient::ServiceUnavailable, RestClient::GatewayTimeout] }.freeze
Instance Attribute Summary collapse
-
#api_url ⇒ Object
Returns the value of attribute api_url.
-
#public_key ⇒ Object
Returns the value of attribute public_key.
-
#request_timeout ⇒ Object
Returns the value of attribute request_timeout.
-
#retry_options ⇒ Object
Returns the value of attribute retry_options.
-
#secret_key ⇒ Object
Returns the value of attribute secret_key.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #reset ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
20 21 22 |
# File 'lib/smartpay/configuration.rb', line 20 def initialize reset end |
Instance Attribute Details
#api_url ⇒ Object
Returns the value of attribute api_url.
8 9 10 |
# File 'lib/smartpay/configuration.rb', line 8 def api_url @api_url end |
#public_key ⇒ Object
Returns the value of attribute public_key.
8 9 10 |
# File 'lib/smartpay/configuration.rb', line 8 def public_key @public_key end |
#request_timeout ⇒ Object
Returns the value of attribute request_timeout.
8 9 10 |
# File 'lib/smartpay/configuration.rb', line 8 def request_timeout @request_timeout end |
#retry_options ⇒ Object
Returns the value of attribute retry_options.
8 9 10 |
# File 'lib/smartpay/configuration.rb', line 8 def @retry_options end |
#secret_key ⇒ Object
Returns the value of attribute secret_key.
8 9 10 |
# File 'lib/smartpay/configuration.rb', line 8 def secret_key @secret_key end |
Instance Method Details
#reset ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/smartpay/configuration.rb', line 24 def reset @request_timeout = DEFAULT_TIMEOUT_SETTING @api_url = ENV.fetch("SMARTPAY_API_PREFIX", DEFAULT_API_URL).downcase @retry_options = DEFAULT_RETRY_OPTIONS @request_timeout = DEFAULT_TIMEOUT_SETTING @public_key = ENV.fetch("SMARTPAY_PUBLIC_KEY", nil) @secret_key = ENV.fetch("SMARTPAY_SECRET_KEY", nil) end |