Module: Epages::REST::Categories

Includes:
Utils
Included in:
API
Defined in:
lib/epages/rest/categories.rb

Instance Method Summary collapse

Methods included from Utils

#epages_id, #format_date, #format_dates_options, #parse_legal_info, #parse_links, #parse_price_info, #parse_product_lowest_price, #parse_product_variations, #parse_suggestions_to_products, #parse_variation_object, #parse_variations, #perform_delete_request, #perform_delete_with_object, #perform_get_request, #perform_get_with_key_and_objects, #perform_get_with_object, #perform_get_with_objects, #perform_multipart_post_with_objects, #perform_patch_with_object, #perform_post_request, #perform_post_with_key_and_objects, #perform_post_with_object, #perform_post_with_objects, #perform_put_request, #perform_put_with_object, #perform_request, #perform_request_with_key_and_objects, #perform_request_with_object, #perform_request_with_objects, #process_thread

Instance Method Details

#assign_products(options = {}) ⇒ Object

implements the call developer.epages.com/apps/api-reference/post-shops-shopid-product-category-assignments.html Same as Epages::REST::Products#‘assign_categories`



54
55
56
# File 'lib/epages/rest/categories.rb', line 54

def assign_products(options = {})
  perform_post_request('/product-category-assignments', options)
end

#categories(options = {}) ⇒ Object



10
11
12
# File 'lib/epages/rest/categories.rb', line 10

def categories(options = {})
  perform_get_with_objects('/categories', options, Epages::Category)
end

#category(object, options = {}) ⇒ Object



15
16
17
18
# File 'lib/epages/rest/categories.rb', line 15

def category(object, options = {})
  id = epages_id(object)
  perform_get_with_object("/categories/#{id}", options, Epages::Category)
end

#create_category(object, options = {}) ⇒ Object

implements the call developer.epages.com/apps/api-reference/post-shops-shopid-categories-categoryid.html The id can be from the root category or to create a subcategory



22
23
24
25
# File 'lib/epages/rest/categories.rb', line 22

def create_category(object, options = {})
  id = epages_id(object)
  perform_post_with_object("/categories/#{id}", options, Epages::Category)
end

#delete_category(category) ⇒ Object



35
36
37
38
# File 'lib/epages/rest/categories.rb', line 35

def delete_category(category)
  id = epages_id(category)
  perform_delete_request("/categories/#{id}")
end

#delete_products(options = {}) ⇒ Object

implements the call developer.epages.com/apps/api-reference/delete-shops-shopid-product-category-assignments.html Same as Epages::REST::Products#‘delete_from_categories`



60
61
62
# File 'lib/epages/rest/categories.rb', line 60

def delete_products(options = {})
  perform_delete_request('/product-category-assignments', options)
end

#reorder_subcategories(object, data) ⇒ Object



47
48
49
50
# File 'lib/epages/rest/categories.rb', line 47

def reorder_subcategories(object, data)
  id = epages_id(object)
  perform_put_request("/categories/#{id}/sequence", data)
end

#subcategories(object) ⇒ Object



41
42
43
44
# File 'lib/epages/rest/categories.rb', line 41

def subcategories(object)
  id = epages_id(object)
  perform_get_request("/categories/#{id}/sequence")
end

#update_category(object, options) ⇒ Object



28
29
30
31
32
# File 'lib/epages/rest/categories.rb', line 28

def update_category(object, options)
  id = epages_id(object)
  options[:categoryId] = id
  perform_put_with_object("/categories/#{id}", options, Epages::Category)
end