Class: Printful::ProductTemplatesResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/printful/resources/product_templates.rb

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from Printful::Resource

Instance Method Details

#delete(id:) ⇒ Object


15
16
17
18
# File 'lib/printful/resources/product_templates.rb', line 15

def delete(id:)
  response = delete_request("product-templates/#{id}")
  return true if response.success?
end

#listObject


4
5
6
7
8
# File 'lib/printful/resources/product_templates.rb', line 4

def list
  response = get_request("product-templates")
  body = response.body["result"]["items"]
  Collection.from_response(body: body, type: ProductTemplate)
end

#retrieve(id:) ⇒ Object


10
11
12
13
# File 'lib/printful/resources/product_templates.rb', line 10

def retrieve(id:)
  response = get_request("product-templates/#{id}")
  ProductTemplate.new(response.body["result"])
end