eco-helpers 2.0.12 → 2.0.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +80 -73
  3. data/eco-helpers.gemspec +6 -4
  4. data/lib/eco-helpers.rb +1 -0
  5. data/lib/eco/api/common/base_loader.rb +14 -0
  6. data/lib/eco/api/common/loaders/use_case.rb +1 -1
  7. data/lib/eco/api/common/people/default_parsers/date_parser.rb +11 -1
  8. data/lib/eco/api/common/people/default_parsers/login_providers_parser.rb +1 -1
  9. data/lib/eco/api/common/people/default_parsers/policy_groups_parser.rb +11 -11
  10. data/lib/eco/api/common/people/person_entry.rb +9 -2
  11. data/lib/eco/api/common/people/supervisor_helpers.rb +27 -0
  12. data/lib/eco/api/common/session/file_manager.rb +2 -2
  13. data/lib/eco/api/common/session/mailer.rb +0 -1
  14. data/lib/eco/api/common/session/s3_uploader.rb +0 -1
  15. data/lib/eco/api/common/session/sftp.rb +0 -1
  16. data/lib/eco/api/error.rb +5 -3
  17. data/lib/eco/api/microcases.rb +3 -1
  18. data/lib/eco/api/microcases/append_usergroups.rb +0 -1
  19. data/lib/eco/api/microcases/people_cache.rb +2 -2
  20. data/lib/eco/api/microcases/people_load.rb +2 -2
  21. data/lib/eco/api/microcases/people_refresh.rb +2 -2
  22. data/lib/eco/api/microcases/people_search.rb +6 -6
  23. data/lib/eco/api/microcases/preserve_default_tag.rb +23 -0
  24. data/lib/eco/api/microcases/preserve_filter_tags.rb +28 -0
  25. data/lib/eco/api/microcases/preserve_policy_groups.rb +30 -0
  26. data/lib/eco/api/microcases/set_account.rb +0 -1
  27. data/lib/eco/api/organization.rb +1 -0
  28. data/lib/eco/api/organization/people.rb +7 -0
  29. data/lib/eco/api/organization/people_analytics.rb +60 -0
  30. data/lib/eco/api/organization/presets_factory.rb +116 -93
  31. data/lib/eco/api/organization/presets_integrity.json +58 -0
  32. data/lib/eco/api/organization/presets_values.json +5 -4
  33. data/lib/eco/api/policies/default_policies/99_user_access_policy.rb +0 -30
  34. data/lib/eco/api/session.rb +1 -20
  35. data/lib/eco/api/session/batch.rb +42 -10
  36. data/lib/eco/api/session/batch/job.rb +3 -0
  37. data/lib/eco/api/session/config.rb +16 -15
  38. data/lib/eco/api/session/config/api.rb +4 -0
  39. data/lib/eco/api/session/config/apis.rb +14 -0
  40. data/lib/eco/api/session/config/files.rb +7 -0
  41. data/lib/eco/api/session/config/people.rb +3 -19
  42. data/lib/eco/api/usecases.rb +2 -0
  43. data/lib/eco/api/usecases/default_cases.rb +4 -1
  44. data/lib/eco/api/usecases/default_cases/abstract_policygroup_abilities_case.rb +161 -0
  45. data/lib/eco/api/usecases/default_cases/analyse_people_case.rb +76 -0
  46. data/lib/eco/api/usecases/default_cases/codes_to_tags_case.rb +2 -3
  47. data/lib/eco/api/usecases/default_cases/hris_case.rb +14 -8
  48. data/lib/eco/api/usecases/default_cases/reset_landing_page_case.rb +11 -1
  49. data/lib/eco/api/usecases/default_cases/restore_db_case.rb +1 -2
  50. data/lib/eco/api/usecases/default_cases/supers_cyclic_identify_case.rb +72 -0
  51. data/lib/eco/api/usecases/default_cases/supers_hierarchy_case.rb +59 -0
  52. data/lib/eco/api/usecases/default_cases/to_csv_case.rb +104 -26
  53. data/lib/eco/api/usecases/default_cases/to_csv_detailed_case.rb +62 -36
  54. data/lib/eco/cli.rb +0 -10
  55. data/lib/eco/cli/config/default/options.rb +19 -17
  56. data/lib/eco/cli/config/default/people_filters.rb +3 -3
  57. data/lib/eco/cli/config/default/usecases.rb +77 -25
  58. data/lib/eco/cli/config/default/workflow.rb +6 -1
  59. data/lib/eco/cli/config/help.rb +1 -0
  60. data/lib/eco/cli/config/options_set.rb +106 -13
  61. data/lib/eco/cli/config/use_cases.rb +33 -33
  62. data/lib/eco/cli/scripting/args_helpers.rb +30 -3
  63. data/lib/eco/data.rb +1 -0
  64. data/lib/eco/data/crypto/encryption.rb +3 -3
  65. data/lib/eco/data/files/directory.rb +28 -20
  66. data/lib/eco/data/files/helpers.rb +6 -4
  67. data/lib/eco/data/fuzzy_match.rb +119 -0
  68. data/lib/eco/data/fuzzy_match/array_helpers.rb +75 -0
  69. data/lib/eco/data/fuzzy_match/chars_position_score.rb +37 -0
  70. data/lib/eco/data/fuzzy_match/ngrams_score.rb +73 -0
  71. data/lib/eco/data/fuzzy_match/pairing.rb +102 -0
  72. data/lib/eco/data/fuzzy_match/result.rb +67 -0
  73. data/lib/eco/data/fuzzy_match/results.rb +53 -0
  74. data/lib/eco/data/fuzzy_match/score.rb +44 -0
  75. data/lib/eco/data/fuzzy_match/stop_words.rb +35 -0
  76. data/lib/eco/data/fuzzy_match/string_helpers.rb +69 -0
  77. data/lib/eco/version.rb +1 -1
  78. metadata +86 -10
  79. data/lib/eco/api/microcases/refresh_abilities.rb +0 -19
  80. data/lib/eco/api/organization/presets_reference.json +0 -59
  81. data/lib/eco/api/usecases/default_cases/refresh_abilities_case.rb +0 -30
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3506fbbcb2da4707ebb9451ea0f4afe1549923a4af2aed306d929243a94016df
4
- data.tar.gz: 5279c8a96662b19c097cb9d2e0a35b2d29ccb917ec77873ff0fb248b83d51069
3
+ metadata.gz: 4d982e3f0bdb6c5831544cc5a1e232f4d0902220adf9bf65dac88b64eee97d08
4
+ data.tar.gz: 0cc1d65f0336bef75df0f99cd972a99e5c986307fcb9e14bb3a7a3e5eef69173
5
5
  SHA512:
6
- metadata.gz: 5100d854ec4b3ca20f8127d4128325ad8e557d554167917af7d495761da81f2e21be2f45b33dd00b02d1d7f830299f1bcde6e88134db62b021ddef6c7a234f88
7
- data.tar.gz: d65ef75ed11d804ee4d45768533c8d4ccef60c88fc435dc6d9df909d87f962a7914036e110cf8c4231b53b1738c85369458ca2e464dc7efefce3e3760a9d4c04
6
+ metadata.gz: 72b1e364f326a3d6e7fb0145ff8e4727bc41da1ae9f453be7d2aeec1c749e0b4463750cbe95370a5f241794d394ab79f3836339369ea6be131f2ebc18d7287ca
7
+ data.tar.gz: be3e03507f60c643a0b4d14eeca65f7a34534042a86a06239f9a015e9a2e8be6e2a757d1dfc94c7608663e53e503d6e0cc8bc9ffebe4ac54df8391be422df6a6
data/CHANGELOG.md CHANGED
@@ -1,21 +1,98 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
- ## [2.0.12] - 2021-03-29
4
+ ## [2.0.17] - 2021-05-24
5
+
6
+ Specific changes due to eP **release `1.5.9.70`** (_Policy Group Abilities_)
7
+ - And some improvements as well as new tools
5
8
 
6
9
  ### Added
10
+ - `Eco::API::Organization::PresetsFactory` added integrity validation for `person_abilities` ability
11
+ - `Eco::API::Organization::PresetsFactory`
12
+ - `#validate`: returns an `Array` with all the errors that a `permissions_custom` has
13
+ - `#valid?`: checks if a `permissions_custom` is valid
14
+ - `Eco::API::Organization::PeopleAnalytics`: a **helper** class to identify things in the People Manager and provide mitigation action methods to resolve them.
15
+ - Added dependencies to `fuzzy_match`, `amatch` and `jaro_winkler` **gems**
16
+ - `Eco::Data::FuzzyMatch` with string match helpers and a set of home-made generic libs.
17
+ - `Eco::API::Organization::PeopleAnalytics` to launch analysis on the People Manager
18
+ - `Eco::API::UseCases::DefaultCases::AnalysePeople` invokable via `-analyse-people`
19
+ - **new** -> a way to define a hierarchy of options (at least of 1 Level)
20
+ - `API::CLI::Config::OptionsSet`
21
+ - `API::CLI::Config::UseCases::CaseConfig`
22
+ - Integrated the new feature to the `--help` command and methods.
23
+ - **Usecase** `Eco::API::UseCases::DefaultCases::ResetLandingPageCase` added parameter to specify `-page-id`
24
+ - `Eco::API::Common::BaseLoader` new shortcut methods `#micro` (_MicroCases_), `#session` and `#config`
25
+ - At this stage of the execution workflow it uses `ASSETS.session`
26
+ - **Important note**: when the `#parser` or `#serializer` are called the `ASSETS.session` might already be linked to the specific invoked environment
27
+ - New method helpers in `Ecoporta::API::MicroCases`
28
+ - `preserve_filter_tags`, `preserve_default_tag` and `preserve_policy_groups`
7
29
 
8
30
  ### Changed
9
- - `Eco::CLI#run` it does include any defined states on the workflow
31
+ - upgraded dependency on `ecoportal-api` and `ecoportal-api-v2`
32
+ - **removed** `Eco::API::MicroCases#refresh_abilities`
33
+ - `Eco::API::MicroCases#set_account` **removed** `refresh_abilities`
34
+ - `Eco::API::MicroCases#append_usergroups` **removed** `refresh_abilities`
35
+ - **removed** _usecase_ `Eco::API::UseCases::DefaultCases::RefreshAbilitiesCase` (`-refresh-abilities`)
36
+ - `Eco::API::Policies::DefaultPolicies::UserAccess`: **removed** `refresh_abilities`
37
+ - **removed** `Eco::API::Session#new_preset`
38
+ - `Eco::API::Organization::PresetsFactory`
39
+ - **removed** `rspecs`
40
+ - `.new`: **removed** parameters `presets_custom` & `presets_map`
41
+ - **removed** constants `DEFAULT_CUSTOM`, and `DEFAULT_MAP`
42
+ - **removed** private methods `#presets_custom` and `#presets_map`
43
+ - **changed** private method `#compile` receives directly an array of `permissions_custom`
44
+ - `Eco::API::Session::Config` **removed** methods `#presets_custom=` & `presets_map=`
45
+ - `Eco::API::Session::Config::People` **removed** methods `#presets_custom=`, `#presets_map=`,`#presets_custom` & `#presets_map`
46
+ - **removed** `eco/api/organization/presets_reference.json`
47
+ - **moved** case-specific options to only be active when the user case is previously invoked in the command line.
10
48
 
11
49
  ### Fixed
50
+ - **handle** `Ecoportal::API:Errors::TimeOut` in `Eco::API::Session::Batch` by offering to retry.
12
51
 
52
+ ## [2.0.16] - 2021-05-04
13
53
 
14
- ## [2.0.11] - 2021-03-29
54
+ ### Added
55
+ - Use case `Eco::API::UseCases::DefaultCases::SupersCyclicIdentify`, invokable via `-identify-cyclic-supers`
56
+ - Use case `Eco::API::UseCases::DefaultCases::AbstractPolicyGroupAbilities`, invokable via `-abstract-policygroup-abilities`
57
+ - Option to run `one-off` scripts, without org configurations:
58
+ 1. `-api-key INTERNAL_API_KEY`
59
+ 2. `-enviro [live|pre.dev]`
60
+ 3. `-org NAME_OF_ORG`
61
+
62
+ ## [2.0.15] - 2021-04-29
63
+
64
+ ### Added
65
+ - Use case `Eco::API::UseCases::DefaultCases::SupersHierarchy`, invokable via `-supers-hierarchy`
66
+ ### Fixed
67
+ - `eco/cli/config/default/workflow.rb` prevent `rescue` looping
68
+
69
+ ## [2.0.14] - 2021-04-15
70
+
71
+ ### Added
72
+ - `Eco::API::UseCases::DefaultCases::ToCsvCase` added option `-internal-names` to avoid overriding data on export
73
+ - `Eco::API::Common::People::PersonEntry#mapped_entry` exposed method for raw `csv` generation
74
+ - `Eco::API::Organization::PresetsFactory` added integrity validation for `person_*` abilities
75
+ - `Eco::API::Session::Batch::Job` more debug info on erron handlers
76
+
77
+ ### Fixed
78
+ - `Eco::API::Error.get_type` was almost always matching `Eco::API::Error::Unclassified` -> fixed
79
+
80
+ ## [2.0.13] - 2021-03-31
15
81
 
16
82
  ### Added
83
+ - Stats on the `Eco::API::Session::Batch`
84
+ - Allow to inherit and re-use the `Eco::API::UseCases::DefaultCase::HrisCase`
85
+
86
+ ### Fixed
87
+ - Ensure auto-loading for `Eco::API::UseCases`
88
+
89
+ ## [2.0.12] - 2021-03-29
17
90
 
18
91
  ### Changed
92
+ - `Eco::CLI#run` it does include any defined states on the workflow
93
+
94
+
95
+ ## [2.0.11] - 2021-03-29
19
96
 
20
97
  ### Fixed
21
98
  - `Eco::API::Session::Batch:Errors#errors` changed `Array#filter` call to `Array#select` call
@@ -35,34 +112,24 @@ All notable changes to this project will be documented in this file.
35
112
  - Ranamed `#defined_attrs` to `#defined_model_attrs`
36
113
  - Ranamed `#undefined_attrs` to `#undefined_model_attrs`
37
114
 
38
- ### Fixed
39
-
40
115
  ## [2.0.9] - 2021-03-19
41
116
 
42
- ### Added
43
117
  ### Changed
44
118
  - `Eco::API::Session::Batch:Errors#person_ref` moved to the public method
45
119
 
46
- ### Fixed
47
-
48
120
  ## [2.0.8] - 2021-03-09
49
121
 
50
- ### Added
51
- ### Changed
52
122
  ### Fixed
53
123
  - `Ecoportal::API::V1::Person#identity` adjust behavior
54
124
 
55
125
  ## [2.0.7] - 2021-03-09
56
126
 
57
- ### Added
58
- ### Changed
59
127
  ### Fixed
60
128
  - `Eco::API::Session::Batch::JobsGroups` and `Eco::API::Session::Batch::Jobs`: when new `Batch::Job`s are creating during launch, they remained unlaunched
61
129
  - this fix makes `#launch` method to iterate until there are no pending
62
130
 
63
131
  ## [2.0.6] - 2021-03-08
64
132
 
65
- ### Added
66
133
  ### Changed
67
134
  - `Eco::API::Session::Batch:Errors` moved some methods to be private
68
135
  ### Fixed
@@ -70,46 +137,33 @@ All notable changes to this project will be documented in this file.
70
137
 
71
138
  ## [2.0.5] - 2021-02-24
72
139
 
73
- ### Added
74
- ### Changed
75
140
  ### Fixed
76
141
  - `Eco::API::Common::People::PersonParser#symbol_keys` to use `Array#select`
77
142
  - as `Array#filter` was introduced in ruby `2.5.5`
78
143
 
79
144
  ## [2.0.4] - 2021-02-23
80
145
 
81
- ### Added
82
146
  ### Changed
83
147
  - `Eco::API::Common::People::PersonParser#defined_attrs` to include virtual attributes
84
148
 
85
- ### Fixed
86
-
87
149
  ## [2.0.3] - 2021-02-23
88
150
 
89
151
  ### Added
90
152
  - `Eco::API::UseCases::OozeSamples::OozeUpdateCase`: added integration to update page instances (non-templates)
91
153
 
92
- ### Changed
93
154
  ### Fixed
94
155
  - `Eco::API::Policies::DefaultPolicies::UserAccess` complete default policy code.
95
156
 
96
157
  ## [2.0.2] - 2021-02-22
97
158
 
98
- ### Added
99
159
  ### Changed
100
160
  - upgraded dependencies with `ecoportal-api`
101
161
 
102
- ### Fixed
103
-
104
-
105
162
  ## [2.0.1] - 2021-02-22
106
163
 
107
- ### Added
108
164
  ### Changed
109
165
  - upgraded dependencies with `ecoportal-api-oozes` to `ecoportal-api-v2`
110
166
 
111
- ### Fixed
112
-
113
167
  ## [1.5.15] - 2021-02-17
114
168
 
115
169
  ### Added
@@ -123,7 +177,6 @@ All notable changes to this project will be documented in this file.
123
177
  - `Eco::API::MicroCases#people_search`
124
178
  - `Eco::API::MicroCases#refresh`
125
179
 
126
- ### Changed
127
180
  ### Fixed
128
181
  - `Eco::API::Policies::DefaultPolicies::UserAccess` typos in default api policy
129
182
 
@@ -145,11 +198,8 @@ All notable changes to this project will be documented in this file.
145
198
  - `Eco::API::Common::People::PersonEntry` add error log when wrong email error is detected
146
199
  - previously it would have crashed
147
200
 
148
- ### Fixed
149
-
150
201
  ## [1.5.13] - 2021-02-01
151
202
 
152
- ### Added
153
203
  ### Changed
154
204
  - upgraded dependency with `ecoportal-api-oozes`
155
205
 
@@ -165,23 +215,16 @@ All notable changes to this project will be documented in this file.
165
215
  ### Changed
166
216
  - upgraded `ecoportal-api` dependency
167
217
 
168
- ### Fixed
169
-
170
-
171
218
  ## [1.5.11] - 2021-01-25
172
219
 
173
220
  ### Added
174
221
  - `Eco::API::Organization::TagTree#subtag?` to check if the tag is in any subtree.
175
222
 
176
- ### Changed
177
-
178
223
  ### Fixed
179
224
  - `Eco::API::MicroCases#set_supervisor` shouldn't set it if the entry does not have it.
180
225
 
181
226
  ## [1.5.10] - 2021-01-19
182
227
 
183
- ### Added
184
- ### Changed
185
228
  ### Fixed
186
229
  - `Eco::API::Session::Batch::Errors#print` show the row number of the input data.
187
230
 
@@ -190,14 +233,8 @@ All notable changes to this project will be documented in this file.
190
233
  ### Added
191
234
  - `Eco::API::Organization::TagTree#subtags` to get all the tags but those of the highest level.
192
235
 
193
- ### Changed
194
- ### Fixed
195
-
196
-
197
236
  ## [1.5.8] - 2021-01-05
198
237
 
199
- ### Added
200
- ### Changed
201
238
  ### Fixed
202
239
  - `Eco::API::Session::Batch::Jobs#job` shouldn't be calling the post-launch callback function on creation.
203
240
  - `Eco::API::Session#new_job` should include a `&block` parameter.
@@ -205,15 +242,11 @@ All notable changes to this project will be documented in this file.
205
242
 
206
243
  ## [1.5.7] - 2020-12-17
207
244
 
208
- ### Added
209
- ### Changed
210
245
  ### Fixed
211
246
  - `Eco::API::Sesssion#parse_attribute` was not using phase argument
212
247
 
213
248
  ## [1.5.6] - 2020-12-04
214
249
 
215
- ### Added
216
- ### Changed
217
250
  ### Fixed
218
251
  - `Eco::API::UseCases::DefaultCases::RestoreDBCase` fixed typo and slightly improved
219
252
  - fixed some back-end errors when chaining usecases
@@ -221,8 +254,6 @@ All notable changes to this project will be documented in this file.
221
254
 
222
255
  ## [1.5.5] - 2020-12-03
223
256
 
224
- ### Added
225
- ### Changed
226
257
  ### Fixed
227
258
  - rubies previous to `2.5` do not have `yield_self`
228
259
 
@@ -230,14 +261,11 @@ All notable changes to this project will be documented in this file.
230
261
 
231
262
  ### Added
232
263
  - update `ecoportal-api` dependency
233
- ### Changed
234
264
  ### Fixed
235
265
  - `Eco::API::MicroCases#people_refresh` typo
236
266
 
237
267
  ## [1.5.3] - 2020-11-30
238
268
 
239
- ### Added
240
- ### Changed
241
269
  ### Fixed
242
270
  - `Eco::API::Session::Batch::RequestStats#blanked_value?` better blank detection
243
271
  - `Eco::API::MicroCases#with_each_starter` rectified typo
@@ -378,14 +406,11 @@ All notable changes to this project will be documented in this file.
378
406
 
379
407
  ## [1.4.2] - 2020-07-23
380
408
 
381
- ### Added
382
- ### Changed
383
409
  ### Fixed
384
410
  - preserve backtrace on logging
385
411
 
386
412
  ## [1.4.0] - 2020-07-14
387
413
 
388
- ### Added
389
414
  ### Changed
390
415
  - change abilities to align with ecoPortal release `1.5.0`
391
416
  - remove some patches on `ecoportal-api`
@@ -395,22 +420,17 @@ All notable changes to this project will be documented in this file.
395
420
 
396
421
  ## [1.3.19] - 2020-07-23
397
422
 
398
- ### Added
399
- ### Changed
400
423
  ### Fixed
401
424
  - preserve backtrace on logging
402
425
 
403
426
  ## [1.3.18] - 2020-07-08
404
427
 
405
- ### Added
406
- ### Changed
407
428
  ### Fixed
408
429
  - the `update` case was missing the code to use the `default_usergroup`
409
430
 
410
431
 
411
432
  ## [1.3.17] - 2020-07-06
412
433
 
413
- ### Added
414
434
  ### Changed
415
435
  - the `hris` case should not only include as `leavers` those that have account, but anyone that leaves
416
436
  * as we could have active people with no account
@@ -433,7 +453,6 @@ All notable changes to this project will be documented in this file.
433
453
  ### Added
434
454
  - default usecase to export to `csv` (`-detailed`) now includes `"Supervisor Name"` column
435
455
  ### Changed
436
- ### Fixed
437
456
 
438
457
  ## [1.3.14] - 2020-06-10
439
458
 
@@ -441,33 +460,24 @@ All notable changes to this project will be documented in this file.
441
460
  - `Eco::API::Common::People::SupervisorHelpers` now has its methods as class methods
442
461
  ### Changed
443
462
  - upgraded `ecoportal-api` gem dependency to minimum version `0.5.6`
444
- ### Fixed
445
463
 
446
464
 
447
465
  ## [1.3.13] - 2020-05-29
448
466
 
449
- ### Added
450
- ### Changed
451
467
  ### Fixed
452
468
  - `Eco::API::Organization::TagTree#tag?` to accept `nil` by returning `false`
453
469
  - `Eco::API::Common::People::DefaultParsers::DateParser` will parse to `Date` class
454
470
  * it was parsing to `Time` class, while the native gem `ecoportal-api` parses as `Date` ([reference](https://gitlab.com/ecoPortal/ecoportal-api/-/blob/master/lib/ecoportal/api/v1/schema_field.rb))
455
471
  ## [1.3.12] - 2020-05-19
456
472
 
457
- ### Added
458
473
  ### Changed
459
474
  - stop using `email` as `external_id` on `People#person` & `People#find`
460
475
  * this should result in more accurate searches when using `:strict` options
461
- ### Fixed
462
-
463
476
 
464
477
  ## [1.3.11] - 2020-05-12
465
478
 
466
- ### Added
467
479
  ### Changed
468
480
  - remove popping up comments on `Eco::API::Organization::PolicyGroups#`
469
- ### Fixed
470
-
471
481
 
472
482
  ## [1.3.10] - 2020-05-12
473
483
 
@@ -476,14 +486,11 @@ All notable changes to this project will be documented in this file.
476
486
  - `config.people.default_usergroup`, when defined, will have effect on usecases: `update` (this case was missing the change)
477
487
  * on account creation, if the input file did not specify `policy_group_ids`
478
488
 
479
- ### Changed
480
489
  ### Fixed
481
490
  - `upsert`, `hris` and `create` usecases: fixed condition for use of default_usergroup
482
491
 
483
492
  ## [1.3.9] - 2020-05-12
484
493
 
485
- ### Added
486
- ### Changed
487
494
  ### Fixed
488
495
 
489
496
  - `usecase` callback was not receiving `usecase` paramater
data/eco-helpers.gemspec CHANGED
@@ -24,17 +24,19 @@ Gem::Specification.new do |spec|
24
24
  #spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
25
25
  spec.require_paths = ["lib"]
26
26
 
27
- spec.add_development_dependency "bundler", ">= 2.2.11", "< 2.3"
27
+ spec.add_development_dependency "bundler", ">= 2.2.17", "< 2.3"
28
28
  spec.add_development_dependency "rspec", ">= 3.10.0", "< 3.11"
29
29
  spec.add_development_dependency "rake", ">= 13.0.3", "< 13.1"
30
30
  spec.add_development_dependency "yard", ">= 0.9.26", "< 0.10"
31
31
  spec.add_development_dependency "redcarpet", ">= 3.5.1", "< 3.6"
32
32
 
33
- spec.add_dependency 'ecoportal-api', '>= 0.8.2', '< 0.9'
34
- spec.add_dependency 'ecoportal-api-v2', '>= 0.8.6', '< 0.9'
33
+ spec.add_dependency 'ecoportal-api', '>= 0.8.3', '< 0.9'
34
+ spec.add_dependency 'ecoportal-api-v2', '>= 0.8.7', '< 0.9'
35
35
  spec.add_dependency 'aws-sdk-s3', '>= 1.83.0', '< 2'
36
36
  spec.add_dependency 'aws-sdk-ses', '>= 1.36.0', '< 2'
37
37
  spec.add_dependency 'dotenv', '>= 2.7.6', '< 2.8'
38
38
  spec.add_dependency 'net-sftp', '>= 3.0.0', '< 3.1'
39
-
39
+ spec.add_dependency 'fuzzy_match', '>= 2.1.0', '< 2.2'
40
+ spec.add_dependency 'amatch', '>= 0.4.0', '< 0.5'
41
+ spec.add_dependency 'jaro_winkler', '>= 1.5.4', '< 1.6'
40
42
  end
data/lib/eco-helpers.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'csv'
2
2
  require 'json'
3
3
  require 'pp'
4
+ require 'dotenv/load'
4
5
 
5
6
 
6
7
  module Eco
@@ -48,6 +48,20 @@ module Eco
48
48
  self.class.name
49
49
  end
50
50
 
51
+ private
52
+
53
+ def session
54
+ @session ||= ASSETS.session
55
+ end
56
+
57
+ def micro
58
+ session.micro
59
+ end
60
+
61
+ def config
62
+ @config ||= ASSETS.config
63
+ end
64
+
51
65
  end
52
66
  end
53
67
  end
@@ -8,7 +8,7 @@ module Eco
8
8
  # @return [Symbol] the `type` of usecase (i.e. `:sync`, `:transform`, `:import`, `:other`)
9
9
  def type(value = nil)
10
10
  unless value
11
- return @type || raise("You should specify a type of case [:sync, :transform, :import, :other] for #{self.class}")
11
+ return @type || raise("You should specify a type of case [:sync, :transform, :import, :other] for #{self}")
12
12
  end
13
13
  @type = value
14
14
  end
@@ -6,7 +6,7 @@ class Eco::API::Common::People::DefaultParsers::DateParser < Eco::API::Common::L
6
6
  end
7
7
 
8
8
  def serializer(value, deps)
9
- value.is_a?(Array) ? value.map { |d| d && d.strftime('%Y-%m-%d') } : value && value.strftime('%Y-%m-%d')
9
+ value.is_a?(Array) ? value.map { |d| serialize_date(d) } : serialize_date(value)
10
10
  end
11
11
 
12
12
  private
@@ -19,4 +19,14 @@ class Eco::API::Common::People::DefaultParsers::DateParser < Eco::API::Common::L
19
19
  end
20
20
  end
21
21
 
22
+ def serialize_date(value)
23
+ return value if value.is_a?(String)
24
+ begin
25
+ value && value.strftime('%Y-%m-%d')
26
+ rescue
27
+ nil
28
+ end
29
+ end
30
+
31
+
22
32
  end