Class: Yoti::Sandbox::DocScan::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/yoti_sandbox/doc_scan/client.rb

Overview

Client for the Doc Scan sandbox service

Instance Method Summary collapse

Constructor Details

#initialize(base_url: nil) ⇒ Client

Returns a new instance of Client.

Parameters:

  • base_url (String) (defaults to: nil)


13
14
15
# File 'lib/yoti_sandbox/doc_scan/client.rb', line 13

def initialize(base_url: nil)
  @base_url = base_url || "#{Yoti.configuration.api_url}/sandbox/idverify/v1"
end

Instance Method Details

#configure_application_response(response_config) ⇒ Object

Parameters:

  • response_config (Yoti::SandboxDocScan::Request::ResponseConfig)


41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/yoti_sandbox/doc_scan/client.rb', line 41

def configure_application_response(response_config)
  request = Yoti::Request
            .builder
            .with_http_method('PUT')
            .with_base_url(@base_url)
            .with_endpoint("apps/#{Yoti.configuration.client_sdk_id}/response-config")
            .with_payload(response_config)
            .build

  begin
    request.execute
  rescue Yoti::RequestError => e
    raise Yoti::Sandbox::DocScan::Error.wrap(e)
  end
end

#configure_session_response(session_id, response_config) ⇒ Object

Parameters:

  • session_id (String)
  • response_config (Yoti::SandboxDocScan::Request::ResponseConfig)


21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/yoti_sandbox/doc_scan/client.rb', line 21

def configure_session_response(session_id, response_config)
  request = Yoti::Request
            .builder
            .with_http_method('PUT')
            .with_base_url(@base_url)
            .with_endpoint("sessions/#{session_id}/response-config")
            .with_query_param('sdkId', Yoti.configuration.client_sdk_id)
            .with_payload(response_config)
            .build

  begin
    request.execute
  rescue Yoti::RequestError => e
    raise Yoti::Sandbox::DocScan::Error.wrap(e)
  end
end