Class: Worldline::Connect::SDK::V1::Merchant::Products::ProductsClient

Inherits:
ApiResource
  • Object
show all
Defined in:
lib/worldline/connect/sdk/v1/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) ⇒ ProductsClient

Returns a new instance of ProductsClient.

Parameters:



28
29
30
# File 'lib/worldline/connect/sdk/v1/merchant/products/products_client.rb', line 28

def initialize(parent, path_context)
  super(parent: parent, path_context: path_context)
end

Instance Method Details

#customer_details(payment_product_id, body, context = nil) ⇒ Worldline::Connect::SDK::V1::Domain::GetCustomerDetailsResponse

Resource /{merchantId}/products/{paymentProductId}/customerDetails - Get customer details

Parameters:

Returns:

Raises:



139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/worldline/connect/sdk/v1/merchant/products/products_client.rb', line 139

def customer_details(payment_product_id, body, context = nil)
  path_context = {
    'paymentProductId'.freeze => payment_product_id.to_s,
  }
  uri = instantiate_uri('/v1/{merchantId}/products/{paymentProductId}/customerDetails', path_context)
  @communicator.post(
    uri,
    client_headers,
    nil,
    body,
    Worldline::Connect::SDK::V1::Domain::GetCustomerDetailsResponse,
    context)
rescue ResponseException => e
  error_type = Worldline::Connect::SDK::V1::Domain::ErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise Worldline::Connect::SDK::V1.create_exception(e.status_code, e.body, error_object, context)
end

#device_fingerprint(payment_product_id, body, context = nil) ⇒ Worldline::Connect::SDK::V1::Domain::DeviceFingerprintResponse

Resource /{merchantId}/products/{paymentProductId}/deviceFingerprint - Get device fingerprint

Parameters:

Returns:

Raises:



172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/worldline/connect/sdk/v1/merchant/products/products_client.rb', line 172

def device_fingerprint(payment_product_id, body, context = nil)
  path_context = {
    'paymentProductId'.freeze => payment_product_id.to_s,
  }
  uri = instantiate_uri('/v1/{merchantId}/products/{paymentProductId}/deviceFingerprint', path_context)
  @communicator.post(
    uri,
    client_headers,
    nil,
    body,
    Worldline::Connect::SDK::V1::Domain::DeviceFingerprintResponse,
    context)
rescue ResponseException => e
  error_type = Worldline::Connect::SDK::V1::Domain::ErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise Worldline::Connect::SDK::V1.create_exception(e.status_code, e.body, error_object, context)
end

#directory(payment_product_id, query, context = nil) ⇒ Worldline::Connect::SDK::V1::Domain::Directory

Resource /{merchantId}/products/{paymentProductId}/directory - Get payment product directory

Parameters:

Returns:

Raises:



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/worldline/connect/sdk/v1/merchant/products/products_client.rb', line 107

def directory(payment_product_id, query, context = nil)
  path_context = {
    'paymentProductId'.freeze => payment_product_id.to_s,
  }
  uri = instantiate_uri('/v1/{merchantId}/products/{paymentProductId}/directory', path_context)
  @communicator.get(
    uri,
    client_headers,
    query,
    Worldline::Connect::SDK::V1::Domain::Directory,
    context)
rescue ResponseException => e
  error_type = Worldline::Connect::SDK::V1::Domain::ErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise Worldline::Connect::SDK::V1.create_exception(e.status_code, e.body, error_object, context)
end

#find(query, context = nil) ⇒ Worldline::Connect::SDK::V1::Domain::PaymentProducts

Resource /{merchantId}/products - Get payment products

Parameters:

Returns:

Raises:



46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/worldline/connect/sdk/v1/merchant/products/products_client.rb', line 46

def find(query, context = nil)
  uri = instantiate_uri('/v1/{merchantId}/products', nil)
  @communicator.get(
    uri,
    client_headers,
    query,
    Worldline::Connect::SDK::V1::Domain::PaymentProducts,
    context)
rescue ResponseException => e
  error_type = Worldline::Connect::SDK::V1::Domain::ErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise Worldline::Connect::SDK::V1.create_exception(e.status_code, e.body, error_object, context)
end

#get(payment_product_id, query, context = nil) ⇒ Worldline::Connect::SDK::V1::Domain::PaymentProductResponse

Resource /{merchantId}/products/{paymentProductId} - Get payment product

Parameters:

Returns:

Raises:



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/worldline/connect/sdk/v1/merchant/products/products_client.rb', line 75

def get(payment_product_id, query, context = nil)
  path_context = {
    'paymentProductId'.freeze => payment_product_id.to_s,
  }
  uri = instantiate_uri('/v1/{merchantId}/products/{paymentProductId}', path_context)
  @communicator.get(
    uri,
    client_headers,
    query,
    Worldline::Connect::SDK::V1::Domain::PaymentProductResponse,
    context)
rescue ResponseException => e
  error_type = Worldline::Connect::SDK::V1::Domain::ErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise Worldline::Connect::SDK::V1.create_exception(e.status_code, e.body, error_object, context)
end

#networks(payment_product_id, query, context = nil) ⇒ Worldline::Connect::SDK::V1::Domain::PaymentProductNetworksResponse

Resource /{merchantId}/products/{paymentProductId}/networks - Get payment product networks

Parameters:

Returns:

Raises:



205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# File 'lib/worldline/connect/sdk/v1/merchant/products/products_client.rb', line 205

def networks(payment_product_id, query, context = nil)
  path_context = {
    'paymentProductId'.freeze => payment_product_id.to_s,
  }
  uri = instantiate_uri('/v1/{merchantId}/products/{paymentProductId}/networks', path_context)
  @communicator.get(
    uri,
    client_headers,
    query,
    Worldline::Connect::SDK::V1::Domain::PaymentProductNetworksResponse,
    context)
rescue ResponseException => e
  error_type = Worldline::Connect::SDK::V1::Domain::ErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise Worldline::Connect::SDK::V1.create_exception(e.status_code, e.body, error_object, context)
end

#sessions(payment_product_id, body, context = nil) ⇒ Worldline::Connect::SDK::V1::Domain::CreatePaymentProductSessionResponse

Resource /{merchantId}/products/{paymentProductId}/sessions - Create session for payment product

Parameters:

Returns:

Raises:



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
# File 'lib/worldline/connect/sdk/v1/merchant/products/products_client.rb', line 237

def sessions(payment_product_id, body, context = nil)
  path_context = {
    'paymentProductId'.freeze => payment_product_id.to_s,
  }
  uri = instantiate_uri('/v1/{merchantId}/products/{paymentProductId}/sessions', path_context)
  @communicator.post(
    uri,
    client_headers,
    nil,
    body,
    Worldline::Connect::SDK::V1::Domain::CreatePaymentProductSessionResponse,
    context)
rescue ResponseException => e
  error_type = Worldline::Connect::SDK::V1::Domain::ErrorResponse
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise Worldline::Connect::SDK::V1.create_exception(e.status_code, e.body, error_object, context)
end