Class: Shirtsio::Product::Category
- Defined in:
- lib/shirtsio/product.rb
Class Method Summary collapse
-
.list ⇒ Array
Get a list of all available product categories.
Instance Method Summary collapse
-
#products ⇒ Array
Get a list of products in the current category.
Methods inherited from Endpoint
#initialize, #method_missing, #respond_to?
Constructor Details
This class inherits a constructor from Shirtsio::Endpoint
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Shirtsio::Endpoint
Class Method Details
.list ⇒ Array
Get a list of all available product categories.
38 39 40 41 42 43 44 45 |
# File 'lib/shirtsio/product.rb', line 38 def self.list categories = [] response = Shirtsio.get('/products/category/') response.each do |category| categories << new(category) end categories end |
Instance Method Details
#products ⇒ Array
Note:
This endpoint does not return complete product objects
Get a list of products in the current category.
26 27 28 29 30 31 32 33 |
# File 'lib/shirtsio/product.rb', line 26 def products products = [] response = Shirtsio.get("/products/category/#{category_id}/") response.each do |product| products << Shirtsio::Product::Simple.new(product) end products end |