Class: Tango::Api::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/tango/api.rb

Overview

Holds client-wide configuration such as timeouts, retries and auth.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

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

#authObject

Returns the value of attribute auth.



23
24
25
# File 'lib/tango/api.rb', line 23

def auth
  @auth
end

#base_urlObject

Returns the value of attribute base_url.



23
24
25
# File 'lib/tango/api.rb', line 23

def base_url
  @base_url
end

#default_headersObject

Returns the value of attribute default_headers.



23
24
25
# File 'lib/tango/api.rb', line 23

def default_headers
  @default_headers
end

#loggerObject

Returns the value of attribute logger.



23
24
25
# File 'lib/tango/api.rb', line 23

def logger
  @logger
end

#open_timeoutObject

Returns the value of attribute open_timeout.



23
24
25
# File 'lib/tango/api.rb', line 23

def open_timeout
  @open_timeout
end

#retriesObject

Returns the value of attribute retries.



23
24
25
# File 'lib/tango/api.rb', line 23

def retries
  @retries
end

#timeoutObject

Returns the value of attribute timeout.



23
24
25
# File 'lib/tango/api.rb', line 23

def timeout
  @timeout
end