module Idnow::API::RetrieveIdentifications
Constants
- IDENTIFICATION_STATUSES
Public Instance Methods
download_identification(transaction_number:)
click to toggle source
# File lib/idnow/API/retrieve_identifications.rb, line 41 def download_identification(transaction_number:) path = "#{transaction_number}.zip" @sftp_client.download(path) end
get_identification(transaction_number:)
click to toggle source
# File lib/idnow/API/retrieve_identifications.rb, line 24 def get_identification(transaction_number:) raise Idnow::AuthenticationException if @auth_token.nil? path = full_path_for("identifications/#{transaction_number}") request = Idnow::GetRequest.new(path) response = execute(request, { 'X-API-LOGIN-TOKEN' => @auth_token }) Idnow::Identification.new(response.data) end
get_identification_file(transaction_number:)
click to toggle source
# File lib/idnow/API/retrieve_identifications.rb, line 33 def get_identification_file(transaction_number:) raise Idnow::AuthenticationException if @auth_token.nil? path = full_path_for("identifications/#{transaction_number}.zip") request = Idnow::GetRequest.new(path, '') execute(request, { 'X-API-LOGIN-TOKEN' => @auth_token }) end
list_identifications(status: nil)
click to toggle source
# File lib/idnow/API/retrieve_identifications.rb, line 8 def list_identifications(status: nil) raise Idnow::AuthenticationException if @auth_token.nil? unless status.nil? || IDENTIFICATION_STATUSES.include?(status) raise Idnow::InvalidArguments, "Status #{status} not defined, possible options are: #{IDENTIFICATION_STATUSES.join(',')}" end partial_path = status.nil? ? 'identifications' : "identifications?#{status}=true" path = full_path_for(partial_path) request = Idnow::GetRequest.new(path) response = execute(request, { 'X-API-LOGIN-TOKEN' => @auth_token }) response.data['identifications'].map do |data| Idnow::Identification.new(data) end end