Sha256: c10c9993bd16b4f213eda1389d1c16ee2128b212ed1a5a5836f20112fa128b5c

Contents?: true

Size: 1.52 KB

Versions: 1

Compression:

Stored size: 1.52 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_many :components, enum_class: :components_class
        embeds_many :sections,   enum_class: :sections_class
        embeds_many :stages,     enum_class: :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/permission_flags'
require 'ecoportal/api/v2/page/permit'
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

1 entries across 1 versions & 1 rubygems

Version Path
ecoportal-api-v2-0.8.9 lib/ecoportal/api/v2/page.rb