ecoportal-api-v2 0.8.18 → 0.8.19
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 +14 -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 +1 -1
- data/lib/ecoportal/api/v2/page.rb +14 -0
- data/lib/ecoportal/api/v2/pages/page_stage.rb +9 -23
- data/lib/ecoportal/api/v2_version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11e7f2b8bb7544cb9d99ad0660b3a52ec388725f2fe76018f3b0bc2f8e122c04
|
4
|
+
data.tar.gz: 31e3858fa5c4d3c632f5d3e04a51a3bc75b64cd719f646f22b5a6e24e42a1a95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b4eda0998b1f122c2df6480ba283200bd9df1c985fa761f514231e6f6dddd89beff13d2c4bfa52e7e3d8ca39644efef57508caa369eca2b2b13478ac1faea5f
|
7
|
+
data.tar.gz: 31ab53da2363812cb340c41233eae35efe2c3e4024f77d670c6ffd2fb33f1697eabfacafc6bb85f895e4ef8faeed7b8d65858905fb967330bd181c4061198442
|
data/CHANGELOG.md
CHANGED
@@ -1,11 +1,24 @@
|
|
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.19] - 2021-09-29
|
5
5
|
|
6
6
|
### Added
|
7
7
|
### Changed
|
8
|
+
- Moved validation of components multi-section from `PageStage` to `Page`
|
9
|
+
- Removed validation from `PageStage#as_update`
|
10
|
+
- This means that the validation will not run natively, but in the client lib
|
11
|
+
|
12
|
+
### Fixed
|
13
|
+
- `Ecoportal::V2::Page::Stage#section?` fixed typo
|
14
|
+
- `Ecoportal::V2::Page::Stage`
|
15
|
+
- `#attached?` added missing code
|
16
|
+
- `#component?` fixed typo
|
17
|
+
|
18
|
+
## [0.8.18] - 2021-09-29
|
19
|
+
|
8
20
|
### Fixed
|
21
|
+
- typo in `PageStage#validate`
|
9
22
|
|
10
23
|
## [0.8.17] - 2021-09-29
|
11
24
|
|
@@ -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)
|
@@ -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)
|
@@ -21,38 +21,24 @@ module Ecoportal
|
|
21
21
|
stages[stage_id]
|
22
22
|
end
|
23
23
|
end
|
24
|
-
|
25
|
-
# @
|
24
|
+
|
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
43
|
"'#{sec.heading}' (#{sec.id})"
|
58
44
|
end.join("\n • ") + "\n"
|