Sha256: ff2223fc40e4dda1e7801f97ef6156377ad2ceaa735117f99fdb05450b585d0c

Contents?: true

Size: 811 Bytes

Versions: 12

Compression:

Stored size: 811 Bytes

Contents

module Ecoportal
  module API
    class V2
      class Register < Common::Content::DoubleModel
        passkey     :id
        passthrough :name

        class_resolver :template_class, "Ecoportal::API::V2::Template"

        def templates_by_id
          @templates_by_id or index_templates
          @templates_by_id
        end

        def [](id)
          templates_by_id[id]
        end

        def templates
          templates_by_id.values
        end

        def index_templates
          @templates_by_id   = {}
          doc["templates"].each do |template_doc|
            template = template_class.new(template_doc)
            @templates_by_id[template.id] = template
          end
        end

      end
    end
  end
end

require 'ecoportal/api/v2/template'

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
ecoportal-api-oozes-0.7.4 lib/ecoportal/api/v2/register.rb
ecoportal-api-oozes-0.7.3 lib/ecoportal/api/v2/register.rb
ecoportal-api-oozes-0.7.2 lib/ecoportal/api/v2/register.rb
ecoportal-api-oozes-0.7.1 lib/ecoportal/api/v2/register.rb
ecoportal-api-oozes-0.7.0 lib/ecoportal/api/v2/register.rb
ecoportal-api-oozes-0.6.1 lib/ecoportal/api/v2/register.rb
ecoportal-api-oozes-0.6.0 lib/ecoportal/api/v2/register.rb
ecoportal-api-oozes-0.5.9 lib/ecoportal/api/v2/register.rb
ecoportal-api-oozes-0.5.8 lib/ecoportal/api/v2/register.rb
ecoportal-api-oozes-0.5.7 lib/ecoportal/api/v2/register.rb
ecoportal-api-oozes-0.5.6 lib/ecoportal/api/v2/register.rb
ecoportal-api-oozes-0.5.5 lib/ecoportal/api/v2/register.rb