eco-helpers 1.4.1 → 1.5.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +145 -3
  3. data/LICENSE +21 -0
  4. data/eco-helpers.gemspec +11 -10
  5. data/lib/eco/api.rb +3 -0
  6. data/lib/eco/api/common.rb +5 -1
  7. data/lib/eco/api/common/base_loader.rb +54 -0
  8. data/lib/eco/api/common/class_auto_loader.rb +109 -0
  9. data/lib/eco/api/common/class_helpers.rb +33 -0
  10. data/lib/eco/api/common/class_hierarchy.rb +1 -1
  11. data/lib/eco/api/common/class_meta_basics.rb +16 -0
  12. data/lib/eco/api/common/loaders.rb +13 -0
  13. data/lib/eco/api/common/loaders/error_handler.rb +41 -0
  14. data/lib/eco/api/common/loaders/parser.rb +127 -0
  15. data/lib/eco/api/common/loaders/policy.rb +25 -0
  16. data/lib/eco/api/common/loaders/use_case.rb +40 -0
  17. data/lib/eco/api/common/people/default_parsers.rb +5 -10
  18. data/lib/eco/api/common/people/default_parsers/boolean_parser.rb +13 -23
  19. data/lib/eco/api/common/people/default_parsers/csv_parser.rb +20 -35
  20. data/lib/eco/api/common/people/default_parsers/date_parser.rb +15 -26
  21. data/lib/eco/api/common/people/default_parsers/freemium_parser.rb +20 -0
  22. data/lib/eco/api/common/people/default_parsers/login_providers_parser.rb +26 -0
  23. data/lib/eco/api/common/people/default_parsers/multi_parser.rb +15 -27
  24. data/lib/eco/api/common/people/default_parsers/numeric_parser.rb +14 -19
  25. data/lib/eco/api/common/people/default_parsers/policy_groups_parser.rb +31 -0
  26. data/lib/eco/api/common/people/default_parsers/send_invites_parser.rb +15 -24
  27. data/lib/eco/api/common/people/entries.rb +54 -24
  28. data/lib/eco/api/common/people/entry_factory.rb +18 -15
  29. data/lib/eco/api/common/people/person_attribute_parser.rb +29 -12
  30. data/lib/eco/api/common/people/person_entry.rb +308 -216
  31. data/lib/eco/api/common/people/person_entry_attribute_mapper.rb +5 -2
  32. data/lib/eco/api/common/people/person_parser.rb +52 -19
  33. data/lib/eco/api/common/session/base_session.rb +3 -6
  34. data/lib/eco/api/common/session/environment.rb +2 -23
  35. data/lib/eco/api/common/session/logger.rb +4 -0
  36. data/lib/eco/api/common/version_patches/ecoportal_api/external_person.rb +2 -0
  37. data/lib/eco/api/common/version_patches/ecoportal_api/internal_person.rb +9 -1
  38. data/lib/eco/api/common/version_patches/exception.rb +24 -2
  39. data/lib/eco/api/custom.rb +13 -0
  40. data/lib/eco/api/custom/error_handler.rb +20 -0
  41. data/lib/eco/api/custom/namespace.rb +7 -0
  42. data/lib/eco/api/custom/parser.rb +50 -0
  43. data/lib/eco/api/custom/policy.rb +28 -0
  44. data/lib/eco/api/custom/use_case.rb +16 -0
  45. data/lib/eco/api/error.rb +1 -0
  46. data/lib/eco/api/error/handlers.rb +10 -3
  47. data/lib/eco/api/microcases.rb +35 -0
  48. data/lib/eco/api/microcases/account_excluded.rb +24 -0
  49. data/lib/eco/api/microcases/append_usergroups.rb +19 -0
  50. data/lib/eco/api/microcases/core_excluded.rb +20 -0
  51. data/lib/eco/api/microcases/fix_default_group.rb +34 -0
  52. data/lib/eco/api/microcases/fix_filter_tags.rb +42 -0
  53. data/lib/eco/api/microcases/people_cache.rb +17 -0
  54. data/lib/eco/api/microcases/people_load.rb +59 -0
  55. data/lib/eco/api/microcases/people_refresh.rb +31 -0
  56. data/lib/eco/api/microcases/people_search.rb +65 -0
  57. data/lib/eco/api/microcases/refresh_abilities.rb +19 -0
  58. data/lib/eco/api/microcases/refresh_default_tag.rb +27 -0
  59. data/lib/eco/api/microcases/s3upload_targets.rb +39 -0
  60. data/lib/eco/api/microcases/set_account.rb +20 -0
  61. data/lib/eco/api/microcases/set_core.rb +18 -0
  62. data/lib/eco/api/microcases/set_core_with_supervisor.rb +23 -0
  63. data/lib/eco/api/microcases/set_supervisor.rb +30 -0
  64. data/lib/eco/api/microcases/strict_search.rb +19 -0
  65. data/lib/eco/api/microcases/with_each.rb +27 -0
  66. data/lib/eco/api/microcases/with_each_leaver.rb +24 -0
  67. data/lib/eco/api/microcases/with_each_present.rb +30 -0
  68. data/lib/eco/api/microcases/with_each_starter.rb +30 -0
  69. data/lib/eco/api/microcases/with_each_subordinate.rb +34 -0
  70. data/lib/eco/api/microcases/with_supervisor.rb +36 -0
  71. data/lib/eco/api/organization/people.rb +72 -35
  72. data/lib/eco/api/organization/presets_factory.rb +13 -4
  73. data/lib/eco/api/organization/presets_reference.json +9 -1
  74. data/lib/eco/api/organization/presets_values.json +4 -1
  75. data/lib/eco/api/policies.rb +11 -7
  76. data/lib/eco/api/session.rb +62 -29
  77. data/lib/eco/api/session/batch.rb +2 -45
  78. data/lib/eco/api/session/batch/base_policy.rb +7 -6
  79. data/lib/eco/api/session/batch/errors.rb +28 -4
  80. data/lib/eco/api/session/batch/feedback.rb +7 -1
  81. data/lib/eco/api/session/batch/job.rb +40 -23
  82. data/lib/eco/api/session/batch/jobs.rb +9 -4
  83. data/lib/eco/api/session/batch/jobs_groups.rb +1 -1
  84. data/lib/eco/api/session/batch/request_stats.rb +95 -58
  85. data/lib/eco/api/session/batch/status.rb +35 -31
  86. data/lib/eco/api/session/config.rb +106 -44
  87. data/lib/eco/api/session/config/api.rb +132 -7
  88. data/lib/eco/api/session/config/apis.rb +24 -25
  89. data/lib/eco/api/session/config/logger.rb +2 -2
  90. data/lib/eco/api/session/config/post_launch.rb +1 -1
  91. data/lib/eco/api/session/config/workflow.rb +8 -7
  92. data/lib/eco/api/usecases.rb +47 -33
  93. data/lib/eco/api/usecases/backup/append_usergroups_case.rb +36 -0
  94. data/lib/eco/api/usecases/backup/create_case.rb +104 -0
  95. data/lib/eco/api/usecases/backup/create_details_case.rb +31 -0
  96. data/lib/eco/api/usecases/backup/create_details_with_supervisor_case.rb +48 -0
  97. data/lib/eco/api/usecases/backup/hris_case.rb +124 -0
  98. data/lib/eco/api/usecases/backup/set_default_tag_case.rb +49 -0
  99. data/lib/eco/api/usecases/backup/set_supervisor_case.rb +41 -0
  100. data/lib/eco/api/usecases/backup/transfer_account_case.rb +90 -0
  101. data/lib/eco/api/usecases/backup/update_case.rb +112 -0
  102. data/lib/eco/api/usecases/backup/update_details_case.rb +64 -0
  103. data/lib/eco/api/usecases/backup/upsert_case.rb +114 -0
  104. data/lib/eco/api/usecases/base_case.rb +2 -0
  105. data/lib/eco/api/usecases/base_io.rb +3 -3
  106. data/lib/eco/api/usecases/default_cases.rb +23 -53
  107. data/lib/eco/api/usecases/default_cases/append_usergroups_case.rb +10 -31
  108. data/lib/eco/api/usecases/default_cases/change_email_case.rb +23 -47
  109. data/lib/eco/api/usecases/default_cases/codes_to_tags_case.rb +56 -43
  110. data/lib/eco/api/usecases/default_cases/create_case.rb +15 -101
  111. data/lib/eco/api/usecases/default_cases/create_details_case.rb +11 -26
  112. data/lib/eco/api/usecases/default_cases/create_details_with_supervisor_case.rb +12 -43
  113. data/lib/eco/api/usecases/default_cases/delete_sync_case.rb +11 -0
  114. data/lib/eco/api/usecases/default_cases/delete_trans_case.rb +14 -0
  115. data/lib/eco/api/usecases/default_cases/email_as_id_case.rb +10 -21
  116. data/lib/eco/api/usecases/default_cases/hris_case.rb +23 -120
  117. data/lib/eco/api/usecases/default_cases/new_email_case.rb +10 -23
  118. data/lib/eco/api/usecases/default_cases/new_id_case.rb +11 -25
  119. data/lib/eco/api/usecases/default_cases/new_id_case0.rb +14 -0
  120. data/lib/eco/api/usecases/default_cases/org_data_convert_case.rb +83 -0
  121. data/lib/eco/api/usecases/default_cases/refresh_abilities_case.rb +30 -0
  122. data/lib/eco/api/usecases/default_cases/refresh_case.rb +7 -20
  123. data/lib/eco/api/usecases/default_cases/reinvite_sync_case.rb +11 -0
  124. data/lib/eco/api/usecases/default_cases/reinvite_trans_case.rb +17 -0
  125. data/lib/eco/api/usecases/default_cases/remove_account_sync_case.rb +11 -0
  126. data/lib/eco/api/usecases/default_cases/remove_account_trans_case.rb +17 -0
  127. data/lib/eco/api/usecases/default_cases/reset_landing_page_case.rb +9 -19
  128. data/lib/eco/api/usecases/default_cases/restore_db_case.rb +92 -0
  129. data/lib/eco/api/usecases/default_cases/set_default_tag_case.rb +32 -40
  130. data/lib/eco/api/usecases/default_cases/set_supervisor_case.rb +15 -33
  131. data/lib/eco/api/usecases/default_cases/switch_supervisor_case.rb +66 -57
  132. data/lib/eco/api/usecases/default_cases/to_csv_case.rb +36 -44
  133. data/lib/eco/api/usecases/default_cases/to_csv_detailed_case.rb +40 -55
  134. data/lib/eco/api/usecases/default_cases/transfer_account_case.rb +264 -84
  135. data/lib/eco/api/usecases/default_cases/update_case.rb +15 -109
  136. data/lib/eco/api/usecases/default_cases/update_details_case.rb +14 -61
  137. data/lib/eco/api/usecases/default_cases/upsert_case.rb +16 -111
  138. data/lib/eco/api/usecases/use_case_io.rb +9 -9
  139. data/lib/eco/cli/config.rb +10 -2
  140. data/lib/eco/cli/config/default.rb +2 -1
  141. data/lib/eco/cli/config/default/input_filters.rb +58 -0
  142. data/lib/eco/cli/config/default/options.rb +60 -25
  143. data/lib/eco/cli/config/default/people.rb +4 -4
  144. data/lib/eco/cli/config/default/people_filters.rb +108 -0
  145. data/lib/eco/cli/config/default/usecases.rb +69 -32
  146. data/lib/eco/cli/config/default/workflow.rb +37 -27
  147. data/lib/eco/cli/config/filters.rb +50 -0
  148. data/lib/eco/cli/config/filters/input_filters.rb +29 -0
  149. data/lib/eco/cli/config/filters/people_filters.rb +29 -0
  150. data/lib/eco/cli/config/help.rb +49 -0
  151. data/lib/eco/cli/config/options_set.rb +17 -1
  152. data/lib/eco/cli/config/use_cases.rb +79 -53
  153. data/lib/eco/cli/scripting.rb +10 -2
  154. data/lib/eco/cli/scripting/args_helpers.rb +25 -15
  155. data/lib/eco/cli/scripting/argument.rb +1 -0
  156. data/lib/eco/cli/scripting/arguments.rb +1 -1
  157. data/lib/eco/csv.rb +8 -3
  158. data/lib/eco/csv/table.rb +1 -1
  159. data/lib/eco/data/crypto/encryption.rb +3 -0
  160. data/lib/eco/data/files/helpers.rb +6 -1
  161. data/lib/eco/language/match.rb +19 -9
  162. data/lib/eco/language/match_modifier.rb +13 -5
  163. data/lib/eco/language/models/collection.rb +77 -56
  164. data/lib/eco/language/models/parser_serializer.rb +39 -15
  165. data/lib/eco/version.rb +1 -1
  166. metadata +149 -63
  167. data/lib/eco/api/session/task.rb +0 -175
  168. data/lib/eco/api/usecases/default_case.rb +0 -19
  169. data/lib/eco/api/usecases/default_cases/delete_case.rb +0 -32
  170. data/lib/eco/api/usecases/default_cases/recover_db_case.rb +0 -98
  171. data/lib/eco/api/usecases/default_cases/refresh_presets_case.rb +0 -26
  172. data/lib/eco/api/usecases/default_cases/reinvite_case.rb +0 -41
  173. data/lib/eco/api/usecases/default_cases/remove_account_case.rb +0 -38
  174. data/lib/eco/cli/config/default/filters.rb +0 -70
  175. data/lib/eco/cli/config/people_filters.rb +0 -38
@@ -1,3 +1,3 @@
1
1
  module Eco
2
- VERSION = "1.4.1"
2
+ VERSION = "1.5.3"
3
3
  end
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.4.1
4
+ version: 1.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Segura
@@ -14,76 +14,82 @@ dependencies:
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '2.1'
20
17
  - - ">="
21
18
  - !ruby/object:Gem::Version
22
19
  version: 2.1.3
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '2.2'
23
23
  type: :development
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - "~>"
28
- - !ruby/object:Gem::Version
29
- version: '2.1'
30
27
  - - ">="
31
28
  - !ruby/object:Gem::Version
32
29
  version: 2.1.3
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '2.2'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rspec
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: '3'
40
37
  - - ">="
41
38
  - !ruby/object:Gem::Version
42
39
  version: '3.9'
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: '4'
43
43
  type: :development
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - "~>"
48
- - !ruby/object:Gem::Version
49
- version: '3'
50
47
  - - ">="
51
48
  - !ruby/object:Gem::Version
52
49
  version: '3.9'
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '4'
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: rake
55
55
  requirement: !ruby/object:Gem::Requirement
56
56
  requirements:
57
- - - "~>"
57
+ - - ">="
58
58
  - !ruby/object:Gem::Version
59
59
  version: 12.3.0
60
+ - - "<"
61
+ - !ruby/object:Gem::Version
62
+ version: '13'
60
63
  type: :development
61
64
  prerelease: false
62
65
  version_requirements: !ruby/object:Gem::Requirement
63
66
  requirements:
64
- - - "~>"
67
+ - - ">="
65
68
  - !ruby/object:Gem::Version
66
69
  version: 12.3.0
70
+ - - "<"
71
+ - !ruby/object:Gem::Version
72
+ version: '13'
67
73
  - !ruby/object:Gem::Dependency
68
74
  name: yard
69
75
  requirement: !ruby/object:Gem::Requirement
70
76
  requirements:
71
- - - "~>"
72
- - !ruby/object:Gem::Version
73
- version: '0.9'
74
77
  - - ">="
75
78
  - !ruby/object:Gem::Version
76
79
  version: 0.9.18
80
+ - - "<"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.10'
77
83
  type: :development
78
84
  prerelease: false
79
85
  version_requirements: !ruby/object:Gem::Requirement
80
86
  requirements:
81
- - - "~>"
82
- - !ruby/object:Gem::Version
83
- version: '0.9'
84
87
  - - ">="
85
88
  - !ruby/object:Gem::Version
86
89
  version: 0.9.18
90
+ - - "<"
91
+ - !ruby/object:Gem::Version
92
+ version: '0.10'
87
93
  - !ruby/object:Gem::Dependency
88
94
  name: redcarpet
89
95
  requirement: !ruby/object:Gem::Requirement
@@ -91,9 +97,9 @@ dependencies:
91
97
  - - ">="
92
98
  - !ruby/object:Gem::Version
93
99
  version: 3.5.0
94
- - - "~>"
100
+ - - "<"
95
101
  - !ruby/object:Gem::Version
96
- version: '3.5'
102
+ version: '3.6'
97
103
  type: :development
98
104
  prerelease: false
99
105
  version_requirements: !ruby/object:Gem::Requirement
@@ -101,69 +107,89 @@ dependencies:
101
107
  - - ">="
102
108
  - !ruby/object:Gem::Version
103
109
  version: 3.5.0
104
- - - "~>"
110
+ - - "<"
105
111
  - !ruby/object:Gem::Version
106
- version: '3.5'
112
+ version: '3.6'
107
113
  - !ruby/object:Gem::Dependency
108
114
  name: ecoportal-api
109
115
  requirement: !ruby/object:Gem::Requirement
110
116
  requirements:
111
- - - "~>"
112
- - !ruby/object:Gem::Version
113
- version: '0.5'
114
117
  - - ">="
115
118
  - !ruby/object:Gem::Version
116
- version: 0.5.9
119
+ version: 0.7.2
120
+ - - "<"
121
+ - !ruby/object:Gem::Version
122
+ version: '0.8'
117
123
  type: :runtime
118
124
  prerelease: false
119
125
  version_requirements: !ruby/object:Gem::Requirement
120
126
  requirements:
121
- - - "~>"
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ version: 0.7.2
130
+ - - "<"
122
131
  - !ruby/object:Gem::Version
123
- version: '0.5'
132
+ version: '0.8'
133
+ - !ruby/object:Gem::Dependency
134
+ name: ecoportal-api-oozes
135
+ requirement: !ruby/object:Gem::Requirement
136
+ requirements:
124
137
  - - ">="
125
138
  - !ruby/object:Gem::Version
126
- version: 0.5.9
139
+ version: 0.7.2
140
+ - - "<"
141
+ - !ruby/object:Gem::Version
142
+ version: '0.8'
143
+ type: :runtime
144
+ prerelease: false
145
+ version_requirements: !ruby/object:Gem::Requirement
146
+ requirements:
147
+ - - ">="
148
+ - !ruby/object:Gem::Version
149
+ version: 0.7.2
150
+ - - "<"
151
+ - !ruby/object:Gem::Version
152
+ version: '0.8'
127
153
  - !ruby/object:Gem::Dependency
128
154
  name: aws-sdk-s3
129
155
  requirement: !ruby/object:Gem::Requirement
130
156
  requirements:
131
- - - "~>"
132
- - !ruby/object:Gem::Version
133
- version: '1'
134
157
  - - ">="
135
158
  - !ruby/object:Gem::Version
136
159
  version: 1.64.0
160
+ - - "<"
161
+ - !ruby/object:Gem::Version
162
+ version: '2'
137
163
  type: :runtime
138
164
  prerelease: false
139
165
  version_requirements: !ruby/object:Gem::Requirement
140
166
  requirements:
141
- - - "~>"
142
- - !ruby/object:Gem::Version
143
- version: '1'
144
167
  - - ">="
145
168
  - !ruby/object:Gem::Version
146
169
  version: 1.64.0
170
+ - - "<"
171
+ - !ruby/object:Gem::Version
172
+ version: '2'
147
173
  - !ruby/object:Gem::Dependency
148
174
  name: aws-sdk-ses
149
175
  requirement: !ruby/object:Gem::Requirement
150
176
  requirements:
151
- - - "~>"
152
- - !ruby/object:Gem::Version
153
- version: '1'
154
177
  - - ">="
155
178
  - !ruby/object:Gem::Version
156
179
  version: 1.29.0
180
+ - - "<"
181
+ - !ruby/object:Gem::Version
182
+ version: '2'
157
183
  type: :runtime
158
184
  prerelease: false
159
185
  version_requirements: !ruby/object:Gem::Requirement
160
186
  requirements:
161
- - - "~>"
162
- - !ruby/object:Gem::Version
163
- version: '1'
164
187
  - - ">="
165
188
  - !ruby/object:Gem::Version
166
189
  version: 1.29.0
190
+ - - "<"
191
+ - !ruby/object:Gem::Version
192
+ version: '2'
167
193
  - !ruby/object:Gem::Dependency
168
194
  name: dotenv
169
195
  requirement: !ruby/object:Gem::Requirement
@@ -171,9 +197,9 @@ dependencies:
171
197
  - - ">="
172
198
  - !ruby/object:Gem::Version
173
199
  version: 2.7.0
174
- - - "~>"
200
+ - - "<"
175
201
  - !ruby/object:Gem::Version
176
- version: '2.7'
202
+ version: '2.8'
177
203
  type: :runtime
178
204
  prerelease: false
179
205
  version_requirements: !ruby/object:Gem::Requirement
@@ -181,29 +207,29 @@ dependencies:
181
207
  - - ">="
182
208
  - !ruby/object:Gem::Version
183
209
  version: 2.7.0
184
- - - "~>"
210
+ - - "<"
185
211
  - !ruby/object:Gem::Version
186
- version: '2.7'
212
+ version: '2.8'
187
213
  - !ruby/object:Gem::Dependency
188
214
  name: net-sftp
189
215
  requirement: !ruby/object:Gem::Requirement
190
216
  requirements:
191
- - - "~>"
192
- - !ruby/object:Gem::Version
193
- version: '2.1'
194
217
  - - ">="
195
218
  - !ruby/object:Gem::Version
196
219
  version: 2.1.2
220
+ - - "<"
221
+ - !ruby/object:Gem::Version
222
+ version: '2.2'
197
223
  type: :runtime
198
224
  prerelease: false
199
225
  version_requirements: !ruby/object:Gem::Requirement
200
226
  requirements:
201
- - - "~>"
202
- - !ruby/object:Gem::Version
203
- version: '2.1'
204
227
  - - ">="
205
228
  - !ruby/object:Gem::Version
206
229
  version: 2.1.2
230
+ - - "<"
231
+ - !ruby/object:Gem::Version
232
+ version: '2.2'
207
233
  description:
208
234
  email:
209
235
  - oscar@ecoportal.co.nz
@@ -216,22 +242,34 @@ files:
216
242
  - ".yardopts"
217
243
  - CHANGELOG.md
218
244
  - Gemfile
245
+ - LICENSE
219
246
  - README.md
220
247
  - Rakefile
221
248
  - eco-helpers.gemspec
222
249
  - lib/eco-helpers.rb
223
250
  - lib/eco/api.rb
224
251
  - lib/eco/api/common.rb
252
+ - lib/eco/api/common/base_loader.rb
253
+ - lib/eco/api/common/class_auto_loader.rb
225
254
  - lib/eco/api/common/class_helpers.rb
226
255
  - lib/eco/api/common/class_hierarchy.rb
256
+ - lib/eco/api/common/class_meta_basics.rb
257
+ - lib/eco/api/common/loaders.rb
258
+ - lib/eco/api/common/loaders/error_handler.rb
259
+ - lib/eco/api/common/loaders/parser.rb
260
+ - lib/eco/api/common/loaders/policy.rb
261
+ - lib/eco/api/common/loaders/use_case.rb
227
262
  - lib/eco/api/common/people.rb
228
263
  - lib/eco/api/common/people/base_parser.rb
229
264
  - lib/eco/api/common/people/default_parsers.rb
230
265
  - lib/eco/api/common/people/default_parsers/boolean_parser.rb
231
266
  - lib/eco/api/common/people/default_parsers/csv_parser.rb
232
267
  - lib/eco/api/common/people/default_parsers/date_parser.rb
268
+ - lib/eco/api/common/people/default_parsers/freemium_parser.rb
269
+ - lib/eco/api/common/people/default_parsers/login_providers_parser.rb
233
270
  - lib/eco/api/common/people/default_parsers/multi_parser.rb
234
271
  - lib/eco/api/common/people/default_parsers/numeric_parser.rb
272
+ - lib/eco/api/common/people/default_parsers/policy_groups_parser.rb
235
273
  - lib/eco/api/common/people/default_parsers/select_parser.rb
236
274
  - lib/eco/api/common/people/default_parsers/send_invites_parser.rb
237
275
  - lib/eco/api/common/people/entries.rb
@@ -258,9 +296,39 @@ files:
258
296
  - lib/eco/api/common/version_patches/exception.rb
259
297
  - lib/eco/api/common/version_patches/hash.rb
260
298
  - lib/eco/api/common/version_patches/hash/deep_merge.rb
299
+ - lib/eco/api/custom.rb
300
+ - lib/eco/api/custom/error_handler.rb
301
+ - lib/eco/api/custom/namespace.rb
302
+ - lib/eco/api/custom/parser.rb
303
+ - lib/eco/api/custom/policy.rb
304
+ - lib/eco/api/custom/use_case.rb
261
305
  - lib/eco/api/error.rb
262
306
  - lib/eco/api/error/handler.rb
263
307
  - lib/eco/api/error/handlers.rb
308
+ - lib/eco/api/microcases.rb
309
+ - lib/eco/api/microcases/account_excluded.rb
310
+ - lib/eco/api/microcases/append_usergroups.rb
311
+ - lib/eco/api/microcases/core_excluded.rb
312
+ - lib/eco/api/microcases/fix_default_group.rb
313
+ - lib/eco/api/microcases/fix_filter_tags.rb
314
+ - lib/eco/api/microcases/people_cache.rb
315
+ - lib/eco/api/microcases/people_load.rb
316
+ - lib/eco/api/microcases/people_refresh.rb
317
+ - lib/eco/api/microcases/people_search.rb
318
+ - lib/eco/api/microcases/refresh_abilities.rb
319
+ - lib/eco/api/microcases/refresh_default_tag.rb
320
+ - lib/eco/api/microcases/s3upload_targets.rb
321
+ - lib/eco/api/microcases/set_account.rb
322
+ - lib/eco/api/microcases/set_core.rb
323
+ - lib/eco/api/microcases/set_core_with_supervisor.rb
324
+ - lib/eco/api/microcases/set_supervisor.rb
325
+ - lib/eco/api/microcases/strict_search.rb
326
+ - lib/eco/api/microcases/with_each.rb
327
+ - lib/eco/api/microcases/with_each_leaver.rb
328
+ - lib/eco/api/microcases/with_each_present.rb
329
+ - lib/eco/api/microcases/with_each_starter.rb
330
+ - lib/eco/api/microcases/with_each_subordinate.rb
331
+ - lib/eco/api/microcases/with_supervisor.rb
264
332
  - lib/eco/api/organization.rb
265
333
  - lib/eco/api/organization/login_providers.rb
266
334
  - lib/eco/api/organization/people.rb
@@ -297,11 +365,20 @@ files:
297
365
  - lib/eco/api/session/config/s3_storage.rb
298
366
  - lib/eco/api/session/config/sftp.rb
299
367
  - lib/eco/api/session/config/workflow.rb
300
- - lib/eco/api/session/task.rb
301
368
  - lib/eco/api/usecases.rb
369
+ - lib/eco/api/usecases/backup/append_usergroups_case.rb
370
+ - lib/eco/api/usecases/backup/create_case.rb
371
+ - lib/eco/api/usecases/backup/create_details_case.rb
372
+ - lib/eco/api/usecases/backup/create_details_with_supervisor_case.rb
373
+ - lib/eco/api/usecases/backup/hris_case.rb
374
+ - lib/eco/api/usecases/backup/set_default_tag_case.rb
375
+ - lib/eco/api/usecases/backup/set_supervisor_case.rb
376
+ - lib/eco/api/usecases/backup/transfer_account_case.rb
377
+ - lib/eco/api/usecases/backup/update_case.rb
378
+ - lib/eco/api/usecases/backup/update_details_case.rb
379
+ - lib/eco/api/usecases/backup/upsert_case.rb
302
380
  - lib/eco/api/usecases/base_case.rb
303
381
  - lib/eco/api/usecases/base_io.rb
304
- - lib/eco/api/usecases/default_case.rb
305
382
  - lib/eco/api/usecases/default_cases.rb
306
383
  - lib/eco/api/usecases/default_cases/append_usergroups_case.rb
307
384
  - lib/eco/api/usecases/default_cases/change_email_case.rb
@@ -309,17 +386,22 @@ files:
309
386
  - lib/eco/api/usecases/default_cases/create_case.rb
310
387
  - lib/eco/api/usecases/default_cases/create_details_case.rb
311
388
  - lib/eco/api/usecases/default_cases/create_details_with_supervisor_case.rb
312
- - lib/eco/api/usecases/default_cases/delete_case.rb
389
+ - lib/eco/api/usecases/default_cases/delete_sync_case.rb
390
+ - lib/eco/api/usecases/default_cases/delete_trans_case.rb
313
391
  - lib/eco/api/usecases/default_cases/email_as_id_case.rb
314
392
  - lib/eco/api/usecases/default_cases/hris_case.rb
315
393
  - lib/eco/api/usecases/default_cases/new_email_case.rb
316
394
  - lib/eco/api/usecases/default_cases/new_id_case.rb
317
- - lib/eco/api/usecases/default_cases/recover_db_case.rb
395
+ - lib/eco/api/usecases/default_cases/new_id_case0.rb
396
+ - lib/eco/api/usecases/default_cases/org_data_convert_case.rb
397
+ - lib/eco/api/usecases/default_cases/refresh_abilities_case.rb
318
398
  - lib/eco/api/usecases/default_cases/refresh_case.rb
319
- - lib/eco/api/usecases/default_cases/refresh_presets_case.rb
320
- - lib/eco/api/usecases/default_cases/reinvite_case.rb
321
- - lib/eco/api/usecases/default_cases/remove_account_case.rb
399
+ - lib/eco/api/usecases/default_cases/reinvite_sync_case.rb
400
+ - lib/eco/api/usecases/default_cases/reinvite_trans_case.rb
401
+ - lib/eco/api/usecases/default_cases/remove_account_sync_case.rb
402
+ - lib/eco/api/usecases/default_cases/remove_account_trans_case.rb
322
403
  - lib/eco/api/usecases/default_cases/reset_landing_page_case.rb
404
+ - lib/eco/api/usecases/default_cases/restore_db_case.rb
323
405
  - lib/eco/api/usecases/default_cases/set_default_tag_case.rb
324
406
  - lib/eco/api/usecases/default_cases/set_supervisor_case.rb
325
407
  - lib/eco/api/usecases/default_cases/switch_supervisor_case.rb
@@ -337,15 +419,19 @@ files:
337
419
  - lib/eco/cli.rb
338
420
  - lib/eco/cli/config.rb
339
421
  - lib/eco/cli/config/default.rb
340
- - lib/eco/cli/config/default/filters.rb
341
422
  - lib/eco/cli/config/default/input.rb
423
+ - lib/eco/cli/config/default/input_filters.rb
342
424
  - lib/eco/cli/config/default/options.rb
343
425
  - lib/eco/cli/config/default/people.rb
426
+ - lib/eco/cli/config/default/people_filters.rb
344
427
  - lib/eco/cli/config/default/usecases.rb
345
428
  - lib/eco/cli/config/default/workflow.rb
429
+ - lib/eco/cli/config/filters.rb
430
+ - lib/eco/cli/config/filters/input_filters.rb
431
+ - lib/eco/cli/config/filters/people_filters.rb
432
+ - lib/eco/cli/config/help.rb
346
433
  - lib/eco/cli/config/input.rb
347
434
  - lib/eco/cli/config/options_set.rb
348
- - lib/eco/cli/config/people_filters.rb
349
435
  - lib/eco/cli/config/use_cases.rb
350
436
  - lib/eco/cli/scripting.rb
351
437
  - lib/eco/cli/scripting/args_helpers.rb
@@ -1,175 +0,0 @@
1
- module Eco
2
- module API
3
- class Session
4
- # Set of helpers to do most common tasks
5
- class Task < API::Common::Session::BaseSession
6
- NEWEST_FILE_MODE = [:newest, :last_file, :previous]
7
- LOAD_FILE_MODE = [:file]
8
- SAVE_FILE_MODE = [:save]
9
- API_MODE = [:api, :api_get]
10
-
11
- def file_people(filename = enviro.config.people.cache)
12
- logger.info("Going to get all the people via API")
13
- people = session.batch.get_people
14
- file = file_manager.save_json(people, filename, :timestamp)
15
- logger.info("#{people.length} people loaded and saved locally to #{file}.")
16
- Eco::API::Organization::People.new(people)
17
- end
18
-
19
- def people_refresh(people:, include_created: true)
20
- ini = people.length
21
- if include_created
22
- session.job_groups.find_jobs(type: :create).map do |job|
23
- people = people.merge(job.people)
24
- end
25
- end
26
-
27
- created = people.length - ini
28
- msg = "Going to refresh #{people.length} people with server data"
29
- msg += " (including #{created} that were created)" if created > 0
30
- session.logger.info(msg)
31
- status = session.batch.get_people(people, silent: true)
32
- entries = status.people
33
-
34
- missing = people.length - entries.length
35
- session.logger.error("Missed to obtain #{missing} people during the refresh") if missing > 0
36
-
37
- Eco::API::Organization::People.new(status.people)
38
- end
39
-
40
- def search(data, options: {}, silent: true)
41
- strict_search = session.config.people.strict_search? && (!options[:search]&.key?(:strict) || options.dig(:search, :strict))
42
-
43
- # to scope people to be fresh data got via api
44
- session.logger.info("going to api get #{data.length} entries...")
45
-
46
- status = session.batch.search(data, silent: silent)
47
- people = Eco::API::Organization::People.new(status.people)
48
-
49
- # get the supervisors
50
- supers = people.each_with_object([]) do |person, sup|
51
- if sup_id = person.supervisor_id
52
- spr = {"id" => sup_id}
53
- sup.push(spr) unless sup.include?(spr) || people.person(id: sup_id, external_id: sup_id)
54
- end
55
- end
56
-
57
- if supers.length > 0
58
- session.logger.info("going to api get #{supers.length} current supervisors...")
59
- status = session.batch.search(supers, silent: silent)
60
- people = people.merge(status.people, strict: strict_search)
61
- end
62
-
63
- supers = data.each_with_object([]) do |entry, sup|
64
- if entry.respond_to?(:supervisor_id) && !entry.supervisor_id.to_s.strip.empty?
65
- sup_id = entry.supervisor_id
66
- spr = {"id" => entry.supervisor_id}
67
- sup.push(spr) unless sup.include?(spr) || people.person(id: sup_id, external_id: sup_id)
68
- end
69
- end
70
-
71
- if supers.length > 0
72
- session.logger.info("going to api get #{supers.length} supervisors as per entries...")
73
- status = session.batch.search(supers, silent: silent)
74
- people = people.merge(status.people, strict: strict_search)
75
- end
76
-
77
- session.logger.info("could get #{people.length} people (out of #{data.length} entries)")
78
- people
79
- end
80
-
81
- def load_people(filename = enviro.config.people.cache, modifier: [:newest, :api])
82
- modifier = [modifier].flatten
83
- people = []
84
- case
85
- when !!filename && (load_file?(modifier) || newest_file?(modifier))
86
- case
87
- when newest_file?(modifier)
88
- # search input file based on pattern (in case the name has a timestamp)
89
- file = file_manager.dir.newest_file(file: filename)
90
- logger.info("previous file found: #{file}") if !!file
91
- else
92
- file = file_manager.dir.file(filename)
93
- end
94
-
95
- if !file
96
- logger.error("could not find the file #{file_manager.dir.file(filename)}")
97
- exit if !use_api?(modifier)
98
- people = self.load_people(modifier: modifier - NEWEST_FILE_MODE - LOAD_FILE_MODE)
99
- else
100
- people = file_manager.load_json(file)
101
- if !!people && people.is_a?(Array)
102
- logger.info("#{people&.length} people loaded from file #{file}")
103
- end
104
- end
105
- when use_api?(modifier)
106
- # no previous file: use API to get all people
107
- logger.info("Going to get all the people via API")
108
- people = session.batch.get_people
109
-
110
- if save_file?(modifier) && people && people.length > 0
111
- file = file_manager.save_json(people, filename, :timestamp)
112
- logger.info("#{people.length } people saved to file #{file}.")
113
- end
114
- end
115
- Eco::API::Organization::People.new(people)
116
- end
117
-
118
- def s3upload_targets
119
- [].tap do |paths|
120
- session.config.s3storage.target_files.each_with_object(paths) do |file, arr|
121
- arr.push(session.s3upload(file: file))
122
- end
123
- session.config.s3storage.target_directories.each_with_object(paths) do |folder, arr|
124
- arr.concat(session.s3upload(directory: folder))
125
- end
126
- session.config.s3storage.target_file_patterns.each_with_object(paths) do |pattern, arr|
127
- filenames = []
128
- case pattern
129
- when Regexp
130
- Dir.entries(".").sort.each do |file|
131
- next unless File.file?(file) # Skip directories
132
- filenames.push(file) if file =~ pattern
133
- end
134
- when String
135
- Dir.glob(pattern).sort.each do |file|
136
- next unless File.file?(file) # Skip directories
137
- filenames.push(file)
138
- end
139
- else
140
- # missconfiguration
141
- end
142
- filenames.each do |file|
143
- arr.push(session.s3upload(file: file))
144
- end
145
- end
146
- end
147
- end
148
-
149
- private
150
-
151
- # MODIFIERS
152
- def use_api?(modifier)
153
- modifiers = [modifier].flatten
154
- modifiers.any? { |m| API_MODE.include?(m) }
155
- end
156
-
157
- def load_file?(modifier)
158
- modifiers = [modifier].flatten
159
- modifiers.any? { |m| LOAD_FILE_MODE.include?(m) }
160
- end
161
-
162
- def newest_file?(modifier)
163
- modifiers = [modifier].flatten
164
- modifiers.any? { |m| NEWEST_FILE_MODE.include?(m) }
165
- end
166
-
167
- def save_file?(modifier)
168
- modifiers = [modifier].flatten
169
- modifiers.any? { |m| SAVE_FILE_MODE.include?(m) }
170
- end
171
-
172
- end
173
- end
174
- end
175
- end