Class: Access::Category

Inherits:
Object
  • Object
show all
Includes:
MuchMeta
Defined in:
lib/access/category.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from MuchMeta

#set_up_methods, #set_values

Constructor Details

#initialize(values) ⇒ Category

Returns a new instance of Category.



17
18
19
20
21
22
23
24
# File 'lib/access/category.rb', line 17

def initialize(values)
  @used_fields = []
  set_up_methods(values)
  set_values(values)
  @links = Access::Link.new(@links) if @links
  @subcategories = Access::Category.process_batch(@subcategories) if @subcategories
  @subcategory_siblings = Access::Category.process_batch(@subcategory_siblings) if @subcategory_siblings
end

Class Method Details

.find(category_key, options = {}) ⇒ Object



9
10
11
# File 'lib/access/category.rb', line 9

def self.find(category_key, options = {})
  Access::Api.new.find_category category_key, options
end

.process_batch(chunk) ⇒ Object



13
14
15
# File 'lib/access/category.rb', line 13

def self.process_batch(chunk)
  chunk.map { |category| new(category) }
end

.search(options = {}) ⇒ Object



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

def self.search(options = {})
  Access::Api.new.search_categories options
end