class AboutYou::SDK::Model::CategoryTree
This class represents a category tree model
Attributes
category_manager[RW]
Public Class Methods
new(cat_manager)
click to toggle source
Constructor for the AboutYou::SDK::Model::CategoryTree
class
-
Args :
-
cat_manager
-> The category manager
-
-
Returns :
-
an instance of
AboutYou::SDK::Model::CategoryTree
-
# File lib/AboutYou/Model/category_tree.rb, line 20 def initialize(cat_manager) self.category_manager = cat_manager self end
Public Instance Methods
categories(act_only = AboutYou::SDK::Model::Category::ACTIVE_ONLY)
click to toggle source
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
-
# 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()
click to toggle source
This method counts all active root categories
-
Returns :
-
Integer count of active root categories
-
# File lib/AboutYou/Model/category_tree.rb, line 45 def count categories(true).count end