Class: FlexCommerce::Category
- Inherits:
-
FlexCommerceApi::ApiBase
- Object
- JsonApiClient::Resource
- FlexCommerceApi::BaseResource
- FlexCommerceApi::ApiBase
- FlexCommerce::Category
- Defined in:
- app/models/category.rb
Overview
A flex commerce Category model
This model provides access to the flex commerce categories and associated products. As managing the categories is the job of the administration panel, this model is read only.
It is used much like an active record model.
Examples:
# Fetching all categories
FlexCommerce::Category.all #fetches all categories(actually the first page in case there are thousands)
# Pagination
FlexCommerce::Category.paginate(page:2).all # Fetches page 2 of categories.
The page size is predefined on the server side
# Finding categories
FlexCommerce::Product.find("my-category-slug") # Finds the category with this unique id
# Finding nested categories of the category
FlexCommerce::Category.find("my-category-slug").categories
# Finding products within the categories
FlexCommerce::Category.find("my-category-slug").products
or if you already know the category id - then
@TODO Look into this
Constant Summary
Constants inherited from FlexCommerceApi::BaseResource
FlexCommerceApi::BaseResource::PRIVATE_ATTRIBUTES, FlexCommerceApi::BaseResource::RELATED_META_RESOURCES
Instance Method Summary collapse
-
#all ⇒ FlexCommerce::Category[]
Returns all categories.
-
#categories ⇒ FlexCommerce::Category[]
Provides a list of associated sub categories.
-
#find ⇒ FlexCommerce::Category
Finds a category.
-
#paginate ⇒ Object
Paginates the list of categories by a preset page size.
Methods inherited from FlexCommerceApi::ApiBase
Methods inherited from FlexCommerceApi::BaseResource
all, append_version, #as_json_api, capture_surrogate_keys, create!, endpoint_version, find, find_all, #freeze, #initialize, load, #meta_attribute, #method_missing, paginate, password, path, #public_attributes, reconfigure, reconfigure_all, reconfigure_api_base, reload_connection_if_required, #save!, username
Constructor Details
This class inherits a constructor from FlexCommerceApi::BaseResource
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class FlexCommerceApi::BaseResource
Instance Method Details
#categories ⇒ FlexCommerce::Category[]
Provides a list of associated sub categories
|
# File 'app/models/category.rb', line 57
|
#paginate ⇒ Object
Paginates the list of categories by a preset page size
|
# File 'app/models/category.rb', line 52
|