Class: MethodRuby::Resources::Accounts::Products

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

Overview

Products associated with accounts

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/accounts/products.rb', line 73

def initialize(client:)
  @client = client
end

Instance Method Details

#list(account_id, method_version:, request_options: {}) ⇒ MethodRuby::Models::Accounts::ProductListResponse

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

Returns a list of products for the specified account.

Parameters:

Returns:

See Also:



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

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

#retrieve(prd_id, account_id:, method_version:, request_options: {}) ⇒ MethodRuby::Models::Accounts::ProductRetrieveResponse

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

Retrieves an account product by its unique 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/accounts/products.rb', line 26

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