eco-helpers 3.0.30 → 3.0.32
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 +26 -1
- data/eco-helpers.gemspec +1 -1
- data/lib/eco/api/common/loaders/use_case/cli_identify.rb +3 -0
- data/lib/eco/api/common/people/person_entry.rb +2 -0
- data/lib/eco/api/microcases/people/fetch/with_each.rb +9 -2
- data/lib/eco/api/organization/people/multiple_search_results.rb +42 -36
- data/lib/eco/api/organization/people/similarity.rb +226 -224
- data/lib/eco/api/organization/people.rb +1 -0
- data/lib/eco/api/session/batch/job.rb +1 -0
- data/lib/eco/api/usecases/cli/dsl.rb +0 -1
- data/lib/eco/api/usecases/cli/option.rb +1 -1
- data/lib/eco/api/usecases/default_cases/create_case.rb +3 -3
- data/lib/eco/api/usecases/default_cases/delete_sync_case.rb +2 -2
- data/lib/eco/api/usecases/default_cases/delete_trans_case.rb +3 -3
- data/lib/eco/api/usecases/default_cases/hris_case.rb +10 -9
- data/lib/eco/api/usecases/default_cases/to_csv_case.rb +10 -10
- data/lib/eco/api/usecases/default_cases/to_csv_detailed_case.rb +50 -50
- data/lib/eco/api/usecases/default_cases/update_case.rb +3 -3
- data/lib/eco/api/usecases/graphql/samples/location/service/tree_diff/convertible/inputable.rb +4 -1
- data/lib/eco/api/usecases/lib/files/sftp.rb +5 -1
- data/lib/eco/cli/config/use_cases/active_case.rb +9 -0
- data/lib/eco/cli/config/use_cases/case_config.rb +27 -0
- data/lib/eco/cli/config/use_cases.rb +2 -15
- data/lib/eco/cli_default/usecases.rb +1 -1
- data/lib/eco/data/files/helpers.rb +3 -0
- data/lib/eco/language/delegation/delegating_blank.rb +4 -16
- data/lib/eco/language/delegation/delegating_missing_const.rb +1 -1
- data/lib/eco/language/methods/call_detector.rb +4 -8
- data/lib/eco/language/methods/dsl_able.rb +29 -33
- data/lib/eco/language/methods/instance_method_helpers.rb +38 -0
- data/lib/eco/language/methods.rb +1 -0
- data/lib/eco/language.rb +1 -1
- data/lib/eco/version.rb +1 -1
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04541ff2083942aea30704e9e9fa81eb8eaa97a077751f9026f6ce0736d16fc7
|
4
|
+
data.tar.gz: 00d0b4cb1333605a5d951f393e8ba7ca78dd0d720037564b8e7998cf02fb8924
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 605d6b462db16cca9303a33126f8524abd249627d868f36c169fbee3a42492cc1efe49e4ed2943be66d753bdffd629fddba9c7ab62d0a1acc3152e0370425726
|
7
|
+
data.tar.gz: a6f41f8e987373457c237314c218dd493e3aaf775084e4616fb69f403e04876ca8af360c28b6564ecafd70405aa03c83a769c99f25342cbb0006f4b8762f9ea9
|
data/CHANGELOG.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
|
5
|
-
## [3.0.
|
5
|
+
## [3.0.33] - 2025-04-xx
|
6
6
|
|
7
7
|
### Added
|
8
8
|
|
@@ -10,6 +10,31 @@ All notable changes to this project will be documented in this file.
|
|
10
10
|
|
11
11
|
### Fixed
|
12
12
|
|
13
|
+
## [3.0.32] - 2025-04-08
|
14
|
+
|
15
|
+
### Added
|
16
|
+
|
17
|
+
- `MicroCase#with_each` added option to pick up the first user.
|
18
|
+
|
19
|
+
### Fixed
|
20
|
+
|
21
|
+
- `Eco::API::Organization::People`
|
22
|
+
- `MultipleSearchResults` and `Similarity` where in a different namespace.
|
23
|
+
|
24
|
+
## [3.0.31] - 2025-04-04
|
25
|
+
|
26
|
+
### Changed
|
27
|
+
|
28
|
+
- upgraded `ecoportal-api-gem`
|
29
|
+
|
30
|
+
### Fixed
|
31
|
+
|
32
|
+
- `Eco::API::Common::People::PersonEntry#_parse_type`
|
33
|
+
- During a refactor the line that parses schema details fields that are `multiple` got removed. **Added** this parsing back in.
|
34
|
+
- `Eco::Data::Files#folder_files`
|
35
|
+
- prevent `nil` error
|
36
|
+
- Message of `Sftp` moving file to.
|
37
|
+
|
13
38
|
## [3.0.30] - 2025-04-03
|
14
39
|
|
15
40
|
### Added
|
data/eco-helpers.gemspec
CHANGED
@@ -41,7 +41,7 @@ Gem::Specification.new do |spec|
|
|
41
41
|
spec.add_dependency 'bcrypt_pbkdf', '~> 1.0'
|
42
42
|
spec.add_dependency 'docx', '>= 0.8.0', '< 0.9'
|
43
43
|
spec.add_dependency 'dotenv', '~> 3'
|
44
|
-
spec.add_dependency 'ecoportal-api', '~> 0.10', '>= 0.10.
|
44
|
+
spec.add_dependency 'ecoportal-api', '~> 0.10', '>= 0.10.10'
|
45
45
|
spec.add_dependency 'ecoportal-api-graphql', '~> 0.4', '>= 0.4.5'
|
46
46
|
spec.add_dependency 'ecoportal-api-v2', '~> 2.0', '>= 2.0.16'
|
47
47
|
spec.add_dependency 'ed25519', '~> 1.2'
|
@@ -4,6 +4,9 @@ class Eco::API::Common::Loaders::UseCase
|
|
4
4
|
cli&.apply!
|
5
5
|
end
|
6
6
|
|
7
|
+
# It uses the `cli_class` to install the Cli. If not given, it tries
|
8
|
+
# to identify if there's a `Case::Cli` constant defined that it is a Cli class.
|
9
|
+
# @todo check if `@cli` should really be fixed to a value (currently not).
|
7
10
|
def cli(cli_class = nil)
|
8
11
|
if cli_class.is_a?(Class)
|
9
12
|
msg = 'cli_class should inherit from Eco::API::UseCases::Cli'
|
@@ -509,6 +509,8 @@ module Eco
|
|
509
509
|
msg = "Field '#{attr}' does not exist in details of schema: '#{schema.name}'"
|
510
510
|
fatal(msg) unless (field = schema[attr])
|
511
511
|
|
512
|
+
value = @person_parser.parse(:multiple, value) if field.multiple
|
513
|
+
|
512
514
|
if @person_parser.defined?(field.type.to_sym)
|
513
515
|
value = @person_parser.parse(
|
514
516
|
field.type.to_sym,
|
@@ -45,7 +45,7 @@ module Eco
|
|
45
45
|
|
46
46
|
private
|
47
47
|
|
48
|
-
def _with_each_prompt_to_select_user(error, entry: nil, increase_count: true) # rubocop:disable Metrics/AbcSize
|
48
|
+
def _with_each_prompt_to_select_user(error, entry: nil, increase_count: true) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
49
49
|
unless error.is_a?(Eco::API::Organization::People::MultipleSearchResults)
|
50
50
|
raise "Expecting Eco::API::Organization::People::MultipleSearchResults. Given: #{error.class}"
|
51
51
|
end
|
@@ -57,11 +57,12 @@ module Eco
|
|
57
57
|
lines << "\n(#{@_with_each_prompts}) #{error}\n"
|
58
58
|
lines << ' #index - Select the correct person by its number index among the list above.'
|
59
59
|
lines << ' (I) - Just Skip/Ignore this one. I will deal with that input entry in another launch.'
|
60
|
+
lines << ' (U) - The first person with a user account.'
|
60
61
|
lines << ' (A) - Ignore all the rest of input entries with this problem.'
|
61
62
|
lines << ' (C) - Create a new person.'
|
62
63
|
lines << ' (B) - Just break this script. I need to change the input file :/'
|
63
64
|
|
64
|
-
prompt_user('Type one option (#number/I/A/C/B):', explanation: lines.join("\n"), default: 'I') do |res|
|
65
|
+
prompt_user('Type one option (#number/I/U/A/C/B):', explanation: lines.join("\n"), default: 'I') do |res|
|
65
66
|
res = res.upcase
|
66
67
|
|
67
68
|
if res.start_with?('I')
|
@@ -83,6 +84,12 @@ module Eco
|
|
83
84
|
session.new_person
|
84
85
|
elsif res.start_with?('B')
|
85
86
|
raise error
|
87
|
+
elsif res.start_with?('U')
|
88
|
+
error.first_user.tap do |person|
|
89
|
+
next unless person
|
90
|
+
|
91
|
+
log(:info) { "(first user) You selected #{person.identify}" }
|
92
|
+
end
|
86
93
|
elsif res && !res.empty? && (pos = res.to_i rescue nil) && (pos < error.candidates.length) # rubocop:disable Style/RescueModifier
|
87
94
|
error.candidate(pos).tap do |person|
|
88
95
|
log(:info) { "Thanks!! You selected #{person.identify}" }
|
@@ -1,46 +1,52 @@
|
|
1
|
-
module
|
2
|
-
module
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
# @param msg [String] the basic message error.
|
10
|
-
# @param candiates [Array<Person>] the people that match the same search criterion.
|
11
|
-
# @param property [String] the property of the person model that triggered the error (base of the search criterion).
|
12
|
-
def initialize(msg, candidates: [], property: 'email')
|
13
|
-
@candidates = candidates
|
14
|
-
@property = property
|
15
|
-
super("#{msg} #{candidates_summary}")
|
16
|
-
end
|
1
|
+
module Eco
|
2
|
+
module API
|
3
|
+
module Organization
|
4
|
+
class People
|
5
|
+
# Error class that allows to handle cases where multiple people were found for the same criterion.
|
6
|
+
# @note its main purpose to prevent the creation of duplicates or override information between different people.
|
7
|
+
class MultipleSearchResults < StandardError
|
8
|
+
attr_reader :candidates, :property
|
17
9
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
candidates
|
22
|
-
|
10
|
+
# @param msg [String] the basic message error.
|
11
|
+
# @param candiates [Array<Person>] the people that match the same search criterion.
|
12
|
+
# @param property [String] the property of the person model that triggered the error (base of the search criterion).
|
13
|
+
def initialize(msg, candidates: [], property: 'email')
|
14
|
+
@candidates = candidates
|
15
|
+
@property = property
|
16
|
+
super("#{msg} #{candidates_summary}")
|
17
|
+
end
|
23
18
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
19
|
+
def first_user
|
20
|
+
candidates.detect(&:account)
|
21
|
+
end
|
22
|
+
|
23
|
+
# @param with_index [Boolean] to add an index to each candidate description.
|
24
|
+
# @return [Array<String>] the `candidates` identified
|
25
|
+
def identify_candidates(with_index: false)
|
26
|
+
candidates.map.each_with_index do |person, i|
|
27
|
+
index = with_index ? "#{i}. " : ''
|
28
|
+
|
29
|
+
msg = '(no account)'
|
30
|
+
if person.account
|
31
|
+
msg = '(user)'
|
32
|
+
msg = '(new user)' if person.account_added?
|
33
|
+
end
|
29
34
|
|
30
|
-
|
35
|
+
"#{index}#{msg} #{person.identify}"
|
36
|
+
end
|
31
37
|
end
|
32
|
-
end
|
33
38
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
39
|
+
# @return [Person] the `candidate` in the `index` position
|
40
|
+
def candidate(index)
|
41
|
+
candidates[index]
|
42
|
+
end
|
38
43
|
|
39
|
-
|
44
|
+
private
|
40
45
|
|
41
|
-
|
42
|
-
|
43
|
-
|
46
|
+
def candidates_summary
|
47
|
+
lines = ["The following people have the same '#{property}':"]
|
48
|
+
lines.concat(identify_candidates(with_index: true)).join("\n ")
|
49
|
+
end
|
44
50
|
end
|
45
51
|
end
|
46
52
|
end
|