Class: Tango::Api::Configuration
- Inherits:
-
Object
- Object
- Tango::Api::Configuration
- Defined in:
- lib/tango/api.rb
Overview
Holds client-wide configuration such as timeouts, retries and auth.
Instance Attribute Summary collapse
-
#auth ⇒ Object
Returns the value of attribute auth.
-
#base_url ⇒ Object
Returns the value of attribute base_url.
-
#default_headers ⇒ Object
Returns the value of attribute default_headers.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
-
#retries ⇒ Object
Returns the value of attribute retries.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
25 26 27 28 29 30 31 32 33 |
# File 'lib/tango/api.rb', line 25 def initialize @base_url = ENV.fetch("TANGO_URL", "https://integration-api.tangocard.com/raas/v2").to_s.presence @timeout = 45 @open_timeout = 5 @retries = { max: 2, base: 0.5, max_delay: 5 } @logger = defined?(Rails) ? Rails.logger : Logger.new($stdout) @default_headers = { "Accept" => "application/json" } @auth = nil end |
Instance Attribute Details
#auth ⇒ Object
Returns the value of attribute auth.
23 24 25 |
# File 'lib/tango/api.rb', line 23 def auth @auth end |
#base_url ⇒ Object
Returns the value of attribute base_url.
23 24 25 |
# File 'lib/tango/api.rb', line 23 def base_url @base_url end |
#default_headers ⇒ Object
Returns the value of attribute default_headers.
23 24 25 |
# File 'lib/tango/api.rb', line 23 def default_headers @default_headers end |
#logger ⇒ Object
Returns the value of attribute logger.
23 24 25 |
# File 'lib/tango/api.rb', line 23 def logger @logger end |
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
23 24 25 |
# File 'lib/tango/api.rb', line 23 def open_timeout @open_timeout end |
#retries ⇒ Object
Returns the value of attribute retries.
23 24 25 |
# File 'lib/tango/api.rb', line 23 def retries @retries end |
#timeout ⇒ Object
Returns the value of attribute timeout.
23 24 25 |
# File 'lib/tango/api.rb', line 23 def timeout @timeout end |