Class: CatalogAPI::Category

Inherits:
Object
  • Object
show all
Defined in:
lib/catalogapi/category.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Category

Returns a new instance of Category.



7
8
9
10
11
12
13
14
15
16
# File 'lib/catalogapi/category.rb', line 7

def initialize(opts)
  @category_id = opts[:category_id]
  @children = opts.dig(:children, :Category).to_a.map do |child|
    CatalogAPI::Category.new(child)
  end
  @depth = opts[:depth]
  @item_count = opts[:item_count]
  @name = opts[:name]
  @parent_category_id = opts[:parent_category_id]
end

Instance Attribute Details

#category_idObject (readonly)

Returns the value of attribute category_id.



5
6
7
# File 'lib/catalogapi/category.rb', line 5

def category_id
  @category_id
end

#childrenObject (readonly)

Returns the value of attribute children.



5
6
7
# File 'lib/catalogapi/category.rb', line 5

def children
  @children
end

#depthObject (readonly)

Returns the value of attribute depth.



5
6
7
# File 'lib/catalogapi/category.rb', line 5

def depth
  @depth
end

#item_countObject (readonly)

Returns the value of attribute item_count.



5
6
7
# File 'lib/catalogapi/category.rb', line 5

def item_count
  @item_count
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/catalogapi/category.rb', line 5

def name
  @name
end

#parent_category_idObject (readonly)

Returns the value of attribute parent_category_id.



5
6
7
# File 'lib/catalogapi/category.rb', line 5

def parent_category_id
  @parent_category_id
end