Sha256: 18bb4b846dbe958a7fdf9a1dca971dbb47c012fe80c5700dafbdf9c5dae0f404
Contents?: true
Size: 1.71 KB
Versions: 15
Compression:
Stored size: 1.71 KB
Contents
module Ecoportal module API class V2 class Page class Force < Common::Content::DoubleModel INITIAL_WEIGHT = 9999 class << self def new_doc { "id" => new_uuid, "weight" => INITIAL_WEIGHT } end end class_resolver :bindings_class, "Ecoportal::API::V2::Page::Force::Bindings" class_resolver :helper_class, "Ecoportal::API::V2::Page::Force::Helper" passkey :id passforced :patch_ver, default: 1 passthrough :name, :weight passdate :last_synced_at passthrough :custom_script passthrough :script, read_only: true embeds_many :bindings, enum_class: :bindings_class embeds_many :helpers, klass: :helper_class def ooze self._parent.ooze end # @see Ecoportal::API::V2::Page::Force::Bindings#add def bind(reference, **kargs, &block) bindings.add(reference, **kargs, &block) end # It updates `script` by using `helpers` def custom_script=(value) doc["custom_script"] = value update_script value end # It sets the `script` value by using `custom_script` and `helpers[N..1].script` def update_script doc["script"] = helpers.to_a.reverse.map(&:script).push(self.custom_script).join("\n") end end end end end end require 'ecoportal/api/v2/page/force/helper' require 'ecoportal/api/v2/page/force/binding' require 'ecoportal/api/v2/page/force/bindings'
Version data entries
15 entries across 15 versions & 1 rubygems