class Yoti::ProfileRequest

Manage the API's profile requests

Public Class Methods

new(encrypted_connect_token) click to toggle source

@param [String] encrypted_connect_token

# File lib/yoti/http/profile_request.rb, line 7
def initialize(encrypted_connect_token)
  @encrypted_connect_token = encrypted_connect_token
  @request = request
end

Public Instance Methods

receipt() click to toggle source

@return [String] a JSON representation of the profile response receipt

# File lib/yoti/http/profile_request.rb, line 13
def receipt
  JSON.parse(@request.body)['receipt']
end

Private Instance Methods

request() click to toggle source
# File lib/yoti/http/profile_request.rb, line 19
def request
  Yoti::Request
    .builder
    .with_http_method('GET')
    .with_base_url(Yoti.configuration.api_endpoint)
    .with_endpoint("profile/#{Yoti::SSL.decrypt_token(@encrypted_connect_token)}")
    .with_query_param('appId', Yoti.configuration.client_sdk_id)
    .with_header('X-Yoti-Auth-Key', Yoti::SSL.auth_key_from_pem)
    .build
end