Class: Idnow::Client

Constant Summary collapse

API_VERSION =
'v1'.freeze

Constants included from API::AutomatedTesting

API::AutomatedTesting::HOST

Constants included from API::RetrieveIdentifications

API::RetrieveIdentifications::IDENTIFICATION_STATUSES

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from API::DownloadDocuments

#download_default_document

Methods included from API::UploadDocuments

#upload_default_document, #upload_identification_document

Methods included from API::DocumentDefinitions

#create_document_definition, #list_cached_document_definitions, #list_document_definitions

Methods included from API::AutomatedTesting

#testing_request_video_chat, #testing_start

Methods included from API::RequestIdentifications

#request_identification

Methods included from API::RetrieveIdentifications

#download_identification, #get_identification, #list_identifications

Methods included from API::Authentication

#login

Constructor Details

#initialize(env:, company_id:, api_key:) ⇒ Client

Returns a new instance of Client.



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/idnow/client.rb', line 23

def initialize(env:, company_id:, api_key:)
  fail 'Please set env to :test or :live' unless Idnow::ENVIRONMENTS.keys.include?(env)
  fail 'Please set your company_id' if company_id.nil?
  fail 'Please set your api_key' if api_key.nil?
  @host        = Idnow::ENVIRONMENTS[env][:host]
  @target_host = Idnow::ENVIRONMENTS[env][:target_host]
  @company_id  = company_id
  @api_key     = api_key

  @http_client = HttpClient.new(host: @host)
  @sftp_client = SftpClient.new(host: @host, username: @company_id, password: @api_key)
end

Instance Attribute Details

#hostObject (readonly)

Returns the value of attribute host.



21
22
23
# File 'lib/idnow/client.rb', line 21

def host
  @host
end