Class: Idnow::Client

Constant Summary collapse

API_VERSION =
'v1'

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, #get_identification_file, #list_identifications

Methods included from API::Authentication

#login

Constructor Details

#initialize(env:, company_id:, api_key:, timeout: nil, sftp_options: {}) ⇒ Client

Returns a new instance of Client.



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/idnow/client.rb', line 25

def initialize(env:, company_id:, api_key:, timeout: nil, sftp_options: {})
  raise 'Please set env to :test or :live' unless Idnow::ENVIRONMENTS.keys.include?(env)
  raise 'Please set your company_id' if company_id.nil?
  raise 'Please set your api_key' if api_key.nil?

  @host        = Idnow.endpoint(env, :host)
  @target_host = Idnow.endpoint(env, :target_host)
  @company_id  = company_id
  @api_key     = api_key

  @http_client = HttpClient.new(host: @host)

  sftp_options[:timeout] = timeout if timeout
  @sftp_client = SftpClient.new(host: @host, username: @company_id, password: @api_key, options: sftp_options)
end

Instance Attribute Details

#hostObject (readonly)

Returns the value of attribute host.



23
24
25
# File 'lib/idnow/client.rb', line 23

def host
  @host
end