Class: Printful::CatalogResource
Instance Attribute Summary
Attributes inherited from Resource
#client
Instance Method Summary
collapse
Methods inherited from Resource
#initialize
Instance Method Details
#categories ⇒ Object
10
11
12
13
14
|
# File 'lib/printful/resources/catalog.rb', line 10
def categories
response = get_request("categories")
body = response.body["result"]["categories"]
Collection.from_response(body: body, type: Category)
end
|
#category(id:) ⇒ Object
31
32
33
34
|
# File 'lib/printful/resources/catalog.rb', line 31
def category(id:)
response = get_request("categories/#{id}")
Category.new(response.body["result"]["category"])
end
|
#product(id:) ⇒ Object
21
22
23
24
|
# File 'lib/printful/resources/catalog.rb', line 21
def product(id:)
response = get_request("products/#{id}")
Product.new(response.body["result"])
end
|
#product_sizes(id:) ⇒ Object
26
27
28
29
|
# File 'lib/printful/resources/catalog.rb', line 26
def product_sizes(id:)
response = get_request("products/#{id}/sizes")
ProductSize.new(response.body["result"])
end
|
#products(category: nil) ⇒ Object
4
5
6
7
8
|
# File 'lib/printful/resources/catalog.rb', line 4
def products(category: nil)
response = get_request("products?category_id=#{category}")
body = response.body["result"]
Collection.from_response(body: body, type: Product)
end
|
#variant(id:) ⇒ Object
16
17
18
19
|
# File 'lib/printful/resources/catalog.rb', line 16
def variant(id:)
response = get_request("products/variant/#{id}")
Variant.new(response.body["result"]["variant"])
end
|