Module: Onfido::Configuration
- Included in:
- Onfido
- Defined in:
- lib/onfido/configuration.rb
Constant Summary collapse
- REGION_HOSTS =
{ us: "api.us.onfido.com", ca: "api.ca.onfido.com" }.freeze
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
-
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
-
#region ⇒ Object
Returns the value of attribute region.
Class Method Summary collapse
Instance Method Summary collapse
- #configure {|_self| ... } ⇒ Object
- #endpoint ⇒ Object
- #logger ⇒ Object
- #logger=(log) ⇒ Object
- #reset ⇒ Object
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
8 9 10 |
# File 'lib/onfido/configuration.rb', line 8 def api_key @api_key end |
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
8 9 10 |
# File 'lib/onfido/configuration.rb', line 8 def open_timeout @open_timeout end |
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
8 9 10 |
# File 'lib/onfido/configuration.rb', line 8 def read_timeout @read_timeout end |
#region ⇒ Object
Returns the value of attribute region.
8 9 10 |
# File 'lib/onfido/configuration.rb', line 8 def region @region end |
Class Method Details
.extended(base) ⇒ Object
10 11 12 |
# File 'lib/onfido/configuration.rb', line 10 def self.extended(base) base.reset end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
14 15 16 |
# File 'lib/onfido/configuration.rb', line 14 def configure yield self end |
#endpoint ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/onfido/configuration.rb', line 38 def endpoint region_host = region ? REGION_HOSTS[region.downcase.to_sym] : "api.onfido.com" unless region_host raise "The region \"#{region.downcase}\" is not currently supported" end "https://#{region_host}/v3/" end |
#logger ⇒ Object
34 35 36 |
# File 'lib/onfido/configuration.rb', line 34 def logger RestClient.log ||= NullLogger.new end |
#logger=(log) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/onfido/configuration.rb', line 26 def logger=(log) unless log.respond_to?(:<<) raise "#{log.class} doesn't seem to behave like a logger!" end RestClient.log = log end |
#reset ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/onfido/configuration.rb', line 18 def reset self.api_key = nil self.region = nil self.open_timeout = 30 self.read_timeout = 80 RestClient.log = nil end |