Class: Yoti::Sandbox::Profile::Client

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

Overview

Client for the profile 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/profile/client.rb', line 13

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

Instance Method Details

#setup_sharing_profile(token_request) ⇒ String

Parameters:

Returns:

  • (String)


22
23
24
25
26
27
28
29
30
31
32
# File 'lib/yoti_sandbox/profile/client.rb', line 22

def setup_sharing_profile(token_request)
  request = Yoti::Request
            .builder
            .with_base_url(@base_url)
            .with_endpoint("apps/#{Yoti.configuration.client_sdk_id}/tokens")
            .with_http_method('POST')
            .with_payload(token_request)
            .build

  JSON.parse(request.execute.body)['token']
end