Class: Onfido::Options
- Inherits:
-
Object
- Object
- Onfido::Options
- Defined in:
- lib/onfido/options.rb
Constant Summary collapse
- REGIONS =
%w[eu us ca].freeze
Instance Method Summary collapse
-
#initialize(api_key:, region:, open_timeout: 10, read_timeout: 30, unknown_api_url: nil) ⇒ Options
constructor
A new instance of Options.
- #rest_client ⇒ Object
Constructor Details
#initialize(api_key:, region:, open_timeout: 10, read_timeout: 30, unknown_api_url: nil) ⇒ Options
Returns a new instance of Options.
7 8 9 10 11 12 13 14 15 |
# File 'lib/onfido/options.rb', line 7 def initialize(api_key:, region:, open_timeout: 10, read_timeout: 30, unknown_api_url: nil) @api_key = api_key @region = region.to_s.downcase @open_timeout = open_timeout @read_timeout = read_timeout @unknown_api_url = unknown_api_url raise "Unknown region #{@region}" unless REGIONS.include?(@region) end |
Instance Method Details
#rest_client ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/onfido/options.rb', line 17 def rest_client @rest_client ||= RestClient::Resource.new( base_url, read_timeout: read_timeout, open_timeout: open_timeout, headers: { 'Authorization' => "Token token=#{api_key}", 'Accept' => 'application/json', 'User-Agent' => "onfido-ruby/#{Onfido::VERSION}" } ) end |