Class: OnlinePayments::SDK::Merchant::ProductGroups::ProductGroupsClient

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



21
22
23
# File 'lib/onlinepayments/sdk/merchant/productgroups/product_groups_client.rb', line 21

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

Instance Method Details

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

Resource /v2/{merchantId}/productgroups/{paymentProductGroupId}

Parameters:

Returns:

Raises:



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

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,
    OnlinePayments::SDK::Domain::PaymentProductGroup,
    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_groups(query, context = nil) ⇒ OnlinePayments::SDK::Domain::GetPaymentProductGroupsResponse

Resource /v2/{merchantId}/productgroups

Parameters:

Returns:

Raises:



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

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