Sha256: 6d501c6c83912124d7c604ed83953366b93422a2dd884a65477d386e57a6abea

Contents?: true

Size: 589 Bytes

Versions: 5

Compression:

Stored size: 589 Bytes

Contents

module Rooftop
  class Taxonomy
    include Rooftop::Base
    self.api_version = 2
    self.api_namespace = "wp"
    self.api_endpoint = "taxonomies"

    primary_key "slug"

    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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rooftop-0.1.4.1 lib/rooftop/models/taxonomy.rb
rooftop-0.1.4 lib/rooftop/models/taxonomy.rb
rooftop-0.1.3 lib/rooftop/models/taxonomy.rb
rooftop-0.1.2 lib/rooftop/models/taxonomy.rb
rooftop-0.1.1 lib/rooftop/models/taxonomy.rb