eco-helpers 1.5.8 → 1.5.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -0
- data/CHANGELOG.md +49 -2
- data/eco-helpers.gemspec +3 -2
- data/lib/eco/api/common/people/default_parsers/csv_parser.rb +15 -2
- data/lib/eco/api/common/people/person_entry.rb +1 -1
- data/lib/eco/api/microcases/set_core_with_supervisor.rb +5 -3
- data/lib/eco/api/organization/tag_tree.rb +17 -0
- data/lib/eco/api/session/batch/errors.rb +12 -2
- data/lib/eco/api/session/config/api.rb +1 -1
- data/lib/eco/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f83b4bc20ff8289dbc743531ceaf75350fefbefa687c3f88ae09325b762e1fd1
|
4
|
+
data.tar.gz: b6ecd929fc1494ba657755020eac2cd92bdfe1ad4b4e5beb454c2bcaea165b77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0fbb3710424b72248a2abefb0a0c8682a6fa4e97c69b50af951298c867582e4e857b5db25fd0afe1ba0a6379f6ba85e751a48c1bed1b091ad0a180f1d52f73df
|
7
|
+
data.tar.gz: 16157a6f8f6118574bec5ca59716b9c52b860b89acab5a7d56bc720b34339de80b747543da684ddd68b23c694f0a67e6af82396f95c1b3811bcf203e7cadb7ee
|
data/.yardopts
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,54 @@
|
|
1
1
|
# Change Log
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
-
## [1.5.
|
4
|
+
## [1.5.13] - 2021-02-01
|
5
|
+
|
6
|
+
### Added
|
7
|
+
### Changed
|
8
|
+
- upgraded dependency with `ecoportal-api-oozes`
|
9
|
+
|
10
|
+
### Fixed
|
11
|
+
- `Eco::API::Session::Config::Api` was not including the correct `host`
|
12
|
+
- this could have launched an `api` request to `live.ecoportal.com` when targeting `pre.dev`
|
13
|
+
|
14
|
+
## [1.5.12] - 2021-02-01
|
15
|
+
|
16
|
+
### Added
|
17
|
+
- `Eco::API::Common::People::DefaultParsers::CSVParser` when cell content is `Null`, capture `nil` value.
|
18
|
+
|
19
|
+
### Changed
|
20
|
+
- upgraded `ecoportal-api` dependency
|
21
|
+
|
22
|
+
### Fixed
|
23
|
+
|
24
|
+
|
25
|
+
## [1.5.11] - 2021-01-25
|
26
|
+
|
27
|
+
### Added
|
28
|
+
- `Eco::API::Organization::TagTree#subtag?` to check if the tag is in any subtree.
|
29
|
+
|
30
|
+
### Changed
|
31
|
+
|
32
|
+
### Fixed
|
33
|
+
- `Eco::API::MicroCases#set_supervisor` shouldn't set it if the entry does not have it.
|
34
|
+
|
35
|
+
## [1.5.10] - 2021-01-19
|
36
|
+
|
37
|
+
### Added
|
38
|
+
### Changed
|
39
|
+
### Fixed
|
40
|
+
- `Eco::API::Session::Batch::Errors#print` show the row number of the input data.
|
41
|
+
|
42
|
+
## [1.5.9] - 2021-01-08
|
43
|
+
|
44
|
+
### Added
|
45
|
+
- `Eco::API::Organization::TagTree#subtags` to get all the tags but those of the highest level.
|
46
|
+
|
47
|
+
### Changed
|
48
|
+
### Fixed
|
49
|
+
|
50
|
+
|
51
|
+
## [1.5.8] - 2021-01-05
|
5
52
|
|
6
53
|
### Added
|
7
54
|
### Changed
|
@@ -9,7 +56,7 @@ All notable changes to this project will be documented in this file.
|
|
9
56
|
- `Eco::API::Session::Batch::Jobs#job` shouldn't be calling the post-launch callback function on creation.
|
10
57
|
- `Eco::API::Session#new_job` should include a `&block` parameter.
|
11
58
|
- `Eco::API::UseCases::DefaultCases::RefreshCase`: fixed typo
|
12
|
-
|
59
|
+
|
13
60
|
## [1.5.7] - 2020-12-17
|
14
61
|
|
15
62
|
### Added
|
data/eco-helpers.gemspec
CHANGED
@@ -13,6 +13,7 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.summary = %q{eco-helpers to manage people api cases}
|
14
14
|
s.homepage = "https://www.ecoportal.com"
|
15
15
|
s.licenses = %w[MIT]
|
16
|
+
s.required_ruby_version = '>= 2.4.4'
|
16
17
|
|
17
18
|
s.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
19
|
f.match(%r{^(test|spec|features)/})
|
@@ -28,8 +29,8 @@ Gem::Specification.new do |s|
|
|
28
29
|
s.add_development_dependency "yard", ">= 0.9.18", "< 0.10"
|
29
30
|
s.add_development_dependency "redcarpet", ">= 3.5.0", "< 3.6"
|
30
31
|
|
31
|
-
s.add_dependency 'ecoportal-api', '>= 0.7.
|
32
|
-
s.add_dependency 'ecoportal-api-oozes', '>= 0.7.
|
32
|
+
s.add_dependency 'ecoportal-api', '>= 0.7.4', '< 0.8'
|
33
|
+
s.add_dependency 'ecoportal-api-oozes', '>= 0.7.3', '< 0.8'
|
33
34
|
s.add_dependency 'aws-sdk-s3', '>= 1.64.0', '< 2'
|
34
35
|
s.add_dependency 'aws-sdk-ses', '>= 1.29.0', '< 2'
|
35
36
|
s.add_dependency 'dotenv', '>= 2.7.0', '< 2.8'
|
@@ -5,8 +5,7 @@ class Eco::API::Common::People::DefaultParsers::CSVParser < Eco::API::Common::Lo
|
|
5
5
|
Eco::CSV.parse(data, headers: true, skip_blanks: true).each_with_object([]) do |row, arr_hash|
|
6
6
|
row_hash = row.headers.uniq.each_with_object({}) do |attr, hash|
|
7
7
|
next if attr.to_s.strip.empty?
|
8
|
-
|
9
|
-
hash[attr.strip] = value.to_s.empty?? nil : value
|
8
|
+
hash[attr.strip] = parse_string(row[attr])
|
10
9
|
end
|
11
10
|
arr_hash.push(row_hash)
|
12
11
|
end
|
@@ -23,4 +22,18 @@ class Eco::API::Common::People::DefaultParsers::CSVParser < Eco::API::Common::Lo
|
|
23
22
|
CSV::Table.new(arr_rows).to_csv
|
24
23
|
end
|
25
24
|
|
25
|
+
private
|
26
|
+
|
27
|
+
def parse_string(value)
|
28
|
+
return nil if value.to_s.empty?
|
29
|
+
return nil if null?(value)
|
30
|
+
value
|
31
|
+
end
|
32
|
+
|
33
|
+
def null?(value)
|
34
|
+
return true if !value
|
35
|
+
str = value.strip.upcase
|
36
|
+
["NULL"].any? {|token| str == token}
|
37
|
+
end
|
38
|
+
|
26
39
|
end
|
@@ -75,7 +75,7 @@ module Eco
|
|
75
75
|
!parsing?
|
76
76
|
end
|
77
77
|
|
78
|
-
# @note `Eco::API::Common::People::EntryFactory#entries` adds this `idx`
|
78
|
+
# @note `Eco::API::Common::People::EntryFactory#entries` adds this `idx` (i.e. row number)
|
79
79
|
# @return [Integer] the entry number in the input file
|
80
80
|
def idx
|
81
81
|
final_entry["idx"]
|
@@ -11,9 +11,11 @@ module Eco
|
|
11
11
|
def set_core_with_supervisor(entry, person, people, supers_job, options)
|
12
12
|
unless options.dig(:exclude, :core) && !person.new?
|
13
13
|
micro.set_core(entry, person, options)
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
if entry.supervisor_id?
|
15
|
+
micro.set_supervisor(entry.supervisor_id, person, people, options) do |unkown_id|
|
16
|
+
# delay setting supervisor if does not exit
|
17
|
+
supers_job.add(person) {|person| person.supervisor_id = unkown_id}
|
18
|
+
end
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
@@ -46,6 +46,10 @@ module Eco
|
|
46
46
|
@has_tags.empty?
|
47
47
|
end
|
48
48
|
|
49
|
+
# Gets all the tags of the current node tree.
|
50
|
+
# @note
|
51
|
+
# - this will include the upper level tag(s) as well
|
52
|
+
# - to get all but the upper level tag(s) use `subtags` method instead
|
49
53
|
# @param depth [Integer] if empty, returns the list of tag nodes of that level. Otherwise the list of tag nodes of the entire subtree.
|
50
54
|
# @return [Array<String>]
|
51
55
|
def tags(depth: nil)
|
@@ -58,6 +62,19 @@ module Eco
|
|
58
62
|
end
|
59
63
|
end
|
60
64
|
|
65
|
+
# Gets all but the upper level tags of the current node tree.
|
66
|
+
# @return [Array<String>]
|
67
|
+
def subtags
|
68
|
+
tags - tags(depth: depth)
|
69
|
+
end
|
70
|
+
|
71
|
+
# Verifies if a tag exists in the subtree(s).
|
72
|
+
# @param key [String] tag to verify.
|
73
|
+
# @return [Boolean]
|
74
|
+
def subtag?(key)
|
75
|
+
subtags.include?(key&.upcase)
|
76
|
+
end
|
77
|
+
|
61
78
|
# Verifies if a tag exists in the tree.
|
62
79
|
# @param key [String] tag to verify.
|
63
80
|
# @return [Boolean]
|
@@ -123,7 +123,7 @@ module Eco
|
|
123
123
|
entry = queue.to_a[i]
|
124
124
|
response = status[i]
|
125
125
|
msg = "Error #{response.status}: #{response.body}\n"
|
126
|
-
msg += "-- Failed to batch #{method}
|
126
|
+
msg += "-- Failed to batch #{method}. Person: #{person_ref(entry)}"
|
127
127
|
end
|
128
128
|
msg
|
129
129
|
end
|
@@ -164,7 +164,8 @@ module Eco
|
|
164
164
|
private
|
165
165
|
|
166
166
|
def person_ref(entry)
|
167
|
-
|
167
|
+
row_str = (row = get_row(entry)) ? "(row: #{row}) " : nil
|
168
|
+
"#{row_str}(id: '#{get_attr(entry, :id)}') '#{get_attr(entry, :name)}' ('#{get_attr(entry, :external_id)}': '#{get_attr(entry, :email)}')"
|
168
169
|
end
|
169
170
|
|
170
171
|
def get_attr(entry, attr)
|
@@ -175,6 +176,15 @@ module Eco
|
|
175
176
|
end
|
176
177
|
end
|
177
178
|
|
179
|
+
def get_row(value)
|
180
|
+
case value
|
181
|
+
when Eco::API::Common::People::PersonEntry
|
182
|
+
value.idx
|
183
|
+
when Ecoportal::API::V1::Person
|
184
|
+
get_row(value.entry)
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
178
188
|
end
|
179
189
|
end
|
180
190
|
end
|
@@ -142,7 +142,7 @@ module Eco
|
|
142
142
|
when :v1
|
143
143
|
klass.new(external_key, host: host, logger: logger)
|
144
144
|
when :v2
|
145
|
-
klass.new(user_key: user_key, org_key: external_key, logger: logger)
|
145
|
+
klass.new(user_key: user_key, org_key: external_key, host: host, logger: logger)
|
146
146
|
end.tap do |api|
|
147
147
|
unless !api || log_connection?
|
148
148
|
@logger.info("Created api#{self.version(version)} connection on '#{name}' enviro, pointing to '#{host}' in '#{mode}' mode")
|
data/lib/eco/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eco-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oscar Segura
|
@@ -116,7 +116,7 @@ dependencies:
|
|
116
116
|
requirements:
|
117
117
|
- - ">="
|
118
118
|
- !ruby/object:Gem::Version
|
119
|
-
version: 0.7.
|
119
|
+
version: 0.7.4
|
120
120
|
- - "<"
|
121
121
|
- !ruby/object:Gem::Version
|
122
122
|
version: '0.8'
|
@@ -126,7 +126,7 @@ dependencies:
|
|
126
126
|
requirements:
|
127
127
|
- - ">="
|
128
128
|
- !ruby/object:Gem::Version
|
129
|
-
version: 0.7.
|
129
|
+
version: 0.7.4
|
130
130
|
- - "<"
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: '0.8'
|
@@ -136,7 +136,7 @@ dependencies:
|
|
136
136
|
requirements:
|
137
137
|
- - ">="
|
138
138
|
- !ruby/object:Gem::Version
|
139
|
-
version: 0.7.
|
139
|
+
version: 0.7.3
|
140
140
|
- - "<"
|
141
141
|
- !ruby/object:Gem::Version
|
142
142
|
version: '0.8'
|
@@ -146,7 +146,7 @@ dependencies:
|
|
146
146
|
requirements:
|
147
147
|
- - ">="
|
148
148
|
- !ruby/object:Gem::Version
|
149
|
-
version: 0.7.
|
149
|
+
version: 0.7.3
|
150
150
|
- - "<"
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0.8'
|
@@ -474,7 +474,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
474
474
|
requirements:
|
475
475
|
- - ">="
|
476
476
|
- !ruby/object:Gem::Version
|
477
|
-
version:
|
477
|
+
version: 2.4.4
|
478
478
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
479
479
|
requirements:
|
480
480
|
- - ">="
|