Sha256: d8be90d3b99a8ab44fc8ce543aa40e2602740c41a02341df4c6c871570d94884

Contents?: true

Size: 1.46 KB

Versions: 10

Compression:

Stored size: 1.46 KB

Contents

module Ecoportal
  module API
    class V2
      class Page < Common::Content::DoubleModel
        ALLOWED_KEYS  = %w[id patch_ver name template_id base_tags tags time_zone created_at updated_at can components sections stages]
        passkey     :id
        passthrough :patch_ver
        passthrough :name, :template_id
        passarray   :base_tags, :tags, order_matters: false
        passthrough :time_zone
        passdate    :created_at, :updated_at, read_only: true
        passthrough :can

        class_resolver :components_class, "Ecoportal::API::V2::Page::Components"
        class_resolver :sections_class,   "Ecoportal::API::V2::Page::Sections"
        class_resolver :stages_class,     "Ecoportal::API::V2::Page::Stages"

        embeds_one :components, multiple: true, klass: :components_class
        embeds_one :sections,   multiple: true, klass: :sections_class
        embeds_one :stages,     multiple: true, klass: :stages_class

        def as_update
          super.tap do |hash|
            unless !hash
              hash["data"].select! do |key, value|
                ALLOWED_KEYS.include?(key)
              end
            end
          end
        end

      end
    end
  end
end

require 'ecoportal/api/v2/page/component'
require 'ecoportal/api/v2/page/components'
require 'ecoportal/api/v2/page/section'
require 'ecoportal/api/v2/page/sections'
require 'ecoportal/api/v2/page/stage'
require 'ecoportal/api/v2/page/stages'

Version data entries

10 entries across 10 versions & 1 rubygems

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