ecoportal-api-v2 0.8.16 → 0.8.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +28 -1
- data/ecoportal-api-v2.gemspec +1 -1
- data/lib/ecoportal/api/v2/page/component.rb +1 -1
- data/lib/ecoportal/api/v2/page/section.rb +2 -2
- data/lib/ecoportal/api/v2/page/stage.rb +2 -2
- data/lib/ecoportal/api/v2/page.rb +14 -0
- data/lib/ecoportal/api/v2/pages/page_stage.rb +10 -24
- data/lib/ecoportal/api/v2_version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dcd685a294969e210f94f8b8728fec32a94372d349064e14f9a59e24429b7753
|
4
|
+
data.tar.gz: d1c8b4ddf1bcd9b3ac2203c6f1bb293aafcfc6de1d58dde79c7b425c87fe444b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 145593ad0fe8adf038c9565bafdeee1497e13ed165c45f8a40572463ff9fffb2bcb3eec8834595eab7b89efc6274ca9c1352ff7dd043ec6c632bdff8a01a2793
|
7
|
+
data.tar.gz: 7b8bbb9a4ef83eb033005f5898254f4d67d1fd5e095453f111a4fe350e9ff30236bf0effc4a79c36edf72519a305f1f9596a5ac61dc99a0bdc06a2b5f74b7e1b
|
data/CHANGELOG.md
CHANGED
@@ -1,12 +1,39 @@
|
|
1
1
|
# Change Log
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
-
## [0.8.
|
4
|
+
## [0.8.20] - 2021-10-xx
|
5
5
|
|
6
6
|
### Added
|
7
7
|
### Changed
|
8
|
+
- `Ecoportal::API::V2::Pages::PageStage#permits` removed
|
9
|
+
- The reason is that it should be changed using the `Stage#permits` instead
|
10
|
+
- Upgraded `ecoportal-api` gem dependency
|
11
|
+
|
8
12
|
### Fixed
|
13
|
+
- `Ecoportal::API::V2::Page::Stage#sections` typo
|
9
14
|
|
15
|
+
## [0.8.19] - 2021-09-29
|
16
|
+
|
17
|
+
### Changed
|
18
|
+
- Moved validation of components multi-section from `PageStage` to `Page`
|
19
|
+
- Removed validation from `PageStage#as_update`
|
20
|
+
- This means that the validation will not run natively, but in the client lib
|
21
|
+
|
22
|
+
### Fixed
|
23
|
+
- `Ecoportal::V2::Page::Stage#section?` fixed typo
|
24
|
+
- `Ecoportal::V2::Page::Stage`
|
25
|
+
- `#attached?` added missing code
|
26
|
+
- `#component?` fixed typo
|
27
|
+
|
28
|
+
## [0.8.18] - 2021-09-29
|
29
|
+
|
30
|
+
### Fixed
|
31
|
+
- typo in `PageStage#validate`
|
32
|
+
|
33
|
+
## [0.8.17] - 2021-09-29
|
34
|
+
|
35
|
+
### Fixed
|
36
|
+
- Typo in `Section#attached?`
|
10
37
|
|
11
38
|
## [0.8.15] - 2021-09-29
|
12
39
|
|
data/ecoportal-api-v2.gemspec
CHANGED
@@ -29,5 +29,5 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_development_dependency "redcarpet", ">= 3.5.1", "< 3.6"
|
30
30
|
spec.add_development_dependency "pry" , ">= 0.14"
|
31
31
|
|
32
|
-
spec.add_dependency 'ecoportal-api', '>= 0.8.
|
32
|
+
spec.add_dependency 'ecoportal-api', '>= 0.8.4', '< 0.9'
|
33
33
|
end
|
@@ -110,7 +110,7 @@ module Ecoportal
|
|
110
110
|
# Looks up the section that this component belongs to.
|
111
111
|
# @return [Ecoportal::API::V2::Page::Section, nil] the section where this field is attached to.
|
112
112
|
def section
|
113
|
-
|
113
|
+
ooze.sections.find {|sec| sec.component?(id)}
|
114
114
|
end
|
115
115
|
|
116
116
|
# @return [Boolean] whether or not this field is attached to any section.
|
@@ -45,7 +45,7 @@ module Ecoportal
|
|
45
45
|
|
46
46
|
# @return [Boolean] whether or not the section appears in an ooze instance
|
47
47
|
def attached?
|
48
|
-
!ooze.stages? || stages.any?
|
48
|
+
!ooze.stages? || stages.any? {|stg| stg.section?(self)}
|
49
49
|
end
|
50
50
|
|
51
51
|
# @return [Boolean] whether or not this section is a split section
|
@@ -67,7 +67,7 @@ module Ecoportal
|
|
67
67
|
when Ecoportal::API::V2::Page::Component
|
68
68
|
component?(com_or_id.id)
|
69
69
|
when String
|
70
|
-
all_component_ids.include?(
|
70
|
+
all_component_ids.include?(com_or_id)
|
71
71
|
else
|
72
72
|
msg = "Missuse: com_or_id should be a Component or a String. Given: #{com_or_id.class}"
|
73
73
|
raise ArgumentError.new(msg)
|
@@ -28,7 +28,7 @@ module Ecoportal
|
|
28
28
|
sec_ids = section_ids.to_a
|
29
29
|
root.sections.values_at(*sec_ids).select.with_index do |sec, i|
|
30
30
|
puts "Warning: section #{id} points to missing section #{sec_ids[i]}" if !sec
|
31
|
-
|
31
|
+
sec && (!block_given? || yield(sec))
|
32
32
|
end.sort_by.with_index {|sec, index| [sec.weight, index]}
|
33
33
|
end
|
34
34
|
|
@@ -41,7 +41,7 @@ module Ecoportal
|
|
41
41
|
when Ecoportal::API::V2::Page::Section
|
42
42
|
section?(sec_or_id.id)
|
43
43
|
when String
|
44
|
-
self.section_ids.include?(
|
44
|
+
self.section_ids.include?(sec_or_id)
|
45
45
|
else
|
46
46
|
raise ArgumentError.new("sec_or_id must be either a Section or a String. Given: #{sec_or_id.class}")
|
47
47
|
end
|
@@ -54,6 +54,20 @@ module Ecoportal
|
|
54
54
|
self.stages.count > 0
|
55
55
|
end
|
56
56
|
|
57
|
+
# @return [String] with feedback, if for this page instance, there are any of:
|
58
|
+
# 1. components multi-section (fields belonging to more than one section)
|
59
|
+
def validate
|
60
|
+
msg = ""
|
61
|
+
if (multi = components.multi_section).length > 0
|
62
|
+
msg += "There are fields attached to more than one section:\n • "
|
63
|
+
msg += multi.map do |fld|
|
64
|
+
fld.label
|
65
|
+
end.join("\n • ") + "\n"
|
66
|
+
end
|
67
|
+
|
68
|
+
msg.empty?? true : msg
|
69
|
+
end
|
70
|
+
|
57
71
|
private
|
58
72
|
|
59
73
|
def _doc_bug_fix(hash)
|
@@ -7,7 +7,7 @@ module Ecoportal
|
|
7
7
|
passthrough :task_priority, :state, :status
|
8
8
|
passthrough :votes_enabled, :upvotes, :downvotes
|
9
9
|
|
10
|
-
embeds_many :permits, klass: "Ecoportal::API::V2::Page::Permit"
|
10
|
+
#embeds_many :permits, klass: "Ecoportal::API::V2::Page::Permit"
|
11
11
|
passarray :force_errors, :subtags, order_matters: false
|
12
12
|
|
13
13
|
# @return [String] `id` of the stage we got the data of.
|
@@ -22,39 +22,25 @@ module Ecoportal
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
# @
|
25
|
+
# @return [String] with feedback, if for this page instance, there are any of:
|
26
26
|
# 1. orphaned components (fields not belonging to any section)
|
27
|
-
# 2.
|
28
|
-
# 3. orphaned sections (sections not belonging to any stage)
|
29
|
-
def as_update(*args, **kargs)
|
30
|
-
validate.tap do |validation|
|
31
|
-
raise validation if validation.is_a?(String)
|
32
|
-
end
|
33
|
-
super(*args, **kargs)
|
34
|
-
end
|
35
|
-
|
36
|
-
private
|
37
|
-
|
27
|
+
# 2. orphaned sections (sections not belonging to any stage)
|
38
28
|
def validate
|
39
|
-
msg
|
40
|
-
|
41
|
-
msg += "There are fields not attached to any sections:"
|
42
|
-
msg += orphans.map do |fld|
|
43
|
-
fld.label
|
44
|
-
end.join("\n • ") + "\n"
|
45
|
-
end
|
29
|
+
msg = super
|
30
|
+
msg = "" unless msg.is_a?(String)
|
46
31
|
|
47
|
-
|
48
|
-
|
32
|
+
orphans = components.unattached.select {|comp| comp.global_binding.to_s.strip.empty?}
|
33
|
+
if orphans.length > 0
|
34
|
+
msg += "There are fields not attached to any sections:\n • "
|
49
35
|
msg += orphans.map do |fld|
|
50
36
|
fld.label
|
51
37
|
end.join("\n • ") + "\n"
|
52
38
|
end
|
53
39
|
|
54
40
|
if (orphans = sections.unattached).length > 0
|
55
|
-
msg += "There are sections not attached to any stage
|
41
|
+
msg += "There are sections not attached to any stage:\n • "
|
56
42
|
msg += orphans.map do |sec|
|
57
|
-
"'#{sec.
|
43
|
+
"'#{sec.heading}' (#{sec.id})"
|
58
44
|
end.join("\n • ") + "\n"
|
59
45
|
end
|
60
46
|
msg.empty?? true : msg
|
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.
|
4
|
+
version: 0.8.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oscar Segura
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -130,7 +130,7 @@ dependencies:
|
|
130
130
|
requirements:
|
131
131
|
- - ">="
|
132
132
|
- !ruby/object:Gem::Version
|
133
|
-
version: 0.8.
|
133
|
+
version: 0.8.4
|
134
134
|
- - "<"
|
135
135
|
- !ruby/object:Gem::Version
|
136
136
|
version: '0.9'
|
@@ -140,7 +140,7 @@ dependencies:
|
|
140
140
|
requirements:
|
141
141
|
- - ">="
|
142
142
|
- !ruby/object:Gem::Version
|
143
|
-
version: 0.8.
|
143
|
+
version: 0.8.4
|
144
144
|
- - "<"
|
145
145
|
- !ruby/object:Gem::Version
|
146
146
|
version: '0.9'
|