Class: Ingenico::Connect::SDK::Merchant::Products::ProductsClient

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

parent

ApiResource

path_context

Hash of String to String



23
24
25
# File 'lib/ingenico/connect/sdk/merchant/products/products_client.rb', line 23

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

Instance Method Details

#directory(payment_product_id, query, context = nil) ⇒ Object

Resource /{merchantId}/products/{paymentProductId}/directory

_merchantId__products__paymentProductId__directory_get Get payment product directory

payment_product_id

Integer

query

DirectoryParams

context

CallContext

Returns

Domain::Product::Directory

Raises

ValidationException if the request was not correct and couldn’t be processed (HTTP status code 400)

Raises

AuthorizationException if the request was not allowed (HTTP status code 403)

Raises

IdempotenceException if an idempotent request caused a conflict (HTTP status code 409)

Raises

ReferenceException if an object was attempted to be referenced that doesn’t exist or has been removed,

or there was a conflict (HTTP status code 404, 409 or 410)

Raises

GlobalCollectException if something went wrong at the GlobalCollect platform,

the GlobalCollect platform was unable to process a message from a downstream partner/acquirer,

or the service that you’re trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)

Raises

ApiException if the GlobalCollect platform returned any other error



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

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

#find(query, context = nil) ⇒ Object

Resource /{merchantId}/products

_merchantId__products_get Get payment products

query

FindParams

context

CallContext

Returns

Domain::Product::PaymentProducts

Raises

ValidationException if the request was not correct and couldn’t be processed (HTTP status code 400)

Raises

AuthorizationException if the request was not allowed (HTTP status code 403)

Raises

IdempotenceException if an idempotent request caused a conflict (HTTP status code 409)

Raises

ReferenceException if an object was attempted to be referenced that doesn’t exist or has been removed,

or there was a conflict (HTTP status code 404, 409 or 410)

Raises

GlobalCollectException if something went wrong at the GlobalCollect platform,

the GlobalCollect platform was unable to process a message from a downstream partner/acquirer,

or the service that you’re trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)

Raises

ApiException if the GlobalCollect platform returned any other error



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

def find(query, context=nil)
  uri = instantiate_uri('/{apiVersion}/{merchantId}/products', nil)
  return @communicator.get(
    uri,
    client_headers,
    query,
    Ingenico::Connect::SDK::Domain::Product::PaymentProducts,
    context)
rescue ResponseException => e
  error_type = Ingenico::Connect::SDK::Domain::Errors::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_id, query, context = nil) ⇒ Object

Resource /{merchantId}/products/{paymentProductId}

_merchantId__products__paymentProductId__get Get payment product

payment_product_id

Integer

query

GetParams

context

CallContext

Returns

Domain::Product::PaymentProductResponse

Raises

ValidationException if the request was not correct and couldn’t be processed (HTTP status code 400)

Raises

AuthorizationException if the request was not allowed (HTTP status code 403)

Raises

IdempotenceException if an idempotent request caused a conflict (HTTP status code 409)

Raises

ReferenceException if an object was attempted to be referenced that doesn’t exist or has been removed,

or there was a conflict (HTTP status code 404, 409 or 410)

Raises

GlobalCollectException if something went wrong at the GlobalCollect platform,

the GlobalCollect platform was unable to process a message from a downstream partner/acquirer,

or the service that you’re trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)

Raises

ApiException if the GlobalCollect platform returned any other error



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

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

#networks(payment_product_id, query, context = nil) ⇒ Object

Resource /{merchantId}/products/{paymentProductId}/networks

_merchantId__products__paymentProductId__networks_get Get payment product networks

payment_product_id

Integer

query

NetworksParams

context

CallContext

Returns

Domain::Product::PaymentProductNetworksResponse

Raises

ValidationException if the request was not correct and couldn’t be processed (HTTP status code 400)

Raises

AuthorizationException if the request was not allowed (HTTP status code 403)

Raises

IdempotenceException if an idempotent request caused a conflict (HTTP status code 409)

Raises

ReferenceException if an object was attempted to be referenced that doesn’t exist or has been removed,

or there was a conflict (HTTP status code 404, 409 or 410)

Raises

GlobalCollectException if something went wrong at the GlobalCollect platform,

the GlobalCollect platform was unable to process a message from a downstream partner/acquirer,

or the service that you’re trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)

Raises

ApiException if the GlobalCollect platform returned any other error



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

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

#public_key(payment_product_id, context = nil) ⇒ Object

Resource /{merchantId}/products/{paymentProductId}/publicKey

_merchantId__products__paymentProductId__publicKey_get Get payment product specific public key

payment_product_id

Integer

context

CallContext

Returns

Domain::Publickey::PublicKey

Raises

ValidationException if the request was not correct and couldn’t be processed (HTTP status code 400)

Raises

AuthorizationException if the request was not allowed (HTTP status code 403)

Raises

IdempotenceException if an idempotent request caused a conflict (HTTP status code 409)

Raises

ReferenceException if an object was attempted to be referenced that doesn’t exist or has been removed,

or there was a conflict (HTTP status code 404, 409 or 410)

Raises

GlobalCollectException if something went wrong at the GlobalCollect platform,

the GlobalCollect platform was unable to process a message from a downstream partner/acquirer,

or the service that you’re trying to reach is temporary unavailable (HTTP status code 500, 502 or 503)

Raises

ApiException if the GlobalCollect platform returned any other error



174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# File 'lib/ingenico/connect/sdk/merchant/products/products_client.rb', line 174

def public_key(payment_product_id, context=nil)
  path_context = {
    'paymentProductId' => payment_product_id.to_s,
  }
  uri = instantiate_uri('/{apiVersion}/{merchantId}/products/{paymentProductId}/publicKey', path_context)
  return @communicator.get(
    uri,
    client_headers,
    nil,
    Ingenico::Connect::SDK::Domain::Publickey::PublicKey,
    context)
rescue ResponseException => e
  error_type = {
    404 => Ingenico::Connect::SDK::Domain::Errors::ErrorResponse,
  }.fetch(e.status_code, Ingenico::Connect::SDK::Domain::Errors::ErrorResponse)
  error_object = @communicator.marshaller.unmarshal(e.body, error_type)
  raise create_exception(e.status_code, e.body, error_object, context)
end