ecoportal-api-v2 2.0.16 → 3.1.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 +4 -4
- data/CHANGELOG.md +24 -1
- data/ecoportal-api-v2.gemspec +1 -1
- data/lib/ecoportal/api/common/concerns.rb +2 -2
- data/lib/ecoportal/api/common/content/class_helpers.rb +42 -7
- data/lib/ecoportal/api/common/content/client.rb +2 -1
- data/lib/ecoportal/api/common/content/collection_model/doc/rooted_key.rb +8 -8
- data/lib/ecoportal/api/common/content/collection_model/doc.rb +2 -2
- data/lib/ecoportal/api/common/content/collection_model/doc_mutation.rb +3 -3
- data/lib/ecoportal/api/common/content/collection_model/model.rb +6 -6
- data/lib/ecoportal/api/common/content/collection_model/modifiers.rb +3 -3
- data/lib/ecoportal/api/common/content/collection_model/mutation.rb +3 -3
- data/lib/ecoportal/api/common/content/collection_model.rb +5 -5
- data/lib/ecoportal/api/common/content/double_model/attributable/nesting/cascaded_callback.rb +203 -98
- data/lib/ecoportal/api/common/content/double_model/attributable/nesting/embeddable.rb +49 -59
- data/lib/ecoportal/api/common/content/double_model/attributable/nesting/keyable.rb +102 -114
- data/lib/ecoportal/api/common/content/double_model/attributable/nesting.rb +5 -3
- data/lib/ecoportal/api/common/content/double_model/attributable.rb +5 -5
- data/lib/ecoportal/api/common/content/double_model/diffable/diff_service.rb +33 -0
- data/lib/ecoportal/api/common/content/double_model/{diffable_model.rb → diffable.rb} +12 -5
- data/lib/ecoportal/api/common/content/double_model/double_doc/linkable_doc.rb +9 -4
- data/lib/ecoportal/api/common/content/double_model/double_doc/replaceable_doc.rb +10 -2
- data/lib/ecoportal/api/common/content/double_model/double_doc/reset_consolidate.rb +1 -1
- data/lib/ecoportal/api/common/content/double_model/double_doc/rooted_key.rb +10 -3
- data/lib/ecoportal/api/common/content/double_model/double_doc.rb +5 -5
- data/lib/ecoportal/api/common/content/double_model/hash_helpers.rb +23 -4
- data/lib/ecoportal/api/common/content/double_model/modifiers.rb +2 -2
- data/lib/ecoportal/api/common/content/double_model.rb +9 -9
- data/lib/ecoportal/api/common/content/hash_diff_patch.rb +21 -7
- data/lib/ecoportal/api/common/content/model_helpers.rb +1 -1
- data/lib/ecoportal/api/common/content.rb +11 -11
- data/lib/ecoportal/api/common.v2.rb +2 -2
- data/lib/ecoportal/api/v2/page/component/action.rb +13 -11
- data/lib/ecoportal/api/v2/page/component/action_field.rb +14 -12
- data/lib/ecoportal/api/v2/page/component/actions_field.rb +2 -1
- data/lib/ecoportal/api/v2/page/component/chart_field/config.rb +1 -2
- data/lib/ecoportal/api/v2/page/component/chart_field.rb +48 -44
- data/lib/ecoportal/api/v2/page/component/chart_fr_field.rb +0 -1
- data/lib/ecoportal/api/v2/page/component/checklist_field.rb +9 -6
- data/lib/ecoportal/api/v2/page/component/checklist_item.rb +2 -3
- data/lib/ecoportal/api/v2/page/component/contractor_entities_field.rb +18 -17
- data/lib/ecoportal/api/v2/page/component/date_field.rb +19 -18
- data/lib/ecoportal/api/v2/page/component/file.rb +3 -3
- data/lib/ecoportal/api/v2/page/component/files_field.rb +9 -6
- data/lib/ecoportal/api/v2/page/component/gauge_field.rb +3 -2
- data/lib/ecoportal/api/v2/page/component/gauge_stop.rb +26 -26
- data/lib/ecoportal/api/v2/page/component/geo_field.rb +2 -2
- data/lib/ecoportal/api/v2/page/component/image.rb +6 -5
- data/lib/ecoportal/api/v2/page/component/images_field.rb +21 -20
- data/lib/ecoportal/api/v2/page/component/law.rb +3 -4
- data/lib/ecoportal/api/v2/page/component/law_field.rb +2 -2
- data/lib/ecoportal/api/v2/page/component/number_field.rb +1 -1
- data/lib/ecoportal/api/v2/page/component/people_field.rb +19 -19
- data/lib/ecoportal/api/v2/page/component/plain_text_field.rb +6 -7
- data/lib/ecoportal/api/v2/page/component/reference_field.rb +1 -1
- data/lib/ecoportal/api/v2/page/component/rich_text_field.rb +3 -3
- data/lib/ecoportal/api/v2/page/component/selection_field.rb +32 -35
- data/lib/ecoportal/api/v2/page/component/selection_options.rb +12 -7
- data/lib/ecoportal/api/v2/page/component/tag_field.rb +5 -4
- data/lib/ecoportal/api/v2/page/component.rb +21 -21
- data/lib/ecoportal/api/v2/page/force/bindings.rb +49 -39
- data/lib/ecoportal/api/v2/page/force.rb +9 -9
- data/lib/ecoportal/api/v2/page/forces.rb +1 -1
- data/lib/ecoportal/api/v2/page/permit.rb +3 -3
- data/lib/ecoportal/api/v2/page/sections.rb +19 -14
- data/lib/ecoportal/api/v2/page/stage.rb +27 -20
- data/lib/ecoportal/api/v2/page/stages.rb +1 -1
- data/lib/ecoportal/api/v2/page.rb +13 -12
- data/lib/ecoportal/api/v2/pages/page_stage.rb +2 -2
- data/lib/ecoportal/api/v2/pages.rb +2 -2
- data/lib/ecoportal/api/v2/registers/page_result.rb +3 -3
- data/lib/ecoportal/api/v2/registers/register.rb +4 -5
- data/lib/ecoportal/api/v2/registers/search_results.rb +1 -1
- data/lib/ecoportal/api/v2/registers/stages_result.rb +1 -1
- data/lib/ecoportal/api/v2/registers.rb +6 -6
- data/lib/ecoportal/api/v2/s3/files/batch_upload.rb +1 -0
- data/lib/ecoportal/api/v2/s3/files.rb +3 -3
- data/lib/ecoportal/api/v2.rb +4 -4
- data/lib/ecoportal/api/v2_version.rb +1 -1
- data/lib/ecoportal/api-v2.rb +4 -5
- metadata +6 -5
@@ -11,14 +11,14 @@ module Ecoportal
|
|
11
11
|
passthrough :status
|
12
12
|
passboolean :complete, :lock_after_completion
|
13
13
|
|
14
|
-
embeds_many :permits, klass:
|
14
|
+
embeds_many :permits, klass: 'Ecoportal::API::V2::Page::Permit'
|
15
15
|
passboolean :disable_direct_permissions
|
16
16
|
passboolean :creator_enabled, :creator_editable
|
17
|
-
embeds_one :creator_flags, klass:
|
17
|
+
embeds_one :creator_flags, klass: 'Ecoportal::API::V2::Page::PermissionFlags'
|
18
18
|
passthrough :can
|
19
19
|
|
20
20
|
def ooze
|
21
|
-
|
21
|
+
_parent.ooze
|
22
22
|
end
|
23
23
|
|
24
24
|
def components
|
@@ -31,7 +31,8 @@ module Ecoportal
|
|
31
31
|
def sections
|
32
32
|
sec_ids = section_ids.to_a
|
33
33
|
root.sections.values_at(*sec_ids).select.with_index do |sec, i|
|
34
|
-
puts "Warning: section #{id} points to missing section #{sec_ids[i]}"
|
34
|
+
puts "Warning: section #{id} points to missing section #{sec_ids[i]}" unless sec
|
35
|
+
|
35
36
|
sec && (!block_given? || yield(sec))
|
36
37
|
end.sort_by.with_index {|sec, index| [sec.weight, index]}
|
37
38
|
end
|
@@ -45,9 +46,9 @@ module Ecoportal
|
|
45
46
|
when Ecoportal::API::V2::Page::Section
|
46
47
|
section?(sec_or_id.id)
|
47
48
|
when String
|
48
|
-
|
49
|
+
section_ids.include?(sec_or_id)
|
49
50
|
else
|
50
|
-
raise ArgumentError
|
51
|
+
raise ArgumentError, "sec_or_id must be either a Section or a String. Given: #{sec_or_id.class}"
|
51
52
|
end
|
52
53
|
end
|
53
54
|
|
@@ -59,15 +60,18 @@ module Ecoportal
|
|
59
60
|
secs.each do |sec|
|
60
61
|
unless sec.is_a?(Ecoportal::API::V2::Page::Section)
|
61
62
|
msg = "Expected Ecoportal::API::V2::Page::Section. Given: #{sec.class}"
|
62
|
-
raise ArgumentError
|
63
|
+
raise ArgumentError, msg
|
63
64
|
end
|
65
|
+
|
64
66
|
unless ooze.sections.include?(sec)
|
65
67
|
msg = "The section '#{sec.heading}' (#{sec.id}) is not present in ooze.sections.\n"
|
66
|
-
msg
|
68
|
+
msg << 'Review your script (i.e. @var where you store previous ooze runs).'
|
67
69
|
raise msg
|
68
70
|
end
|
71
|
+
|
69
72
|
section_ids.insert_one(sec.id)
|
70
73
|
end
|
74
|
+
|
71
75
|
self
|
72
76
|
end
|
73
77
|
|
@@ -78,20 +82,23 @@ module Ecoportal
|
|
78
82
|
# or the actual Hash model with String keys person `user_id`, `user_name`, `user_email`
|
79
83
|
# @yieldparam section [Ecoportal::API::V2::Page::Permit] the created permit
|
80
84
|
def add_permit(value, &block)
|
81
|
-
props = [
|
82
|
-
hash_props =
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
85
|
+
props = %w[user_id user_name user_email]
|
86
|
+
hash_props =
|
87
|
+
case value
|
88
|
+
when Ecoportal::API::Internal::Person
|
89
|
+
return false unless account = value.account
|
90
|
+
props.zip([account.user_id, value.name, value.email]).to_h
|
91
|
+
when Hash
|
92
|
+
value.slice(*props)
|
93
|
+
else
|
94
|
+
raise ArgumentError, "Expected Ecoportal::API::Internal::Person or Hash. Given: #{value.class}"
|
95
|
+
end
|
96
|
+
|
91
97
|
hash_doc = Ecoportal::API::V2::Page::Permit.new_doc.merge(hash_props)
|
92
|
-
exists =
|
98
|
+
exists = permits.any? {|permit| permit.user_id == hash_doc['user_id']}
|
93
99
|
return false if exists
|
94
|
-
|
100
|
+
|
101
|
+
permits.upsert!(hash_doc, &block)
|
95
102
|
end
|
96
103
|
end
|
97
104
|
end
|
@@ -3,7 +3,7 @@ module Ecoportal
|
|
3
3
|
class V2
|
4
4
|
class Page
|
5
5
|
class Stages < Ecoportal::API::Common::Content::CollectionModel
|
6
|
-
class_resolver :stage_class,
|
6
|
+
class_resolver :stage_class, 'Ecoportal::API::V2::Page::Stage'
|
7
7
|
|
8
8
|
self.klass = :stage_class
|
9
9
|
self.order_key = :ordering
|
@@ -34,7 +34,8 @@ module Ecoportal
|
|
34
34
|
embeds_many :forces, enum_class: :forces_class
|
35
35
|
|
36
36
|
def initialize(doc = [], parent: self, key: nil)
|
37
|
-
|
37
|
+
doc = _doc_bug_fix(doc)
|
38
|
+
super
|
38
39
|
end
|
39
40
|
|
40
41
|
def ooze
|
@@ -105,14 +106,14 @@ module Ecoportal
|
|
105
106
|
end
|
106
107
|
end
|
107
108
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
109
|
+
require_relative 'page/mould_counter'
|
110
|
+
require_relative 'page/permission_flags'
|
111
|
+
require_relative 'page/permit'
|
112
|
+
require_relative 'page/component'
|
113
|
+
require_relative 'page/components'
|
114
|
+
require_relative 'page/section'
|
115
|
+
require_relative 'page/sections'
|
116
|
+
require_relative 'page/stage'
|
117
|
+
require_relative 'page/stages'
|
118
|
+
require_relative 'page/force'
|
119
|
+
require_relative 'page/forces'
|
@@ -11,10 +11,10 @@ module Ecoportal
|
|
11
11
|
passarray :tags, order_matters: false
|
12
12
|
passthrough :mould_counter
|
13
13
|
|
14
|
-
class_resolver :stages_class,
|
14
|
+
class_resolver :stages_class, 'Ecoportal::API::V2::Registers::StagesResult'
|
15
15
|
embeds_many :stages, enum_class: :stages_class, read_only: true
|
16
16
|
|
17
|
-
class_resolver :mem_droplet,
|
17
|
+
class_resolver :mem_droplet, 'Ecoportal::API::V2::Registers::PageResult::MembraneDroplet'
|
18
18
|
embeds_many :membranes, klass: :mem_droplet, read_only: true
|
19
19
|
end
|
20
20
|
end
|
@@ -22,4 +22,4 @@ module Ecoportal
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
|
25
|
+
require_relative 'page_result/membrane_droplet'
|
@@ -6,7 +6,7 @@ module Ecoportal
|
|
6
6
|
passkey :id
|
7
7
|
passthrough :name
|
8
8
|
|
9
|
-
class_resolver :template_class,
|
9
|
+
class_resolver :template_class, 'Ecoportal::API::V2::Registers::Template'
|
10
10
|
|
11
11
|
def templates_by_id
|
12
12
|
@templates_by_id or index_templates
|
@@ -22,15 +22,14 @@ module Ecoportal
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def index_templates
|
25
|
-
@templates_by_id
|
26
|
-
|
25
|
+
@templates_by_id = {}
|
26
|
+
|
27
|
+
doc['templates'].each do |template_doc|
|
27
28
|
template = template_class.new(template_doc)
|
28
29
|
@templates_by_id[template.id] = template
|
29
30
|
end
|
30
31
|
end
|
31
|
-
|
32
32
|
end
|
33
|
-
|
34
33
|
end
|
35
34
|
end
|
36
35
|
end
|
@@ -5,7 +5,7 @@ module Ecoportal
|
|
5
5
|
class SearchResults < Ecoportal::API::Common::Content::DoubleModel
|
6
6
|
passthrough :total, :total_before_filtering
|
7
7
|
passarray :tags, order_matters: false
|
8
|
-
embeds_many :results, klass:
|
8
|
+
embeds_many :results, klass: 'Ecoportal::API::V2::Registers::PageResult'
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
@@ -3,7 +3,7 @@ module Ecoportal
|
|
3
3
|
class V2
|
4
4
|
class Registers
|
5
5
|
class StagesResult < V2::Page::Stages
|
6
|
-
class_resolver :stage_class,
|
6
|
+
class_resolver :stage_class, 'Ecoportal::API::V2::Registers::StageResult'
|
7
7
|
|
8
8
|
self.klass = :stage_class
|
9
9
|
end
|
@@ -143,9 +143,9 @@ module Ecoportal
|
|
143
143
|
end
|
144
144
|
end
|
145
145
|
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
146
|
+
require_relative 'registers/template'
|
147
|
+
require_relative 'registers/register'
|
148
|
+
require_relative 'registers/stage_result'
|
149
|
+
require_relative 'registers/stages_result'
|
150
|
+
require_relative 'registers/page_result'
|
151
|
+
require_relative 'registers/search_results'
|
@@ -128,6 +128,6 @@ module Ecoportal
|
|
128
128
|
end
|
129
129
|
end
|
130
130
|
|
131
|
-
|
132
|
-
|
133
|
-
|
131
|
+
require_relative 'files/poll'
|
132
|
+
require_relative 'files/poll_status'
|
133
|
+
require_relative 'files/batch_upload'
|
data/lib/ecoportal/api/v2.rb
CHANGED
@@ -98,7 +98,7 @@ module Ecoportal
|
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
101
|
+
require_relative 'v2/people'
|
102
|
+
require_relative 'v2/pages'
|
103
|
+
require_relative 'v2/registers'
|
104
|
+
require_relative 'v2/s3'
|
data/lib/ecoportal/api-v2.rb
CHANGED
@@ -1,11 +1,10 @@
|
|
1
|
-
require
|
2
|
-
|
1
|
+
require 'ecoportal/api'
|
2
|
+
require_relative 'api/v2_version'
|
3
3
|
|
4
4
|
module Ecoportal
|
5
5
|
module API
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
require 'ecoportal/api/v2'
|
9
|
+
require_relative 'api/common.v2'
|
10
|
+
require_relative 'api/v2'
|
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:
|
4
|
+
version: 3.1.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: 2025-
|
11
|
+
date: 2025-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -135,7 +135,7 @@ dependencies:
|
|
135
135
|
version: '0.10'
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 0.10.
|
138
|
+
version: 0.10.10
|
139
139
|
type: :runtime
|
140
140
|
prerelease: false
|
141
141
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -145,7 +145,7 @@ dependencies:
|
|
145
145
|
version: '0.10'
|
146
146
|
- - ">="
|
147
147
|
- !ruby/object:Gem::Version
|
148
|
-
version: 0.10.
|
148
|
+
version: 0.10.10
|
149
149
|
- !ruby/object:Gem::Dependency
|
150
150
|
name: mime-types
|
151
151
|
requirement: !ruby/object:Gem::Requirement
|
@@ -231,7 +231,8 @@ files:
|
|
231
231
|
- lib/ecoportal/api/common/content/double_model/attributable/passthrough.rb
|
232
232
|
- lib/ecoportal/api/common/content/double_model/attributable/simple.rb
|
233
233
|
- lib/ecoportal/api/common/content/double_model/base.rb
|
234
|
-
- lib/ecoportal/api/common/content/double_model/
|
234
|
+
- lib/ecoportal/api/common/content/double_model/diffable.rb
|
235
|
+
- lib/ecoportal/api/common/content/double_model/diffable/diff_service.rb
|
235
236
|
- lib/ecoportal/api/common/content/double_model/double_doc.rb
|
236
237
|
- lib/ecoportal/api/common/content/double_model/double_doc/base.rb
|
237
238
|
- lib/ecoportal/api/common/content/double_model/double_doc/linkable_doc.rb
|