Sha256: 8081cefffbfdc54f01038650b6463d8b136b82749ea55ce53e460f5b489220eb

Contents?: true

Size: 824 Bytes

Versions: 5

Compression:

Stored size: 824 Bytes

Contents

module Yoti
  # Manage the API's profile requests
  class ProfileRequest
    #
    # @param [String] encrypted_connect_token
    #
    def initialize(encrypted_connect_token)
      @encrypted_connect_token = encrypted_connect_token
      @request = request
    end

    # @return [String] a JSON representation of the profile response receipt
    def receipt
      JSON.parse(@request.body)['receipt']
    end

    private

    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
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
yoti-1.10.0 lib/yoti/http/profile_request.rb
yoti-1.9.0 lib/yoti/http/profile_request.rb
yoti-1.8.0 lib/yoti/http/profile_request.rb
yoti-1.7.1 lib/yoti/http/profile_request.rb
yoti-1.7.0 lib/yoti/http/profile_request.rb