eco-helpers 2.0.22 → 2.0.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -2
- data/lib/eco/api/session/batch/job.rb +27 -8
- data/lib/eco/cli/config/default/options.rb +5 -0
- data/lib/eco/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: 2fb1adac01fbf3e34dfc80ca54c8254f660fc12deb3be3b20b395e3fc84fb8a7
|
4
|
+
data.tar.gz: b6d8d61a28333eb7446654589e32725b22c875741df08f9a2401315b6ef6b1b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c45a670a64f0e2a725542aa47776800b1a013dbc222a676b1ed813c5cb6aad425b8e0d0b906a06a8fce37fc89de2b329998a0c5ec9861bf2b3de42d10b560b47
|
7
|
+
data.tar.gz: df2f0fc1e776bbdc8dbf8de622944444b84b8b1cf9446002299fbd60d4f062b73e42d1828403996be0f42251d21db27c6bdb227a1d3b9dd979cde4799148915e
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,17 @@
|
|
1
1
|
# Change Log
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
+
## [2.0.23] - 2021-06-xx
|
5
|
+
|
6
|
+
### Added
|
7
|
+
- `Eco::API::Session::Batch::Job` **new** option (`-save-requests`) to save requests even if in `dry-run` (`-simulate`)
|
8
|
+
### Changed
|
9
|
+
- `Eco::API::Session::Batch::Job` new people won't create updates unless they have either details or account
|
10
|
+
* because that entry is not supposed to be created unless has account or details
|
11
|
+
|
12
|
+
### Fixed
|
13
|
+
|
14
|
+
|
4
15
|
## [2.0.22] - 2021-06-18
|
5
16
|
|
6
17
|
### Added
|
@@ -25,8 +36,6 @@ All notable changes to this project will be documented in this file.
|
|
25
36
|
- custom `Error` classes now all inherit from `StandardError` (rather than `Exception`)
|
26
37
|
|
27
38
|
|
28
|
-
### Fixed
|
29
|
-
|
30
39
|
|
31
40
|
## [2.0.21] - 2021-06-04
|
32
41
|
|
@@ -164,12 +164,17 @@ module Eco
|
|
164
164
|
# @return [Eco::API::Session::Batch::Status]
|
165
165
|
def launch(simulate: false)
|
166
166
|
pqueue = processed_queue
|
167
|
-
@requests =
|
167
|
+
@requests = as_update(pqueue)
|
168
168
|
pre_checks(requests, simulate: simulate)
|
169
169
|
|
170
|
-
|
170
|
+
if simulate
|
171
|
+
if options.dig(:requests, :backup)
|
172
|
+
req_backup = as_update(pqueue, add_feedback: false)
|
173
|
+
backup_update(req_backup, simulate: simulate)
|
174
|
+
end
|
175
|
+
else
|
171
176
|
if pqueue.length > 0
|
172
|
-
req_backup =
|
177
|
+
req_backup = as_update(pqueue, add_feedback: false)
|
173
178
|
backup_update(req_backup)
|
174
179
|
session.batch.launch(pqueue, method: type).tap do |job_status|
|
175
180
|
@status = job_status
|
@@ -220,13 +225,26 @@ module Eco
|
|
220
225
|
end.join("\n")
|
221
226
|
end
|
222
227
|
|
223
|
-
def as_update(*args)
|
224
|
-
|
228
|
+
def as_update(data, *args)
|
229
|
+
if data.is_a?(Array)
|
230
|
+
data.map do |e|
|
231
|
+
feedback.as_update(e, *args)
|
232
|
+
end.compact.select {|e| e && !e.empty?}
|
233
|
+
else
|
234
|
+
feedback.as_update(data, *args)
|
235
|
+
end
|
225
236
|
end
|
226
237
|
|
227
238
|
def processed_queue
|
228
239
|
@queue.each {|e| @callbacks[e].call(e) if @callbacks.key?(e) }
|
229
|
-
apply_policies(api_included(@queue)).select
|
240
|
+
apply_policies(api_included(@queue)).select do |e|
|
241
|
+
!as_update(e).empty?
|
242
|
+
end.select do |e|
|
243
|
+
next true unless e.is_a?(Ecoportal::API::V1::Person)
|
244
|
+
next true unless e.new?
|
245
|
+
# new people should either have account or details
|
246
|
+
e.account || e.details
|
247
|
+
end
|
230
248
|
end
|
231
249
|
|
232
250
|
# if there is a config definition to exclude entries
|
@@ -307,9 +325,10 @@ module Eco
|
|
307
325
|
end
|
308
326
|
|
309
327
|
# Keep a copy of the requests for future reference
|
310
|
-
def backup_update(requests)
|
328
|
+
def backup_update(requests, simulate: false)
|
329
|
+
dry_run = simulate ? "_dry_run" : ""
|
311
330
|
dir = config.people.requests_folder
|
312
|
-
file = File.join(dir, "#{type}_data.json")
|
331
|
+
file = File.join(dir, "#{type}_data#{dry_run}.json")
|
313
332
|
file_manager.save_json(requests, file, :timestamp)
|
314
333
|
end
|
315
334
|
|
@@ -66,6 +66,11 @@ ASSETS.cli.config do |cnf|
|
|
66
66
|
})
|
67
67
|
end
|
68
68
|
|
69
|
+
desc = "Saves the requests's body even though running in dry-run (-simulate)"
|
70
|
+
options_set.add("-save-requests", desc) do |options, session|
|
71
|
+
options.deep_merge!(requests: {backup: true})
|
72
|
+
end
|
73
|
+
|
69
74
|
desc = "Used to specify the cache file of people to be used. "
|
70
75
|
desc += "It is useful to use as people reference those stored in cached file diffrent to the last one."
|
71
76
|
options_set.add("-people-from-backup", desc) do |options, session|
|
data/lib/eco/version.rb
CHANGED