Class: OnlinePayments::SDK::Merchant::Products::ProductsClient

Inherits:
ApiResource
  • Object
show all
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

Constructor Details

#initialize(parent, path_context = nil) ⇒ ProductsClient

Returns a new instance of ProductsClient.

Parameters:



25
26
27
# File 'lib/onlinepayments/sdk/merchant/products/products_client.rb', line 25

def initialize(parent, path_context = nil)
  super(parent, path_context)
end

Instance Method Details

#get_payment_product(payment_product_id, query, context = nil) ⇒ OnlinePayments::SDK::Domain::PaymentProduct

Resource /v2/{merchantId}/products/{paymentProductId}

Parameters:

Returns:

Raises:



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/onlinepayments/sdk/merchant/products/products_client.rb', line 71

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 ResponseException => e
  error_type = OnlinePayments::SDK::Domain::ErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise 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

Parameters:

Returns:

Raises:



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/onlinepayments/sdk/merchant/products/products_client.rb', line 135

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 ResponseException => e
  error_type = OnlinePayments::SDK::Domain::ErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise 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

Parameters:

Returns:

Raises:



42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/onlinepayments/sdk/merchant/products/products_client.rb', line 42

def get_payment_products(query, context = nil)
  uri = instantiate_uri('/v2/{merchantId}/products')
  @communicator.get(
    uri,
    client_headers,
    query,
    OnlinePayments::SDK::Domain::GetPaymentProductsResponse,
    context
  )
rescue ResponseException => e
  error_type = OnlinePayments::SDK::Domain::ErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise 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

Parameters:

Returns:

Raises:



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/onlinepayments/sdk/merchant/products/products_client.rb', line 103

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 ResponseException => e
  error_type = OnlinePayments::SDK::Domain::ErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise create_exception(e.status_code, e.body, error_object, context)
end