lib/yoti/http/profile_request.rb in yoti-1.6.4 vs lib/yoti/http/profile_request.rb in yoti-1.7.0

- old
+ new

@@ -1,8 +1,11 @@ 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 @@ -12,14 +15,16 @@ end private def request - yoti_request = Yoti::Request.new - yoti_request.add_header('X-Yoti-Auth-Key', Yoti::SSL.auth_key_from_pem) - yoti_request.encrypted_connect_token = @encrypted_connect_token - yoti_request.http_method = 'GET' - yoti_request.endpoint = 'profile' - yoti_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