class Shirtsio::Product::Category

Public Class Methods

list() click to toggle source

Get a list of all available product categories.

@return [Array] an array of category objects

# 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

Public Instance Methods

products() click to toggle source

Get a list of products in the current category.

@note This endpoint does not return complete product objects @see {Shirtsio::Product::Simple#full_product} @return [Array] an array of simple product objects

# 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