Class: Rooftop::Taxonomy

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/rooftop/models/taxonomy.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Base

included, included_classes

Class Method Details

.allObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/rooftop/models/taxonomy.rb', line 10

def self.all
  taxonomies = []
  get_raw(self.collection_path) do |parsed, raw|
    parsed[:data].each do |tax,data|
      taxonomies << Taxonomy.new(data)
    end
  end
  taxonomies.each do |t|
    t.run_callbacks(:find)
  end
  return taxonomies
end

Instance Method Details

#termsObject



23
24
25
# File 'lib/rooftop/models/taxonomy.rb', line 23

def terms
  TaxonomyTerm.get(resource_links.find_by(link_type: "wp:items").first.href)
end