ecoportal-api-v2 0.8.32 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 61f3db1a50844d2f5ca194ff29939ed8daa393a6d3596e50a670ebc0f99e58db
4
- data.tar.gz: b39bd03de67e23d12a48e12fdc19de1b33d131a1c4bec1aa193bf35fcbdc1035
3
+ metadata.gz: fd6779bebb389337e0a18e355c36cbb5c2ba0ed84f31b7cdbca3bec051a30bd2
4
+ data.tar.gz: 32e9cc407394ef5ae7ef56f87650180789d229930daf5d7e65d44c33768041ca
5
5
  SHA512:
6
- metadata.gz: fba38418ad4ed3febd3859f0d4d096d75f079aa1e7abc745ca76a7deb5479de93ab5fecede2954646691e1aa17ee66348e04a8f349d2f8800f06ca36e76efa28
7
- data.tar.gz: dcfad6f62286db5b028d3ab1b29b29a0f34c04c4a8d73d2cdc01c060601d92e678d6e51f96a4ce6caa22e10d9f3bb36ec97dc8f9fef4b894c5c52ba5332e388a
6
+ metadata.gz: f2e84e20a4952e07ce7575f98a32b7cd216dbdc163fed0dcf9b9e383062e509d0702cff679b51e02b235afa0b68add386638d41eb5dc7cfcaaabfd965288530b
7
+ data.tar.gz: d0b3a2d2043a31cca656c98a812dc2e632ae565c121cc85991c211b51acafebb58206be305dbc9da1fcfaf23acc83218ddb1db952d43b76fb5fccc1bc933bde9
data/CHANGELOG.md CHANGED
@@ -1,13 +1,34 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
- ## [0.8.33] - 2022-09-xx
4
+ ## [0.9.2] - 2022-09-26
5
5
 
6
6
  ### Added
7
7
  ### Changed
8
8
  ### Fixed
9
9
 
10
10
 
11
+ ## [0.9.1] - 2022-09-26
12
+
13
+ ### Added
14
+ - `Ecoportal::API::V2::Page::Force::Helper`
15
+
16
+ ### Changed
17
+ - `Ecoportal::API::V2::Page::Force`, logic around `helpers` (remote forces)
18
+ - **breaking change**: `script` is not writable anymore. You should use `custom_script` instead.
19
+
20
+ ### Fixed
21
+
22
+
23
+ ## [0.8.33] - 2022-09-23
24
+
25
+ ### Changed
26
+ - `Ecoportal::API::Common::Content::DoubleModel#embeds_many`: added new_class name collision prevention
27
+
28
+ ### Fixed
29
+ - `Ecoportal::API::Common::ClassHelpers.new_class`: should accept `name` parameter to be a class itself
30
+
31
+
11
32
  ## [0.8.32] - 2022-09-19
12
33
 
13
34
  ### Added
@@ -72,7 +72,7 @@ module Ecoportal
72
72
  # @yieldparam child_class [Class] the new class
73
73
  # @return [Class] the new generated class
74
74
  def new_class(name = "Child#{uid}", inherits: self, namespace: inherits)
75
- name = name.to_sym.freeze
75
+ name = name.to_s.to_sym.freeze
76
76
  class_name = to_constant(name)
77
77
 
78
78
  unless target_class = resolve_class("#{namespace}::#{class_name}", exception: false)
@@ -198,7 +198,7 @@ module Ecoportal
198
198
  if enum_class
199
199
  eclass = enum_class
200
200
  elsif klass
201
- eclass = new_class(method, inherits: Common::Content::CollectionModel) do |dim_class|
201
+ eclass = new_class("#{method}::#{klass}", inherits: Common::Content::CollectionModel) do |dim_class|
202
202
  dim_class.klass = klass
203
203
  dim_class.order_matters = order_matters
204
204
  dim_class.order_key = order_key
@@ -0,0 +1,43 @@
1
+ require "base64"
2
+ module Ecoportal
3
+ module API
4
+ class V2
5
+ class Page
6
+ class Force
7
+ class Helper < Common::Content::DoubleModel
8
+ class << self
9
+ def new_doc
10
+ {
11
+ "id" => new_uuid
12
+ }
13
+ end
14
+ end
15
+
16
+ passkey :id
17
+ passforced :patch_ver, default: 1
18
+ passthrough :script
19
+ passthrough :name, :file_path, :content_b64, read_only: true
20
+
21
+ def ooze
22
+ self._parent.ooze
23
+ end
24
+
25
+ def force
26
+ self._parent._parent
27
+ end
28
+
29
+ def script=(value)
30
+ doc["content_b64"] = Base64.encode64(value)
31
+ doc["script"] = value
32
+ force.update_script
33
+ value
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+
42
+ require 'ecoportal/api/v2/page/force/binding'
43
+ require 'ecoportal/api/v2/page/force/bindings'
@@ -15,11 +15,16 @@ module Ecoportal
15
15
  end
16
16
 
17
17
  class_resolver :bindings_class, "Ecoportal::API::V2::Page::Force::Bindings"
18
+ class_resolver :helper_class, "Ecoportal::API::V2::Page::Force::Helper"
18
19
 
19
20
  passkey :id
20
21
  passforced :patch_ver, default: 1
21
- passthrough :name, :weight, :script
22
+ passthrough :name, :weight
23
+ passdate :last_synced_at
24
+ passthrough :custom_script
25
+ passthrough :script, read_only: true
22
26
  embeds_many :bindings, enum_class: :bindings_class
27
+ embeds_many :helpers, klass: :helper_class
23
28
 
24
29
  def ooze
25
30
  self._parent.ooze
@@ -29,11 +34,24 @@ module Ecoportal
29
34
  def bind(reference, **kargs, &block)
30
35
  bindings.add(reference, **kargs, &block)
31
36
  end
37
+
38
+ # It updates `script` by using `helpers`
39
+ def custom_script=(value)
40
+ doc["custom_script"] = value
41
+ update_script
42
+ value
43
+ end
44
+
45
+ # It sets the `script` value by using `custom_script` and `helpers[N..1].script`
46
+ def update_script
47
+ doc["script"] = helpers.to_a.reverse.map(&:script).push(self.custom_script).join("\n")
48
+ end
32
49
  end
33
50
  end
34
51
  end
35
52
  end
36
53
  end
37
54
 
55
+ require 'ecoportal/api/v2/page/force/helper'
38
56
  require 'ecoportal/api/v2/page/force/binding'
39
57
  require 'ecoportal/api/v2/page/force/bindings'
@@ -1,5 +1,5 @@
1
1
  module Ecoportal
2
2
  module API
3
- GEM2_VERSION = "0.8.32"
3
+ GEM2_VERSION = "0.9.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecoportal-api-v2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.32
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Segura
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-19 00:00:00.000000000 Z
11
+ date: 2022-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -222,6 +222,7 @@ files:
222
222
  - lib/ecoportal/api/v2/page/force.rb
223
223
  - lib/ecoportal/api/v2/page/force/binding.rb
224
224
  - lib/ecoportal/api/v2/page/force/bindings.rb
225
+ - lib/ecoportal/api/v2/page/force/helper.rb
225
226
  - lib/ecoportal/api/v2/page/forces.rb
226
227
  - lib/ecoportal/api/v2/page/mould_counter.rb
227
228
  - lib/ecoportal/api/v2/page/permission_flags.rb