Class: OnlinePayments::SDK::Merchant::Products::ProductsClient
- Inherits:
-
ApiResource
- Object
- ApiResource
- OnlinePayments::SDK::Merchant::Products::ProductsClient
- Defined in:
- lib/onlinepayments/sdk/merchant/products/products_client.rb
Overview
Products client. Thread-safe.
Instance Attribute Summary
Attributes inherited from ApiResource
#client_meta_info, #communicator
Instance Method Summary collapse
-
#create_payment_product_session(payment_product_id, body, context = nil) ⇒ OnlinePayments::SDK::Domain::PaymentProductSessionResponse
Resource /v2/{merchantId}/products/{paymentProductId}/sessions - Create a session for a payment product.
-
#get_payment_product(payment_product_id, query, context = nil) ⇒ OnlinePayments::SDK::Domain::PaymentProduct
Resource /v2/{merchantId}/products/{paymentProductId} - Get payment product.
-
#get_payment_product_networks(payment_product_id, query, context = nil) ⇒ OnlinePayments::SDK::Domain::PaymentProductNetworksResponse
Resource /v2/{merchantId}/products/{paymentProductId}/networks - Get payment product networks.
-
#get_payment_products(query, context = nil) ⇒ OnlinePayments::SDK::Domain::GetPaymentProductsResponse
Resource /v2/{merchantId}/products - Get payment products.
-
#get_product_directory(payment_product_id, query, context = nil) ⇒ OnlinePayments::SDK::Domain::ProductDirectory
Resource /v2/{merchantId}/products/{paymentProductId}/directory - Get payment product directory.
-
#initialize(parent, path_context) ⇒ ProductsClient
constructor
A new instance of ProductsClient.
Constructor Details
#initialize(parent, path_context) ⇒ ProductsClient
Returns a new instance of ProductsClient.
23 24 25 |
# File 'lib/onlinepayments/sdk/merchant/products/products_client.rb', line 23 def initialize(parent, path_context) super(parent: parent, path_context: path_context) end |
Instance Method Details
#create_payment_product_session(payment_product_id, body, context = nil) ⇒ OnlinePayments::SDK::Domain::PaymentProductSessionResponse
Resource /v2/{merchantId}/products/{paymentProductId}/sessions - Create a session for a payment product
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
# File 'lib/onlinepayments/sdk/merchant/products/products_client.rb', line 174 def create_payment_product_session(payment_product_id, body, context = nil) path_context = { 'paymentProductId'.freeze => payment_product_id.to_s, } uri = instantiate_uri('/v2/{merchantId}/products/{paymentProductId}/sessions', path_context) @communicator.post( uri, client_headers, nil, body, OnlinePayments::SDK::Domain::PaymentProductSessionResponse, 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_payment_product(payment_product_id, query, context = nil) ⇒ OnlinePayments::SDK::Domain::PaymentProduct
Resource /v2/{merchantId}/products/{paymentProductId} - Get payment product
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/onlinepayments/sdk/merchant/products/products_client.rb', line 72 def get_payment_product(payment_product_id, query, context = nil) path_context = { 'paymentProductId'.freeze => payment_product_id.to_s, } uri = instantiate_uri('/v2/{merchantId}/products/{paymentProductId}', path_context) @communicator.get( uri, client_headers, query, OnlinePayments::SDK::Domain::PaymentProduct, 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_payment_product_networks(payment_product_id, query, context = nil) ⇒ OnlinePayments::SDK::Domain::PaymentProductNetworksResponse
Resource /v2/{merchantId}/products/{paymentProductId}/networks - Get payment product networks
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/onlinepayments/sdk/merchant/products/products_client.rb', line 106 def get_payment_product_networks(payment_product_id, query, context = nil) path_context = { 'paymentProductId'.freeze => payment_product_id.to_s, } uri = instantiate_uri('/v2/{merchantId}/products/{paymentProductId}/networks', path_context) @communicator.get( uri, client_headers, query, OnlinePayments::SDK::Domain::PaymentProductNetworksResponse, 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_payment_products(query, context = nil) ⇒ OnlinePayments::SDK::Domain::GetPaymentProductsResponse
Resource /v2/{merchantId}/products - Get payment products
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/onlinepayments/sdk/merchant/products/products_client.rb', line 41 def get_payment_products(query, context = nil) uri = instantiate_uri('/v2/{merchantId}/products', nil) @communicator.get( uri, client_headers, query, OnlinePayments::SDK::Domain::GetPaymentProductsResponse, 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_product_directory(payment_product_id, query, context = nil) ⇒ OnlinePayments::SDK::Domain::ProductDirectory
Resource /v2/{merchantId}/products/{paymentProductId}/directory - Get payment product directory
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'lib/onlinepayments/sdk/merchant/products/products_client.rb', line 140 def get_product_directory(payment_product_id, query, context = nil) path_context = { 'paymentProductId'.freeze => payment_product_id.to_s, } uri = instantiate_uri('/v2/{merchantId}/products/{paymentProductId}/directory', path_context) @communicator.get( uri, client_headers, query, OnlinePayments::SDK::Domain::ProductDirectory, 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 |