Class: AboutYou::SDK::Model::CategoryTree
- Inherits:
-
Object
- Object
- AboutYou::SDK::Model::CategoryTree
- Defined in:
- lib/AboutYou/Model/category_tree.rb
Overview
This class represents a category tree model
Instance Attribute Summary collapse
-
#category_manager ⇒ Object
instance of AboutYou::SDK::Model::CategoryManager::DefaultCategoryManager.
Instance Method Summary collapse
-
#categories(act_only = AboutYou::SDK::Model::Category::ACTIVE_ONLY) ⇒ Object
This method is used for getting the root categories of the tree.
-
#count ⇒ Object
This method counts all active root categories.
-
#initialize(cat_manager) ⇒ CategoryTree
constructor
Constructor for the AboutYou::SDK::Model::CategoryTree class.
Constructor Details
#initialize(cat_manager) ⇒ CategoryTree
Constructor for the AboutYou::SDK::Model::CategoryTree class
-
Args :
-
cat_manager
-> The category manager
-
-
Returns :
-
an instance of AboutYou::SDK::Model::CategoryTree
-
20 21 22 23 24 |
# File 'lib/AboutYou/Model/category_tree.rb', line 20 def initialize(cat_manager) self.category_manager = cat_manager self end |
Instance Attribute Details
#category_manager ⇒ Object
instance of AboutYou::SDK::Model::CategoryManager::DefaultCategoryManager
9 10 11 |
# File 'lib/AboutYou/Model/category_tree.rb', line 9 def category_manager @category_manager end |
Instance Method Details
#categories(act_only = AboutYou::SDK::Model::Category::ACTIVE_ONLY) ⇒ Object
This method is used for getting the root categories of the tree
-
Args :
-
act_only
-> boolean controlling whether the result should only contain active categories or not
-
-
Returns :
-
a Hash containing pairs of category_id => instance of AboutYou::SDK::Model::Category
-
35 36 37 |
# File 'lib/AboutYou/Model/category_tree.rb', line 35 def categories(act_only = AboutYou::SDK::Model::Category::ACTIVE_ONLY) category_manager.category_tree(act_only) end |
#count ⇒ Object
This method counts all active root categories
-
Returns :
-
Integer count of active root categories
-
45 46 47 |
# File 'lib/AboutYou/Model/category_tree.rb', line 45 def count categories(true).count end |