Class: OnlinePayments::SDK::Merchant::HostedFields::HostedFieldsClient
- Inherits:
-
ApiResource
- Object
- ApiResource
- OnlinePayments::SDK::Merchant::HostedFields::HostedFieldsClient
- Defined in:
- lib/onlinepayments/sdk/merchant/hostedfields/hosted_fields_client.rb
Overview
HostedFields client. Thread-safe.
Instance Attribute Summary
Attributes inherited from ApiResource
#client_meta_info, #communicator
Instance Method Summary collapse
-
#create_hosted_fields_session(body, context = nil) ⇒ OnlinePayments::SDK::Domain::CreateHostedFieldsSessionResponse
Resource /v2/{merchantId}/hostedfields/sessions - Create hosted fields session.
-
#get_hosted_fields_session(session_id, context = nil) ⇒ OnlinePayments::SDK::Domain::GetHostedFieldsSessionResponse
Resource /v2/{merchantId}/hostedfields/sessions/{sessionId} - Get hosted fields session.
-
#initialize(parent, path_context) ⇒ HostedFieldsClient
constructor
A new instance of HostedFieldsClient.
Constructor Details
#initialize(parent, path_context) ⇒ HostedFieldsClient
Returns a new instance of HostedFieldsClient.
21 22 23 |
# File 'lib/onlinepayments/sdk/merchant/hostedfields/hosted_fields_client.rb', line 21 def initialize(parent, path_context) super(parent: parent, path_context: path_context) end |
Instance Method Details
#create_hosted_fields_session(body, context = nil) ⇒ OnlinePayments::SDK::Domain::CreateHostedFieldsSessionResponse
Resource /v2/{merchantId}/hostedfields/sessions - Create hosted fields session
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/onlinepayments/sdk/merchant/hostedfields/hosted_fields_client.rb', line 39 def create_hosted_fields_session(body, context = nil) uri = instantiate_uri('/v2/{merchantId}/hostedfields/sessions', nil) @communicator.post( uri, client_headers, nil, body, OnlinePayments::SDK::Domain::CreateHostedFieldsSessionResponse, context) rescue OnlinePayments::SDK::Communication::ResponseException => e error_type = OnlinePayments::SDK::Domain::ErrorResponse error_object = @communicator.marshaller.unmarshal(e.body, error_type) raise OnlinePayments::SDK.create_exception(e.status_code, e.body, error_object, context) end |
#get_hosted_fields_session(session_id, context = nil) ⇒ OnlinePayments::SDK::Domain::GetHostedFieldsSessionResponse
Resource /v2/{merchantId}/hostedfields/sessions/{sessionId} - Get hosted fields session
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/onlinepayments/sdk/merchant/hostedfields/hosted_fields_client.rb', line 71 def get_hosted_fields_session(session_id, context = nil) path_context = { 'sessionId'.freeze => session_id, } uri = instantiate_uri('/v2/{merchantId}/hostedfields/sessions/{sessionId}', path_context) @communicator.get( uri, client_headers, nil, OnlinePayments::SDK::Domain::GetHostedFieldsSessionResponse, context) rescue OnlinePayments::SDK::Communication::ResponseException => e error_type = OnlinePayments::SDK::Domain::ProblemDetailsResponse error_object = @communicator.marshaller.unmarshal(e.body, error_type) raise OnlinePayments::SDK.create_exception(e.status_code, e.body, error_object, context) end |