eco-helpers 1.5.1 → 1.5.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (176) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +114 -2
  3. data/LICENSE +21 -0
  4. data/eco-helpers.gemspec +1 -1
  5. data/lib/eco/api.rb +2 -0
  6. data/lib/eco/api/common.rb +4 -0
  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 +3 -12
  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 +15 -25
  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 +24 -35
  26. data/lib/eco/api/common/people/default_parsers/send_invites_parser.rb +15 -25
  27. data/lib/eco/api/common/people/entries.rb +54 -24
  28. data/lib/eco/api/common/people/entry_factory.rb +10 -8
  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 +3 -2
  32. data/lib/eco/api/common/people/person_parser.rb +51 -18
  33. data/lib/eco/api/common/session/logger.rb +4 -0
  34. data/lib/eco/api/common/version_patches.rb +1 -0
  35. data/lib/eco/api/common/version_patches/ecoportal_api/external_person.rb +2 -0
  36. data/lib/eco/api/common/version_patches/ecoportal_api/internal_person.rb +1 -1
  37. data/lib/eco/api/common/version_patches/exception.rb +22 -0
  38. data/lib/eco/api/common/version_patches/object.rb +10 -0
  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 +17 -13
  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 +4 -4
  51. data/lib/eco/api/microcases/{set_default_group.rb → fix_default_group.rb} +10 -9
  52. data/lib/eco/api/microcases/fix_filter_tags.rb +26 -6
  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 +7 -19
  61. data/lib/eco/api/microcases/set_core.rb +5 -5
  62. data/lib/eco/api/microcases/set_core_with_supervisor.rb +23 -0
  63. data/lib/eco/api/microcases/set_supervisor.rb +17 -13
  64. data/lib/eco/api/microcases/strict_search.rb +12 -7
  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/policies.rb +11 -7
  74. data/lib/eco/api/session.rb +54 -24
  75. data/lib/eco/api/session/batch.rb +1 -1
  76. data/lib/eco/api/session/batch/base_policy.rb +7 -6
  77. data/lib/eco/api/session/batch/errors.rb +28 -4
  78. data/lib/eco/api/session/batch/feedback.rb +7 -1
  79. data/lib/eco/api/session/batch/job.rb +40 -23
  80. data/lib/eco/api/session/batch/jobs.rb +9 -4
  81. data/lib/eco/api/session/batch/jobs_groups.rb +1 -1
  82. data/lib/eco/api/session/batch/request_stats.rb +95 -58
  83. data/lib/eco/api/session/batch/status.rb +35 -31
  84. data/lib/eco/api/session/config.rb +104 -42
  85. data/lib/eco/api/session/config/api.rb +17 -6
  86. data/lib/eco/api/session/config/logger.rb +2 -2
  87. data/lib/eco/api/session/config/post_launch.rb +1 -1
  88. data/lib/eco/api/session/config/workflow.rb +8 -7
  89. data/lib/eco/api/usecases.rb +47 -33
  90. data/lib/eco/api/usecases/backup/append_usergroups_case.rb +36 -0
  91. data/lib/eco/api/usecases/backup/create_case.rb +104 -0
  92. data/lib/eco/api/usecases/backup/create_details_case.rb +31 -0
  93. data/lib/eco/api/usecases/backup/create_details_with_supervisor_case.rb +48 -0
  94. data/lib/eco/api/usecases/backup/hris_case.rb +124 -0
  95. data/lib/eco/api/usecases/backup/set_default_tag_case.rb +49 -0
  96. data/lib/eco/api/usecases/backup/set_supervisor_case.rb +41 -0
  97. data/lib/eco/api/usecases/backup/transfer_account_case.rb +90 -0
  98. data/lib/eco/api/usecases/backup/update_case.rb +112 -0
  99. data/lib/eco/api/usecases/backup/update_details_case.rb +64 -0
  100. data/lib/eco/api/usecases/backup/upsert_case.rb +114 -0
  101. data/lib/eco/api/usecases/base_case.rb +2 -0
  102. data/lib/eco/api/usecases/base_io.rb +3 -3
  103. data/lib/eco/api/usecases/default_cases.rb +23 -53
  104. data/lib/eco/api/usecases/default_cases/append_usergroups_case.rb +10 -31
  105. data/lib/eco/api/usecases/default_cases/change_email_case.rb +23 -47
  106. data/lib/eco/api/usecases/default_cases/codes_to_tags_case.rb +56 -43
  107. data/lib/eco/api/usecases/default_cases/create_case.rb +15 -101
  108. data/lib/eco/api/usecases/default_cases/create_details_case.rb +11 -26
  109. data/lib/eco/api/usecases/default_cases/create_details_with_supervisor_case.rb +12 -43
  110. data/lib/eco/api/usecases/default_cases/delete_sync_case.rb +11 -0
  111. data/lib/eco/api/usecases/default_cases/delete_trans_case.rb +14 -0
  112. data/lib/eco/api/usecases/default_cases/email_as_id_case.rb +10 -21
  113. data/lib/eco/api/usecases/default_cases/hris_case.rb +23 -120
  114. data/lib/eco/api/usecases/default_cases/new_email_case.rb +10 -23
  115. data/lib/eco/api/usecases/default_cases/new_id_case.rb +11 -25
  116. data/lib/eco/api/usecases/default_cases/new_id_case0.rb +14 -0
  117. data/lib/eco/api/usecases/default_cases/org_data_convert_case.rb +101 -0
  118. data/lib/eco/api/usecases/default_cases/refresh_abilities_case.rb +30 -0
  119. data/lib/eco/api/usecases/default_cases/refresh_case.rb +7 -20
  120. data/lib/eco/api/usecases/default_cases/reinvite_sync_case.rb +11 -0
  121. data/lib/eco/api/usecases/default_cases/reinvite_trans_case.rb +17 -0
  122. data/lib/eco/api/usecases/default_cases/remove_account_sync_case.rb +11 -0
  123. data/lib/eco/api/usecases/default_cases/remove_account_trans_case.rb +17 -0
  124. data/lib/eco/api/usecases/default_cases/reset_landing_page_case.rb +9 -19
  125. data/lib/eco/api/usecases/default_cases/restore_db_case.rb +104 -0
  126. data/lib/eco/api/usecases/default_cases/set_default_tag_case.rb +32 -40
  127. data/lib/eco/api/usecases/default_cases/set_supervisor_case.rb +15 -33
  128. data/lib/eco/api/usecases/default_cases/switch_supervisor_case.rb +66 -57
  129. data/lib/eco/api/usecases/default_cases/to_csv_case.rb +36 -44
  130. data/lib/eco/api/usecases/default_cases/to_csv_detailed_case.rb +40 -55
  131. data/lib/eco/api/usecases/default_cases/transfer_account_case.rb +264 -84
  132. data/lib/eco/api/usecases/default_cases/update_case.rb +15 -109
  133. data/lib/eco/api/usecases/default_cases/update_details_case.rb +14 -61
  134. data/lib/eco/api/usecases/default_cases/upsert_case.rb +16 -111
  135. data/lib/eco/api/usecases/use_case.rb +1 -1
  136. data/lib/eco/api/usecases/use_case_io.rb +9 -10
  137. data/lib/eco/cli/config.rb +10 -2
  138. data/lib/eco/cli/config/default.rb +2 -1
  139. data/lib/eco/cli/config/default/input_filters.rb +58 -0
  140. data/lib/eco/cli/config/default/options.rb +60 -25
  141. data/lib/eco/cli/config/default/people.rb +4 -4
  142. data/lib/eco/cli/config/default/people_filters.rb +108 -0
  143. data/lib/eco/cli/config/default/usecases.rb +89 -31
  144. data/lib/eco/cli/config/default/workflow.rb +37 -27
  145. data/lib/eco/cli/config/filters.rb +50 -0
  146. data/lib/eco/cli/config/filters/input_filters.rb +29 -0
  147. data/lib/eco/cli/config/filters/people_filters.rb +29 -0
  148. data/lib/eco/cli/config/help.rb +49 -0
  149. data/lib/eco/cli/config/options_set.rb +17 -1
  150. data/lib/eco/cli/config/use_cases.rb +79 -53
  151. data/lib/eco/cli/scripting.rb +10 -2
  152. data/lib/eco/cli/scripting/args_helpers.rb +25 -15
  153. data/lib/eco/cli/scripting/argument.rb +1 -0
  154. data/lib/eco/cli/scripting/arguments.rb +1 -1
  155. data/lib/eco/csv/table.rb +1 -1
  156. data/lib/eco/data/crypto/encryption.rb +3 -0
  157. data/lib/eco/language/match.rb +19 -9
  158. data/lib/eco/language/match_modifier.rb +13 -5
  159. data/lib/eco/language/models/collection.rb +77 -56
  160. data/lib/eco/language/models/parser_serializer.rb +39 -15
  161. data/lib/eco/version.rb +1 -1
  162. metadata +64 -18
  163. data/lib/eco/api/microcases/set_default_tag.rb +0 -23
  164. data/lib/eco/api/session/task.rb +0 -175
  165. data/lib/eco/api/usecases/default_case.rb +0 -19
  166. data/lib/eco/api/usecases/default_cases/delete_case.rb +0 -32
  167. data/lib/eco/api/usecases/default_cases/recover_db_case.rb +0 -99
  168. data/lib/eco/api/usecases/default_cases/refresh_presets_case.rb +0 -26
  169. data/lib/eco/api/usecases/default_cases/reinvite_case.rb +0 -41
  170. data/lib/eco/api/usecases/default_cases/remove_account_case.rb +0 -38
  171. data/lib/eco/api/usecases/microed_cases/hris_case.rb +0 -53
  172. data/lib/eco/api/usecases/microed_cases/update_case.rb +0 -33
  173. data/lib/eco/api/usecases/microed_cases/update_details_case.rb +0 -30
  174. data/lib/eco/api/usecases/microed_cases/upsert_case.rb +0 -36
  175. data/lib/eco/cli/config/default/filters.rb +0 -70
  176. data/lib/eco/cli/config/people_filters.rb +0 -38
@@ -1,38 +0,0 @@
1
- module Eco
2
- class CLI
3
- class Config
4
- class PeopleFilters
5
- attr_reader :core_config
6
-
7
- def initialize(core_config:)
8
- @core_config = core_config
9
- @filters = {}
10
- end
11
-
12
- def add(option)
13
- raise "Missing block to define the filters builder" unless block_given?
14
- callback = Proc.new
15
- [option].flatten.compact.each do |opt|
16
- @filters[opt] = callback
17
- end
18
- self
19
- end
20
-
21
- def process(io:)
22
- unless io && io.is_a?(Eco::API::UseCases::BaseIO)
23
- raise "You need to provide Eco::API::UseCases::BaseIO object. Given: #{io.class}"
24
- end
25
-
26
- io = io.new(type: :transform)
27
- @filters.each do |arg, callback|
28
- if SCR.get_arg(arg)
29
- io = io.new(people: callback.call(*io.params))
30
- end
31
- end
32
- io.people
33
- end
34
-
35
- end
36
- end
37
- end
38
- end