Class: MethodRuby::Resources::Entities::Products

Inherits:
Object
  • Object
show all
Defined in:
lib/method_ruby/resources/entities/products.rb

Overview

Products associated with entities

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Products

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Products.

Parameters:



73
74
75
# File 'lib/method_ruby/resources/entities/products.rb', line 73

def initialize(client:)
  @client = client
end

Instance Method Details

#list(entity_id, method_version:, request_options: {}) ⇒ MethodRuby::Models::Entities::ProductListResponse

Some parameter documentations has been truncated, see Models::Entities::ProductListParams for more details.

Returns a list of products for the specified entity.

Parameters:

Returns:

See Also:



58
59
60
61
62
63
64
65
66
67
68
# File 'lib/method_ruby/resources/entities/products.rb', line 58

def list(entity_id, params)
  parsed, options = MethodRuby::Entities::ProductListParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["entities/%1$s/products", entity_id],
    headers: parsed.transform_keys(method_version: "method-version"),
    model: MethodRuby::Models::Entities::ProductListResponse,
    security: {secret_key: true},
    options: options
  )
end

#retrieve(prd_id, entity_id:, method_version:, request_options: {}) ⇒ MethodRuby::Models::Entities::ProductRetrieveResponse

Some parameter documentations has been truncated, see Models::Entities::ProductRetrieveParams for more details.

Returns a single entity product by its identifier.

Parameters:

Returns:

See Also:



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/method_ruby/resources/entities/products.rb', line 26

def retrieve(prd_id, params)
  parsed, options = MethodRuby::Entities::ProductRetrieveParams.dump_request(params)
  entity_id =
    parsed.delete(:entity_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["entities/%1$s/products/%2$s", entity_id, prd_id],
    headers: parsed.transform_keys(method_version: "method-version"),
    model: MethodRuby::Models::Entities::ProductRetrieveResponse,
    security: {secret_key: true},
    options: options
  )
end