Class: Ingenico::Direct::SDK::Merchant::ProductGroups::ProductGroupsClient

Inherits:
ApiResource
  • Object
show all
Defined in:
lib/ingenico/direct/sdk/merchant/productgroups/product_groups_client.rb

Overview

ProductGroups 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) ⇒ ProductGroupsClient

Returns a new instance of ProductGroupsClient.

Parameters:



22
23
24
# File 'lib/ingenico/direct/sdk/merchant/productgroups/product_groups_client.rb', line 22

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

Instance Method Details

#get_product_group(payment_product_group_id, query, context = nil) ⇒ Ingenico::Direct::SDK::Domain::PaymentProductGroup

Resource /v2/{merchantId}/productgroups/{paymentProductGroupId} - Get product group

Parameters:

Returns:

Raises:



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/ingenico/direct/sdk/merchant/productgroups/product_groups_client.rb', line 68

def get_product_group(payment_product_group_id, query, context = nil)
  path_context = {
    'paymentProductGroupId'.freeze => payment_product_group_id,
  }
  uri = instantiate_uri('/v2/{merchantId}/productgroups/{paymentProductGroupId}', path_context)
  @communicator.get(
    uri,
    client_headers,
    query,
    Ingenico::Direct::SDK::Domain::PaymentProductGroup,
    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_groups(query, context = nil) ⇒ Ingenico::Direct::SDK::Domain::GetPaymentProductGroupsResponse

Resource /v2/{merchantId}/productgroups - Get product groups

Parameters:

Returns:

Raises:



39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/ingenico/direct/sdk/merchant/productgroups/product_groups_client.rb', line 39

def get_product_groups(query, context = nil)
  uri = instantiate_uri('/v2/{merchantId}/productgroups')
  @communicator.get(
    uri,
    client_headers,
    query,
    Ingenico::Direct::SDK::Domain::GetPaymentProductGroupsResponse,
    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