ecoportal-api-v2 1.1.6 → 1.1.8

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.
@@ -8,8 +8,8 @@ module Ecoportal
8
8
  class << self
9
9
  def new_doc
10
10
  {
11
- "id" => new_uuid,
12
- "weight" => INITIAL_WEIGHT
11
+ "id" => new_uuid,
12
+ "weight" => INITIAL_WEIGHT
13
13
  }
14
14
  end
15
15
  end
@@ -23,11 +23,11 @@ module Ecoportal
23
23
  passdate :last_synced_at
24
24
  passthrough :custom_script
25
25
  passthrough :script, read_only: true
26
- embeds_many :bindings, enum_class: :bindings_class
27
- embeds_many :helpers, klass: :helper_class
26
+ embeds_many :bindings, enum_class: :bindings_class
27
+ embeds_many :helpers, klass: :helper_class
28
28
 
29
29
  def ooze
30
- self._parent.ooze
30
+ _parent.ooze
31
31
  end
32
32
 
33
33
  # @see Ecoportal::API::V2::Page::Force::Bindings#add
@@ -39,7 +39,6 @@ module Ecoportal
39
39
  def custom_script=(value)
40
40
  doc["custom_script"] = value
41
41
  update_script
42
- value
43
42
  end
44
43
 
45
44
  # It sets the `script` value by using `custom_script` and `helpers[N..1].script`
@@ -2,16 +2,16 @@ module Ecoportal
2
2
  module API
3
3
  class V2
4
4
  class Page < Common::Content::DoubleModel
5
- ALLOWED_KEYS = [
6
- "id", "patch_ver", "name", "template_id",
7
- "base_tags", "tags",
8
- "time_zone", "created_at", "updated_at",
9
- "components", "sections", "stages",
10
- "permits", "mould_counter", "mould",
11
- "state", "task_priority",
12
- "votes_enabled", "upvotes", "downvotes",
13
- "forces", "force_errors", "subtags"
14
- ]
5
+ ALLOWED_KEYS = %w[
6
+ id patch_ver name template_id
7
+ base_tags tags
8
+ time_zone created_at updated_at
9
+ components sections stages
10
+ permits mould_counter mould
11
+ state task_priority
12
+ votes_enabled upvotes downvotes
13
+ forces force_errors subtags
14
+ ].freeze
15
15
 
16
16
  passkey :id
17
17
  passforced :patch_ver, default: 1
@@ -41,7 +41,7 @@ module Ecoportal
41
41
 
42
42
  def as_update
43
43
  super.tap do |hash|
44
- unless !hash
44
+ if hash
45
45
  hash["data"].select! do |key, value|
46
46
  ALLOWED_KEYS.include?(key)
47
47
  end
@@ -51,14 +51,14 @@ module Ecoportal
51
51
  end
52
52
 
53
53
  def stages?
54
- self.doc["stages"] && (self.stages.count > 0)
54
+ doc["stages"] && stages.count.positive?
55
55
  end
56
56
 
57
57
  # @return [String] with feedback, if for this page instance, there are any of:
58
58
  # 1. components multi-section (fields belonging to more than one section)
59
59
  def validate
60
60
  msg = ""
61
- if (multi = components.multi_section).length > 0
61
+ if (multi = components.multi_section).length.positive?
62
62
  msg += "There are fields attached to more than one section:\n • "
63
63
  msg += multi.map do |fld|
64
64
  fld.label
@@ -96,7 +96,6 @@ module Ecoportal
96
96
  end
97
97
  end
98
98
  end
99
-
100
99
  end
101
100
  end
102
101
  end
@@ -1,5 +1,5 @@
1
1
  module Ecoportal
2
2
  module API
3
- GEM2_VERSION = "1.1.6"
3
+ GEM2_VERSION = "1.1.8".freeze
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: 1.1.6
4
+ version: 1.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Segura
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-02-29 00:00:00.000000000 Z
11
+ date: 2024-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -167,6 +167,8 @@ files:
167
167
  - ecoportal-api-v2.gemspec
168
168
  - lib/ecoportal/api-v2.rb
169
169
  - lib/ecoportal/api/common.v2.rb
170
+ - lib/ecoportal/api/common/concerns.rb
171
+ - lib/ecoportal/api/common/concerns/benchmarkable.rb
170
172
  - lib/ecoportal/api/common/content.rb
171
173
  - lib/ecoportal/api/common/content/array_model.rb
172
174
  - lib/ecoportal/api/common/content/class_helpers.rb