Module: Idnow

Defined in:
lib/idnow.rb,
lib/idnow/client.rb,
lib/idnow/helpers.rb,
lib/idnow/exception.rb,
lib/idnow/get_request.rb,
lib/idnow/http_client.rb,
lib/idnow/sftp_client.rb,
lib/idnow/models/login.rb,
lib/idnow/raw_response.rb,
lib/idnow/configuration.rb,
lib/idnow/json_response.rb,
lib/idnow/models/user_data.rb,
lib/idnow/modules/jsonable.rb,
lib/idnow/models/login_data.rb,
lib/idnow/post_json_request.rb,
lib/idnow/API/authentication.rb,
lib/idnow/models/contact_data.rb,
lib/idnow/post_binary_request.rb,
lib/idnow/API/upload_documents.rb,
lib/idnow/API/automated_testing.rb,
lib/idnow/models/identification.rb,
lib/idnow/API/download_documents.rb,
lib/idnow/API/document_definitions.rb,
lib/idnow/models/document_definition.rb,
lib/idnow/models/identification_data.rb,
lib/idnow/API/request_identifications.rb,
lib/idnow/API/retrieve_identifications.rb,
lib/idnow/models/identification_process.rb,
lib/idnow/models/identification_request.rb,
lib/idnow/models/identification_document.rb

Defined Under Namespace

Modules: API, Helpers, Host, Jsonable, TargetHost Classes: AuthenticationException, Client, Configuration, ConnectionException, ContactData, DocumentDefinition, Exception, GetRequest, HttpClient, Identification, IdentificationData, IdentificationDocument, IdentificationProcess, IdentificationRequest, InvalidArguments, JsonResponse, Login, LoginData, PostBinaryRequest, PostJsonRequest, RawResponse, ResponseException, SftpClient, UserData

Constant Summary collapse

ENVIRONMENTS =
{
  test: {
    host: Host::TEST_SERVER,
    target_host: TargetHost::TEST_SERVER
  },
  live: {
    host: Host::LIVE_SERVER,
    target_host: TargetHost::LIVE_SERVER
  }
}.freeze

Class Method Summary collapse

Class Method Details

.api_key=(api_key) ⇒ Object



63
64
65
66
# File 'lib/idnow.rb', line 63

def api_key=(api_key)
  @client = nil
  @api_key = api_key
end

.clientObject



82
83
84
# File 'lib/idnow.rb', line 82

def client
  @client ||= Idnow::Client.new(env: @env, company_id: @company_id, api_key: @api_key, sftp_options: @sftp_options || {})
end

.company_id=(company_id) ⇒ Object



58
59
60
61
# File 'lib/idnow.rb', line 58

def company_id=(company_id)
  @client = nil
  @company_id = company_id
end

.custom_environments=(custom_environments) ⇒ Object



73
74
75
76
# File 'lib/idnow.rb', line 73

def custom_environments=(custom_environments)
  @client = nil
  @custom_environments = custom_environments
end

.endpoint(env, host) ⇒ Object



78
79
80
# File 'lib/idnow.rb', line 78

def endpoint(env, host)
  (@custom_environments || {}).dig(env, host) || Idnow::ENVIRONMENTS[env][host]
end

.env=(env) ⇒ Object

Raises:

  • (ArgumentError)


51
52
53
54
55
56
# File 'lib/idnow.rb', line 51

def env=(env)
  raise ArgumentError, 'Please provide a valid enviroment, :test or :live' unless ENVIRONMENTS.keys.include?(env)

  @client = nil
  @env = env
end

.sftp_options=(sftp_options) ⇒ Object



68
69
70
71
# File 'lib/idnow.rb', line 68

def sftp_options=(sftp_options)
  @client = nil
  @sftp_options = sftp_options
end