Module: Seoshop::ProductCategory

Included in:
Client
Defined in:
lib/seoshop-api/api/product_category.rb

Instance Method Summary collapse

Instance Method Details

#get_categories_countObject



15
16
17
18
# File 'lib/seoshop-api/api/product_category.rb', line 15

def get_categories_count
  response = get("#{@shop_language}/categories/products/count.json")
  response.body ? response.body['count'] : false
end

#get_category(category_id) ⇒ Object



3
4
5
6
# File 'lib/seoshop-api/api/product_category.rb', line 3

def get_category category_id
  response = get("#{@shop_language}/categories/#{category_id}.json")
  response.body ? response.body['category'] : nil
end

#get_product_category_path(product_id) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/seoshop-api/api/product_category.rb', line 7

def get_product_category_path(product_id)
  response = get("#{@shop_language}/categories/products.json?product=#{product_id}")
  categories_products = response.body ? response.body['categoriesProducts'] : []
  categories_products.map{|category|
    get_category(category.category.resource.id).fulltitle
  }.join(">")
end