Class: OnlinePayments::SDK::Merchant::Tokens::TokensClient
- Inherits:
-
ApiResource
- Object
- ApiResource
- OnlinePayments::SDK::Merchant::Tokens::TokensClient
- Defined in:
- lib/onlinepayments/sdk/merchant/tokens/tokens_client.rb
Overview
Tokens client. Thread-safe.
Instance Attribute Summary
Attributes inherited from ApiResource
#client_meta_info, #communicator
Instance Method Summary collapse
-
#create_token(body, context = nil) ⇒ OnlinePayments::SDK::Domain::CreatedTokenResponse
Resource /v2/{merchantId}/tokens - Create token.
-
#delete_token(token_id, context = nil) ⇒ Object
Resource /v2/{merchantId}/tokens/{tokenId} - Delete token.
-
#get_token(token_id, context = nil) ⇒ OnlinePayments::SDK::Domain::TokenResponse
Resource /v2/{merchantId}/tokens/{tokenId} - Get token.
-
#initialize(parent, path_context) ⇒ TokensClient
constructor
A new instance of TokensClient.
Constructor Details
#initialize(parent, path_context) ⇒ TokensClient
Returns a new instance of TokensClient.
20 21 22 |
# File 'lib/onlinepayments/sdk/merchant/tokens/tokens_client.rb', line 20 def initialize(parent, path_context) super(parent: parent, path_context: path_context) end |
Instance Method Details
#create_token(body, context = nil) ⇒ OnlinePayments::SDK::Domain::CreatedTokenResponse
Resource /v2/{merchantId}/tokens - Create token
99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/onlinepayments/sdk/merchant/tokens/tokens_client.rb', line 99 def create_token(body, context = nil) uri = instantiate_uri('/v2/{merchantId}/tokens', nil) @communicator.post( uri, client_headers, nil, body, OnlinePayments::SDK::Domain::CreatedTokenResponse, 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 |
#delete_token(token_id, context = nil) ⇒ Object
Resource /v2/{merchantId}/tokens/{tokenId} - Delete token
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/onlinepayments/sdk/merchant/tokens/tokens_client.rb', line 68 def delete_token(token_id, context = nil) path_context = { 'tokenId'.freeze => token_id, } uri = instantiate_uri('/v2/{merchantId}/tokens/{tokenId}', path_context) @communicator.delete( uri, client_headers, nil, nil, 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_token(token_id, context = nil) ⇒ OnlinePayments::SDK::Domain::TokenResponse
Resource /v2/{merchantId}/tokens/{tokenId} - Get token
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/onlinepayments/sdk/merchant/tokens/tokens_client.rb', line 38 def get_token(token_id, context = nil) path_context = { 'tokenId'.freeze => token_id, } uri = instantiate_uri('/v2/{merchantId}/tokens/{tokenId}', path_context) @communicator.get( uri, client_headers, nil, OnlinePayments::SDK::Domain::TokenResponse, 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 |