eco-helpers 3.0.2 → 3.0.4
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/.rubocop.yml +2 -0
- data/CHANGELOG.md +15 -1
- data/lib/eco/api/common/people/person_parser.rb +1 -0
- data/lib/eco/api/organization/login_providers.rb +10 -7
- data/lib/eco/api/usecases/default/utils/split_csv_case.rb +9 -2
- data/lib/eco/csv/split.rb +20 -5
- data/lib/eco/csv.rb +4 -2
- data/lib/eco/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: 4768a5497ea319bbd31f09bceeb42c9d43567446b01c4e58894928ad6dec84c3
|
4
|
+
data.tar.gz: 4179baf86c6f45f8424fa6690eecc0d1fc5be0daf4059c0af63050e70fcc8a3b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d45b4fa67247ac68ac53122759b934bc6c26d14e684774fb0e63184abfcf7799441e1e17384be726ada0d1a437228a5af152a589b9446fb582a1d4a5bbd140ad
|
7
|
+
data.tar.gz: 4cce2123784bdd2730b0052338f52838979aa4ac3435e2a105f56124029e2a3192a481bd2ec694e172763cef24c383485243d06f87b25031dc358d565d858023
|
data/.rubocop.yml
CHANGED
@@ -33,6 +33,8 @@ Style/BlockDelimiters:
|
|
33
33
|
Style/HashSyntax:
|
34
34
|
EnforcedShorthandSyntax: either
|
35
35
|
EnforcedStyle: no_mixed_keys
|
36
|
+
Style/ArgumentsForwarding:
|
37
|
+
UseAnonymousForwarding: false
|
36
38
|
Style/ClassAndModuleChildren:
|
37
39
|
Enabled: false
|
38
40
|
Style/FrozenStringLiteralComment:
|
data/CHANGELOG.md
CHANGED
@@ -2,12 +2,26 @@
|
|
2
2
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
|
5
|
-
## [3.0.
|
5
|
+
## [3.0.4] - 2024-08-xx
|
6
6
|
|
7
7
|
### Added
|
8
8
|
|
9
|
+
- `Eco::Csv::Split` add `total_count` and `copy_count`
|
10
|
+
- `Eco::API::Common::People::PersonParser`
|
11
|
+
- added core attribute `brand_id`
|
12
|
+
|
9
13
|
### Changed
|
10
14
|
|
15
|
+
### Fixed
|
16
|
+
|
17
|
+
## [3.0.3] - 2024-08-13
|
18
|
+
|
19
|
+
### Added
|
20
|
+
|
21
|
+
- `login_provider_ids` parser
|
22
|
+
- Natural options for `sso` and `magic_link`
|
23
|
+
- This links with people imports spreadsheet
|
24
|
+
|
11
25
|
## [3.0.2] - 2024-08-09
|
12
26
|
|
13
27
|
### Changed
|
@@ -96,15 +96,18 @@ module Eco
|
|
96
96
|
|
97
97
|
hash[type] = lp unless hash.key?(type)
|
98
98
|
|
99
|
-
|
100
|
-
|
101
|
-
hash[:sso]
|
99
|
+
if lp.type == 'saml'
|
100
|
+
# only map the first :sso
|
101
|
+
hash[:sso] = lp unless hash.key?(:sso)
|
102
|
+
hash['sso'] = lp unless hash.key?('sso')
|
102
103
|
end
|
103
104
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
105
|
+
next unless lp.type == 'onetimepassword'
|
106
|
+
|
107
|
+
hash[:magic_link] = lp
|
108
|
+
hash[:magiclink] = lp
|
109
|
+
hash['magic_link'] = lp
|
110
|
+
hash['magiclink'] = lp
|
108
111
|
end
|
109
112
|
|
110
113
|
@caches_init = true
|
@@ -16,8 +16,15 @@ class Eco::API::UseCases::Default::Utils::SplitCsv < Eco::API::Common::Loaders::
|
|
16
16
|
max_rows: max_rows,
|
17
17
|
start_at: start_at,
|
18
18
|
&filter
|
19
|
-
).
|
20
|
-
|
19
|
+
).tap do |split|
|
20
|
+
msg = []
|
21
|
+
msg << "Total rows copied: #{split.copy_count} (out of #{split.total_count})"
|
22
|
+
msg << "Generated files:"
|
23
|
+
split.out_files.each do |file|
|
24
|
+
msg << " * #{file}'"
|
25
|
+
end
|
26
|
+
|
27
|
+
log(:info) { msg.join("\n") }
|
21
28
|
end
|
22
29
|
end
|
23
30
|
end
|
data/lib/eco/csv/split.rb
CHANGED
@@ -13,9 +13,25 @@ module Eco
|
|
13
13
|
@max_rows = max_rows
|
14
14
|
@start_at = start_at
|
15
15
|
@params = kargs
|
16
|
+
|
16
17
|
init
|
17
18
|
end
|
18
19
|
|
20
|
+
# @return [Integer] number of total output rows
|
21
|
+
def copy_count
|
22
|
+
@copy_count ||= 0
|
23
|
+
end
|
24
|
+
|
25
|
+
# @return [Integer] number of total input rows
|
26
|
+
def total_count
|
27
|
+
@total_count ||= 0
|
28
|
+
end
|
29
|
+
|
30
|
+
# @return [Array<String>] list of created files
|
31
|
+
def out_files
|
32
|
+
@out_files ||= []
|
33
|
+
end
|
34
|
+
|
19
35
|
# @yield [idx, file] a block to spot the filename
|
20
36
|
# @yieldparam idx [Integer] the number of the file
|
21
37
|
# @yieldparam file [String] the default name of the file
|
@@ -24,8 +40,10 @@ module Eco
|
|
24
40
|
# @return [Array<String>] names of the generated files
|
25
41
|
def call(&block)
|
26
42
|
stream.for_each(start_at_idx: start_at) do |row, ridx|
|
43
|
+
self.total_count += 1
|
27
44
|
copy_row(row, ridx, &block)
|
28
45
|
end
|
46
|
+
|
29
47
|
out_files
|
30
48
|
ensure
|
31
49
|
puts "Close at row #{row_idx}"
|
@@ -49,7 +67,8 @@ module Eco
|
|
49
67
|
included &&= !block || yield(row, ridx, fidx, file_out)
|
50
68
|
next unless included
|
51
69
|
|
52
|
-
|
70
|
+
self.copy_count += 1
|
71
|
+
csv << row.fields
|
53
72
|
end
|
54
73
|
end
|
55
74
|
|
@@ -97,10 +116,6 @@ module Eco
|
|
97
116
|
"0" * 5
|
98
117
|
end
|
99
118
|
|
100
|
-
def out_files
|
101
|
-
@out_files ||= []
|
102
|
-
end
|
103
|
-
|
104
119
|
def input_name
|
105
120
|
@input_name ||= File.basename(input_basename, input_ext)
|
106
121
|
end
|
data/lib/eco/csv.rb
CHANGED
@@ -29,14 +29,16 @@ module Eco
|
|
29
29
|
# @param max_rows [Integer] number of rows per file
|
30
30
|
# @param start_at [Integer] row that sets the starting point.
|
31
31
|
# Leave empty for the full set of rows.
|
32
|
-
# @
|
32
|
+
# @return [Eco::CSV::Split]
|
33
33
|
def split(filename, max_rows:, start_at: nil, **kargs, &block)
|
34
34
|
Eco::CSV::Split.new(
|
35
35
|
filename,
|
36
36
|
max_rows: max_rows,
|
37
37
|
start_at: start_at,
|
38
38
|
**kargs
|
39
|
-
).
|
39
|
+
).tap do |splitter|
|
40
|
+
splitter.call(&block)
|
41
|
+
end
|
40
42
|
end
|
41
43
|
|
42
44
|
# @note it excludes headers by default
|
data/lib/eco/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eco-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oscar Segura
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|