eco-helpers 2.0.24 → 2.0.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -3
- data/lib/eco/api/common/people/entry_factory.rb +1 -1
- data/lib/eco/api/organization/people.rb +6 -0
- data/lib/eco/api/session/batch.rb +1 -1
- data/lib/eco/api/session/batch/job.rb +1 -1
- data/lib/eco/api/usecases/default_cases/hris_case.rb +20 -0
- data/lib/eco/cli/config/default/options.rb +1 -1
- data/lib/eco/language/models/collection.rb +5 -2
- 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: 06a58306abadf9b27421583990eb14960f7f30368515481b16aa474de1bc1b08
|
4
|
+
data.tar.gz: 0eef93068fdb31bc6d1949f1022eac325403ac3dbb47c95b593a5b9623655773
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80b0d2fc7bedb99deabae6d7d273cb4967eb0022db2e743078a82cace02d4f499fe8ad51ec02b7c5bcef549aac9fb03b0ea7ef5358fb602c65856654c7c20814
|
7
|
+
data.tar.gz: 553e1342f38c244ab57bb259b639d55ddc4a4d5d6f72bd54ed9290111636f4dffb29834f69a5b7d2707ee3d44951fa52efccf81589194f11dfa1a709309ddb77
|
data/CHANGELOG.md
CHANGED
@@ -1,13 +1,23 @@
|
|
1
1
|
# Change Log
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
-
## [2.0.
|
4
|
+
## [2.0.25] - 2021-06-xx
|
5
5
|
|
6
6
|
### Added
|
7
|
-
- `Eco::API::
|
8
|
-
|
7
|
+
- `Eco::API::UseCases::DefaultCases::HrisCase` validation error to require `-schema-id` command line when there are people in schemas other than the active one
|
8
|
+
|
9
9
|
### Changed
|
10
|
+
- `Eco::API::Session::Batch::Job`
|
11
|
+
* for backwards compatibility `-include-only-excluded` should bring an options structure compatible with `-include-excluded`
|
12
|
+
|
10
13
|
### Fixed
|
14
|
+
- `Eco::API::Session::Batch` fixed typo that would prevent `prompt_user` to work
|
15
|
+
|
16
|
+
## [2.0.24] - 2021-06-22
|
17
|
+
|
18
|
+
### Added
|
19
|
+
- `Eco::API::Session::Batch::Job` made **native** `-include-excluded`
|
20
|
+
* also added new option `-include-only-excluded` to be able to only target people HRIS excluded
|
11
21
|
|
12
22
|
|
13
23
|
## [2.0.23] - 2021-06-22
|
@@ -164,7 +164,7 @@ module Eco
|
|
164
164
|
|
165
165
|
run = true
|
166
166
|
if Eco::API::Common::Session::FileManager.file_exists?(file)
|
167
|
-
prompt_user("
|
167
|
+
prompt_user("Do you want to overwrite it? (Y/n):", explanation: "The file '#{file}' already exists.", default: "Y") do |response|
|
168
168
|
run = (response == "") || reponse.upcase.start_with?("Y")
|
169
169
|
end
|
170
170
|
end
|
@@ -137,7 +137,7 @@ module Eco
|
|
137
137
|
rescue error_type => e
|
138
138
|
raise unless retries_left > 0
|
139
139
|
explanation = "Batch TimeOut. You have #{retries_left} retries left."
|
140
|
-
prompt_user("Do you want to retry (y/N)?",
|
140
|
+
prompt_user(" Do you want to retry (y/N)?", default: "Y", explanation: explanation, timeout: 10) do |response|
|
141
141
|
if response.upcase.start_with?("Y")
|
142
142
|
offer_retry_on(error_type, retries_left - 1, &block)
|
143
143
|
else
|
@@ -253,7 +253,7 @@ module Eco
|
|
253
253
|
def api_included(full_queue)
|
254
254
|
return full_queue if type == :create
|
255
255
|
return full_queue unless excluded = session.config.people.api_excluded
|
256
|
-
if options.dig(:include, :
|
256
|
+
if options.dig(:include, :excluded, :only)
|
257
257
|
full_queue.select {|entry| excluded.call(entry, session, options, self)}
|
258
258
|
elsif options.dig(:include, :excluded)
|
259
259
|
full_queue
|
@@ -3,8 +3,11 @@ class Eco::API::UseCases::DefaultCases::HrisCase < Eco::API::Common::Loaders::Us
|
|
3
3
|
type :sync
|
4
4
|
|
5
5
|
attr_reader :creation, :update, :supers, :leavers
|
6
|
+
attr_reader :people, :session, :options
|
6
7
|
|
7
8
|
def main(entries, people, session, options, usecase)
|
9
|
+
@session = session; @options = options; @people = people
|
10
|
+
require_only_one_schema!
|
8
11
|
micro = session.micro
|
9
12
|
@creation = session.new_job("main", "create", :create, usecase)
|
10
13
|
@update = session.new_job("main", "update", :update, usecase)
|
@@ -30,4 +33,21 @@ class Eco::API::UseCases::DefaultCases::HrisCase < Eco::API::Common::Loaders::Us
|
|
30
33
|
person.account = nil if person.account
|
31
34
|
end
|
32
35
|
|
36
|
+
def require_only_one_schema!
|
37
|
+
unless schema_id = options.dig(:people, :filter, :details, :schema_id)
|
38
|
+
active_schema = session.schema
|
39
|
+
other_schemas = session.schemas.map(&:id) - [active_schema.id]
|
40
|
+
other_people = people.group_by_schema.values_at(*other_schemas).map(&:to_a).flatten
|
41
|
+
if other_people.length > 3
|
42
|
+
msg = "There are #{other_people.length} people in schemas other than #{active_schema.name}."
|
43
|
+
msg << " Please, use the filter option '-schema_id SchemaName' for the 'hris' case to only include those of that schema"
|
44
|
+
msg << " in the current update. The HRIS case identifies people that are not in the file as leavers."
|
45
|
+
msg << " (as it will remove the account of all the people of other schemas if they are not in the input file)."
|
46
|
+
msg << "\n For example: -schema-id '#{active_schema.name.downcase}'"
|
47
|
+
logger.error(msg)
|
48
|
+
raise msg
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
33
53
|
end
|
@@ -95,7 +95,7 @@ ASSETS.cli.config do |cnf|
|
|
95
95
|
|
96
96
|
desc = "Includes in API updates ONLY people that evaluate true as people excluded from periodic upates."
|
97
97
|
options_set.add("-include-only-excluded", desc) do |options|
|
98
|
-
options.deep_merge!(include: {
|
98
|
+
options.deep_merge!(include: {excluded: {only: true}})
|
99
99
|
end
|
100
100
|
|
101
101
|
desc = "Ignores threshold limitations on requests for this session (skip batch belt)"
|
@@ -134,8 +134,11 @@ module Eco
|
|
134
134
|
to_a.group_by(&block) if block
|
135
135
|
end
|
136
136
|
|
137
|
-
|
138
|
-
|
137
|
+
# By a specific `attr` or a block
|
138
|
+
# @note either one or the other should be present
|
139
|
+
def to_h(attr, &block)
|
140
|
+
return to_a.group_by(&block) if block
|
141
|
+
raise "And attr or a block are required. Given attr: #{attr}" unless attr
|
139
142
|
to_a.group_by { |object| object.method(attr).call }
|
140
143
|
end
|
141
144
|
# @!endgroup
|
data/lib/eco/version.rb
CHANGED