ecoportal-api-v2 0.8.23 → 0.8.26
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 +23 -2
- data/lib/ecoportal/api/common/content/hash_diff_patch.rb +1 -0
- data/lib/ecoportal/api/v2/page/component/reference_field.rb +8 -0
- data/lib/ecoportal/api/v2/page/permit.rb +10 -1
- data/lib/ecoportal/api/v2/page/stage.rb +23 -0
- data/lib/ecoportal/api/v2/page.rb +1 -1
- data/lib/ecoportal/api/v2/registers.rb +4 -3
- data/lib/ecoportal/api/v2_version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4693a8a82dab15ddfd0722b1b987efb80ddc7ef9d748e76b7ccff87c0317133
|
4
|
+
data.tar.gz: 999fbaa368b677cdab96889fb34c38fe0c71c4235c000d82e6e38fedd0cf7d10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76b33ecae1e147b8e1c1f1dffb118d7533eee71b4e9acc7a5e6609947c7880c4d6f2e3ffc32aac8c5df4af3133573103148861335bfe03a6e85ecf87af5b9e60
|
7
|
+
data.tar.gz: bcd91f124438cfd8aad7b181ea1f62744c8b37d92053e394a5b681a18338f19254b0d7ca5b59e1d50fc16357b138985c0aa2a67a4a57930952f775b9fbcc4248
|
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.
|
4
|
+
## [0.8.26] - 2022-02-xx
|
5
5
|
|
6
6
|
### Added
|
7
|
-
|
7
|
+
`Ecoportal::API::V2::Page::Stage#add_permit`
|
8
|
+
`Ecoportal::API::V2::Page::Permit.new_doc`
|
9
|
+
|
10
|
+
### Changed
|
11
|
+
### Fixed
|
12
|
+
|
13
|
+
## [0.8.25] - 2022-02-04
|
14
|
+
|
15
|
+
### Added
|
16
|
+
- `Ecoportal::API::V2::Page::Component::ReferenceField#add` to add new references
|
8
17
|
|
9
18
|
### Changed
|
19
|
+
- `Ecoportal::API::Common::Content::HashDiffPatch#patch_data`
|
20
|
+
- Added support for model objects with no `patch_ver` (so diffs are calculated as well)
|
21
|
+
|
22
|
+
## [0.8.24] - 2022-01-05
|
23
|
+
|
10
24
|
### Fixed
|
25
|
+
- `Ecoportal::API::V2::Page#stages?` do not generate an object to this purpose
|
26
|
+
- `Ecoportal::API::V2::Registers#search` fix typo in print feedback
|
27
|
+
|
28
|
+
## [0.8.23] - 2021-12-24
|
29
|
+
|
30
|
+
### Added
|
31
|
+
- `Ecoportal::API::V2::Registers#search` added more feedback on what is going on
|
11
32
|
|
12
33
|
## [0.8.22] - 2021-12-23
|
13
34
|
|
@@ -3,10 +3,19 @@ module Ecoportal
|
|
3
3
|
class V2
|
4
4
|
class Page
|
5
5
|
class Permit < Common::Content::DoubleModel
|
6
|
+
class << self
|
7
|
+
def new_doc
|
8
|
+
{
|
9
|
+
"id" => new_uuid,
|
10
|
+
"editable" => false
|
11
|
+
}
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
6
15
|
passkey :id
|
7
16
|
passforced :patch_ver, default: 1
|
8
17
|
passthrough :user_id, :user_name
|
9
|
-
passthrough :editable
|
18
|
+
passthrough :editable
|
10
19
|
embeds_one :flags, klass: "Ecoportal::API::V2::Page::PermissionFlags"
|
11
20
|
end
|
12
21
|
end
|
@@ -66,6 +66,29 @@ module Ecoportal
|
|
66
66
|
end
|
67
67
|
self
|
68
68
|
end
|
69
|
+
|
70
|
+
# Adds a direct permission to this stage
|
71
|
+
# @note it will prevent to duplicate permits on same `user_id`
|
72
|
+
# @raise [ArgumentError] if `value` is not of any of the expected classes
|
73
|
+
# @param value [Ecoportal::API::Internal::Person, Hash] either the person
|
74
|
+
# or the actual Hash model with String keys person `user_id`, `user_name`, `user_email`
|
75
|
+
# @yieldparam section [Ecoportal::API::V2::Page::Permit] the created permit
|
76
|
+
def add_permit(value, &block)
|
77
|
+
props = ["user_id", "user_name", "user_email"]
|
78
|
+
hash_props = case value
|
79
|
+
when Ecoportal::API::Internal::Person
|
80
|
+
return false unless account = value.account
|
81
|
+
props.zip([account.user_id, value.name, value.email]).to_h
|
82
|
+
when Hash
|
83
|
+
value.slice(*props)
|
84
|
+
else
|
85
|
+
raise ArgumentError.new("Expected Ecoportal::API::Internal::Person or Hash. Given: #{value.class}")
|
86
|
+
end
|
87
|
+
hash_doc = Ecoportal::API::V2::Page::Permit.new_doc.merge(hash_props)
|
88
|
+
exists = self.permits.any? {|permit| permit.user_id == hash_doc["user_id"]}
|
89
|
+
return false if exists
|
90
|
+
self.permits.upsert!(hash_doc, &block)
|
91
|
+
end
|
69
92
|
end
|
70
93
|
end
|
71
94
|
end
|
@@ -62,7 +62,7 @@ module Ecoportal
|
|
62
62
|
total ||= data["total"]
|
63
63
|
if total != data["total"]
|
64
64
|
msg = "Change of total in search results. Probably due to changes that affect the filter (register: #{register_id}):"
|
65
|
-
print_search_status(msg, total, results, cursor_id, data)
|
65
|
+
print_search_status(msg, total, results, cursor_id, data, options)
|
66
66
|
#total = data["total"]
|
67
67
|
end
|
68
68
|
|
@@ -79,7 +79,7 @@ module Ecoportal
|
|
79
79
|
break if total <= results
|
80
80
|
unless data["cursor_id"]
|
81
81
|
msg = "Possible error... finishing search for lack of cursor_id in response:"
|
82
|
-
print_search_status(msg, total, results, cursor_id, data)
|
82
|
+
print_search_status(msg, total, results, cursor_id, data, options)
|
83
83
|
end
|
84
84
|
break unless (cursor_id = data["cursor_id"])
|
85
85
|
end
|
@@ -103,9 +103,10 @@ module Ecoportal
|
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
106
|
-
def print_search_status(msg, total, results, cursor_id, data)
|
106
|
+
def print_search_status(msg, total, results, cursor_id, data, options)
|
107
107
|
msg += "\n"
|
108
108
|
msg += " • Original total: #{total}\n"
|
109
|
+
msg += " • Current total: #{data&.dig("total")}\n"
|
109
110
|
msg += " • Total results retrieved: #{results}\n"
|
110
111
|
msg += " • Cursor id: #{cursor_id} (#{Base64.decode64(cursor_id)})\n"
|
111
112
|
msg += " • Current cursor results: #{data["results"]&.length}\n"
|
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.26
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oscar Segura
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|