Sha256: 7393e07044ae4cc7547ef3184bb1ee7f6cff00367a400b882ec8b012ee7070ea
Contents?: true
Size: 981 Bytes
Versions: 1
Compression:
Stored size: 981 Bytes
Contents
# frozen_string_literal: true module Onfido class Options REGIONS = %w[eu us ca].freeze 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 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 private attr_reader :api_key, :open_timeout, :read_timeout def base_url @unknown_api_url || "https://api.#{@region}.onfido.com/v3.4/" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
onfido-2.3.0 | lib/onfido/options.rb |