Class: EasyLabs::Resources::Products

Inherits:
Base
  • Object
show all
Defined in:
lib/easylabs/resources/products.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from EasyLabs::Resources::Base

Instance Method Details

#archive(id) ⇒ Object



24
25
26
# File 'lib/easylabs/resources/products.rb', line 24

def archive(id)
  request(:patch, "/products/#{id}/archive")
end

#create(**body) ⇒ Object



16
17
18
# File 'lib/easylabs/resources/products.rb', line 16

def create(**body)
  request(:post, "/products", body: body)
end

#list(limit: nil, offset: nil, ids: nil) ⇒ Object



8
9
10
# File 'lib/easylabs/resources/products.rb', line 8

def list(limit: nil, offset: nil, ids: nil)
  request(:get, "/products", query: pagination_query(limit: limit, offset: offset, ids: ids))
end

#retrieve(id) ⇒ Object



12
13
14
# File 'lib/easylabs/resources/products.rb', line 12

def retrieve(id)
  request(:get, "/products/#{id}")
end

#update(id, **body) ⇒ Object



20
21
22
# File 'lib/easylabs/resources/products.rb', line 20

def update(id, **body)
  request(:patch, "/products/#{id}", body: body)
end

#with_price(id, price_id) ⇒ Object

GET /products/:id/prices/:price_id — product + a single price.



34
35
36
# File 'lib/easylabs/resources/products.rb', line 34

def with_price(id, price_id)
  request(:get, "/products/#{id}/prices/#{price_id}")
end

#with_prices(id) ⇒ Object

GET /products/:id/prices — product + nested prices array.



29
30
31
# File 'lib/easylabs/resources/products.rb', line 29

def with_prices(id)
  request(:get, "/products/#{id}/prices")
end