class EcwidApi::Api::Categories
Public Instance Methods
all(params = {})
click to toggle source
Public: Returns all of the sub-categories for a given category
See: kb.ecwid.com/w/page/25285101/Product%20API#RESTAPIMethodcategories
parent - The Category
ID of the parent category. If the parent is 0 then
a list of the root categories will be returned. If the parent is nil, then all of the categories will be returned
Returns an array of EcwidApi::Category
objects
# File lib/ecwid_api/api/categories.rb, line 15 def all(params = {}) PagedEcwidResponse.new(client, "categories", params) do |category_hash| Category.new(category_hash, client: client) end.sort_by(&:order_by) end
create(params)
click to toggle source
find(id)
click to toggle source
Public: Returns a single EcwidApi::Category
See: kb.ecwid.com/w/page/25285101/Product%20API#RESTAPIMethodcategory
category_id - A Category
ID to get
Returns an EcwidApi::Category
, or nil if it can't be found
# File lib/ecwid_api/api/categories.rb, line 33 def find(id) response = client.get("categories/#{id}") if response.success? Category.new(response.body, client: client) else nil end rescue Zlib::BufError nil end
root(params = {})
click to toggle source
Public: Returns an Array of the root level EcwidApi::Category
objects
# File lib/ecwid_api/api/categories.rb, line 22 def root(params = {}) all(params.merge(parent: 0)) end