Class: TerminalShop::Resources::Product

Inherits:
Object
  • Object
show all
Defined in:
lib/terminal_shop/resources/product.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Product

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 Product.

Parameters:



47
48
49
# File 'lib/terminal_shop/resources/product.rb', line 47

def initialize(client:)
  @client = client
end

Instance Method Details

#get(id, request_options: {}) ⇒ TerminalShop::Models::ProductGetResponse

Get a product by ID from the Terminal shop.

Parameters:

Returns:

See Also:



35
36
37
38
39
40
41
42
# File 'lib/terminal_shop/resources/product.rb', line 35

def get(id, params = {})
  @client.request(
    method: :get,
    path: ["product/%1$s", id],
    model: TerminalShop::Models::ProductGetResponse,
    options: params[:request_options]
  )
end

#list(request_options: {}) ⇒ TerminalShop::Models::ProductListResponse

List all products for sale in the Terminal shop.

Parameters:

Returns:

See Also:



15
16
17
18
19
20
21
22
# File 'lib/terminal_shop/resources/product.rb', line 15

def list(params = {})
  @client.request(
    method: :get,
    path: "product",
    model: TerminalShop::Models::ProductListResponse,
    options: params[:request_options]
  )
end