Sha256: 69e74fed41145f28a5c5110bcc82dc577e50985a9a3dde725a2603443c846a40

Contents?: true

Size: 1.43 KB

Versions: 6

Compression:

Stored size: 1.43 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/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

6 entries across 6 versions & 2 rubygems

Version Path
ecoportal-api-v2-0.8.7 lib/ecoportal/api/v2/page.rb
ecoportal-api-v2-0.8.6 lib/ecoportal/api/v2/page.rb
ecoportal-api-v2-0.8.5 lib/ecoportal/api/v2/page.rb
ecoportal-api-v2-0.8.4 lib/ecoportal/api/v2/page.rb
ecoportal-api-oozes-0.7.5 lib/ecoportal/api/v2/page.rb
ecoportal-api-oozes-0.7.4 lib/ecoportal/api/v2/page.rb