Class: Ingenico::Direct::SDK::Merchant::Products::ProductsClient

Inherits:
ApiResource
  • Object
show all
Defined in:
lib/ingenico/direct/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:



26
27
28
# File 'lib/ingenico/direct/sdk/merchant/products/products_client.rb', line 26

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

Instance Method Details

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

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

Parameters:

Returns:

Raises:



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/ingenico/direct/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,
    Ingenico::Direct::SDK::Domain::PaymentProduct,
    context
  )
rescue ResponseException => e
  error_type = Ingenico::Direct::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) ⇒ Ingenico::Direct::SDK::Domain::PaymentProductNetworksResponse

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

Parameters:

Returns:

Raises:



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

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,
    Ingenico::Direct::SDK::Domain::PaymentProductNetworksResponse,
    context
  )
rescue ResponseException => e
  error_type = Ingenico::Direct::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) ⇒ Ingenico::Direct::SDK::Domain::GetPaymentProductsResponse

Resource /v2/{merchantId}/products - Get payment products

Parameters:

Returns:

Raises:



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

def get_payment_products(query, context = nil)
  uri = instantiate_uri('/v2/{merchantId}/products')
  @communicator.get(
    uri,
    client_headers,
    query,
    Ingenico::Direct::SDK::Domain::GetPaymentProductsResponse,
    context
  )
rescue ResponseException => e
  error_type = Ingenico::Direct::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) ⇒ Ingenico::Direct::SDK::Domain::ProductDirectory

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

Parameters:

Returns:

Raises:



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

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