eco-helpers 2.7.11 → 2.7.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (25) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -3
  3. data/lib/eco/api/usecases/default/people/{clean_unknown_tags_case.rb → amend/clean_unknown_tags_case.rb} +2 -2
  4. data/lib/eco/api/usecases/default/people/{clear_abilities_case.rb → amend/clear_abilities_case.rb} +2 -2
  5. data/lib/eco/api/usecases/default/people/{refresh_case.rb → amend/refresh_case.rb} +1 -1
  6. data/lib/eco/api/usecases/default/people/amend/reinvite_sync_case.rb +11 -0
  7. data/lib/eco/api/usecases/default/people/{reinvite_trans_case.rb → amend/reinvite_trans_case.rb} +2 -2
  8. data/lib/eco/api/usecases/default/people/amend/reinvite_trans_cli.rb +4 -0
  9. data/lib/eco/api/usecases/default/people/{restore_db_case.rb → amend/restore_db_case.rb} +1 -1
  10. data/lib/eco/api/usecases/default/people/amend.rb +11 -0
  11. data/lib/eco/api/usecases/default/people/{analyse_people_case.rb → treat/analyse_people_case.rb} +1 -1
  12. data/lib/eco/api/usecases/default/people/{org_data_convert_case.rb → treat/org_data_convert_case.rb} +1 -1
  13. data/lib/eco/api/usecases/default/people/{supers_cyclic_identify_case.rb → treat/supers_cyclic_identify_case.rb} +2 -2
  14. data/lib/eco/api/usecases/default/people/{supers_hierarchy_case.rb → treat/supers_hierarchy_case.rb} +18 -17
  15. data/lib/eco/api/usecases/default/people/treat.rb +9 -0
  16. data/lib/eco/api/usecases/default/people/{change_email_case.rb → utils/change_email_case.rb} +1 -1
  17. data/lib/eco/api/usecases/default/people/{set_default_tag_case.rb → utils/set_default_tag_case.rb} +1 -1
  18. data/lib/eco/api/usecases/default/people/{switch_supervisor_case.rb → utils/switch_supervisor_case.rb} +1 -1
  19. data/lib/eco/api/usecases/default/people/{transfer_account_case.rb → utils/transfer_account_case.rb} +1 -1
  20. data/lib/eco/api/usecases/default/people/utils.rb +9 -0
  21. data/lib/eco/api/usecases/default/people.rb +4 -14
  22. data/lib/eco/version.rb +1 -1
  23. metadata +19 -16
  24. data/lib/eco/api/usecases/default/people/reinvite_sync_case.rb +0 -9
  25. data/lib/eco/api/usecases/default/people/reinvite_trans_cli.rb +0 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e3c92964baf09be5673e74f4a1762d03ce0efe159e7d6a2bc6da3839ac99f4f0
4
- data.tar.gz: 26525ccfbdbb06f348d293a50a02de644f7a0a32f3f5285537c75d8d14fe3601
3
+ metadata.gz: 5d3edc9e39edaf452a269851133444e67a2c743cfa8f787723106022eb3694b1
4
+ data.tar.gz: 28f0547c71389caa7fbf2a416d52a3cc64fa191610040e3484243612cd53e523
5
5
  SHA512:
6
- metadata.gz: 7620a74731fbfc7d17d1b21f7930df4753003a919fa9d79550083002f454c57716cceab6afec8738d9a37e5b2cd749cd42541f0913286d66c1387b7b88b27c5e
7
- data.tar.gz: 1db57df2c9a4b8e5863580524d34e655c92d5e4ddd15e6a8cacbe8b9e9e8af73ae2d3fb05fd1f4dc6de119c2ee5e20b3971b234c073910153aec5137807ef37b
6
+ metadata.gz: fc3bee60f32f2c1d16c6a4f6901d9a50f8bdb8b01134f0040fbedbee8c36b7315e424f0e16c1da9ddf6a8b635b21ec0fcff6954143ee102a44ca51048d36a2ff
7
+ data.tar.gz: fa238d1c36f0deb74d94de407c06c29e75567073a289e8939ec6280362a367785a614fa99f37de1d13b63e35d5eee7fa51e3a02c84ed2aa8dec5fdfdbbf1bc7e
data/CHANGELOG.md CHANGED
@@ -2,17 +2,25 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
4
 
5
- ## [2.7.11] - 2024-05-xx
5
+ ## [2.7.13] - 2024-05-xx
6
6
 
7
7
  ### Added
8
+ ### Changed
9
+ ### Fixed
10
+
11
+ ## [2.7.12] - 2024-05-30
12
+
13
+ ### Changed
14
+ - Decouple `Eco::API::UseCases::Default::People` namespace
15
+
16
+ ## [2.7.11] - 2024-05-27
17
+
8
18
  ### Changed\
9
19
  - `Eco::API::Common::Session::SFTP#download`
10
20
  - It now returns the local filename(s) of the downloaded files.
11
21
  - `Eco::API::UseCases::GraphQL::Utils#sftp_download_files`
12
22
  - It now returns the local filename(s) of the downloaded files.
13
23
 
14
- ### Fixed
15
-
16
24
  ## [2.7.10] - 2024-05-20
17
25
 
18
26
  ### Changed
@@ -1,4 +1,4 @@
1
- class Eco::API::UseCases::Default::People::CleanUnknownTags < Eco::API::Common::Loaders::UseCase
1
+ class Eco::API::UseCases::Default::People::Amend::CleanUnknownTags < Eco::API::Common::Loaders::UseCase
2
2
  name "clean-unknown-tags"
3
3
  type :transform
4
4
 
@@ -35,7 +35,7 @@ class Eco::API::UseCases::Default::People::CleanUnknownTags < Eco::API::Common::
35
35
  private
36
36
 
37
37
  def default_tag(person)
38
- return nil unless account = person.account
38
+ return unless (account = person.account)
39
39
  account.default_tag
40
40
  end
41
41
 
@@ -1,8 +1,8 @@
1
- class Eco::API::UseCases::Default::People::ClearAbilitiesTransCase < Eco::API::Common::Loaders::UseCase
1
+ class Eco::API::UseCases::Default::People::Amend::ClearAbilitiesTransCase < Eco::API::Common::Loaders::UseCase
2
2
  name "clear-abilities"
3
3
  type :transform
4
4
 
5
- def main(people, _session, _options, _usecase)
5
+ def main(*_args)
6
6
  clear_abilities(people.users)
7
7
  end
8
8
 
@@ -1,4 +1,4 @@
1
- class Eco::API::UseCases::Default::People::RefreshCase < Eco::API::Common::Loaders::UseCase
1
+ class Eco::API::UseCases::Default::People::Amend::RefreshCase < Eco::API::Common::Loaders::UseCase
2
2
  name "refresh"
3
3
  type :transform
4
4
 
@@ -0,0 +1,11 @@
1
+ module Eco::API::UseCases::Default::People::Amend
2
+ class ReinviteSyncCase < ReinviteTransCase
3
+ name "reinvite"
4
+ type :sync
5
+
6
+ def main(entries, *_args)
7
+ found = micro.with_each_present(entries, people, options, log_starter: true)
8
+ reinvite(found.users)
9
+ end
10
+ end
11
+ end
@@ -1,8 +1,8 @@
1
- class Eco::API::UseCases::Default::People::ReinviteTransCase < Eco::API::Common::Loaders::UseCase
1
+ class Eco::API::UseCases::Default::People::Amend::ReinviteTransCase < Eco::API::Common::Loaders::UseCase
2
2
  name "reinvite"
3
3
  type :transform
4
4
 
5
- def main(people, session, options, usecase)
5
+ def main(*_args)
6
6
  reinvite(people.users)
7
7
  end
8
8
 
@@ -0,0 +1,4 @@
1
+ class Eco::API::UseCases::Default::People::Amend::ReinviteTransCase
2
+ class Cli < Eco::API::UseCases::Cli
3
+ end
4
+ end
@@ -1,6 +1,6 @@
1
1
  # @example
2
2
  # -restore-db-from backup.json -skip-api-policies -skip-batch-policy -include-excluded -simulate
3
- class Eco::API::UseCases::Default::People::RestoreDBCase < Eco::API::Common::Loaders::UseCase
3
+ class Eco::API::UseCases::Default::People::Amend::RestoreDBCase < Eco::API::Common::Loaders::UseCase
4
4
  name "restore-db"
5
5
  type :sync
6
6
 
@@ -0,0 +1,11 @@
1
+ module Eco::API::UseCases::Default::People
2
+ module Amend
3
+ end
4
+ end
5
+
6
+ require_relative 'amend/clean_unknown_tags_case'
7
+ require_relative 'amend/clear_abilities_case'
8
+ require_relative 'amend/reinvite_trans_case'
9
+ require_relative 'amend/reinvite_sync_case'
10
+ require_relative 'amend/refresh_case'
11
+ require_relative 'amend/restore_db_case'
@@ -1,4 +1,4 @@
1
- class Eco::API::UseCases::Default::People::Analyse < Eco::API::Common::Loaders::UseCase
1
+ class Eco::API::UseCases::Default::People::Treat::Analyse < Eco::API::Common::Loaders::UseCase
2
2
  name "analyse-people"
3
3
  type :export
4
4
 
@@ -1,4 +1,4 @@
1
- class Eco::API::UseCases::Default::People::OrgDataConvertCase < Eco::API::Common::Loaders::UseCase
1
+ class Eco::API::UseCases::Default::People::Treat::OrgDataConvertCase < Eco::API::Common::Loaders::UseCase
2
2
  name "org-data-convert"
3
3
  type :import
4
4
 
@@ -1,4 +1,4 @@
1
- class Eco::API::UseCases::Default::People::SupersCyclicIdentify < Eco::API::Common::Loaders::UseCase
1
+ class Eco::API::UseCases::Default::People::Treat::SupersCyclicIdentify < Eco::API::Common::Loaders::UseCase
2
2
  name "identify-cyclic-supers"
3
3
  type :export
4
4
 
@@ -62,7 +62,7 @@ class Eco::API::UseCases::Default::People::SupersCyclicIdentify < Eco::API::Comm
62
62
 
63
63
  "".tap do |str|
64
64
  entry = set.shift
65
- str << " " * lev
65
+ str << (" " * lev)
66
66
  str << lev&.positive? ? "+-#{lev}- " : ""
67
67
  str << entry.name
68
68
  str << " (#{entry.external_id}|#{entry.email}|#{entry.id})\n"
@@ -1,10 +1,10 @@
1
- class Eco::API::UseCases::Default::People::SupersHierarchy < Eco::API::Common::Loaders::UseCase
1
+ class Eco::API::UseCases::Default::People::Treat::SupersHierarchy < Eco::API::Common::Loaders::UseCase
2
2
  name "supers-hierarchy"
3
3
  type :export
4
4
 
5
5
  attr_reader :people
6
6
 
7
- def main(people, session, options, usecase)
7
+ def main(people, _session, options, _usecase)
8
8
  options[:end_get] = false
9
9
  @people = people
10
10
 
@@ -22,20 +22,19 @@ class Eco::API::UseCases::Default::People::SupersHierarchy < Eco::API::Common::L
22
22
  end
23
23
 
24
24
  def save!(data)
25
- ext = File.extname(file).downcase.delete(".")
26
-
27
- File.open(file, "w") do |fd|
28
- if ext == "txt"
29
- create_file(data, file: file, format: :txt)
30
- elsif ext == "html"
31
- puts "html is still not supported"
32
- exit(1)
33
- create_file(data, file: file, format: :html)
34
- elsif ext == "json"
35
- puts "json is still not supported"
36
- exit(1)
37
- create_file(data, file: file, format: :json)
38
- end
25
+ ext = File.extname(file).downcase.delete(".")
26
+
27
+ case ext
28
+ when "txt"
29
+ create_file(data, file: file, format: :txt)
30
+ when "html"
31
+ puts "html is still not supported"
32
+ exit(1)
33
+ # create_file(data, file: file, format: :html)
34
+ when "json"
35
+ puts "json is still not supported"
36
+ exit(1)
37
+ # create_file(data, file: file, format: :json)
39
38
  end
40
39
  end
41
40
 
@@ -50,7 +49,9 @@ class Eco::API::UseCases::Default::People::SupersHierarchy < Eco::API::Common::L
50
49
  raise "Required Hash tree structure. Given: #{tree.class}" unless tree.is_a?(Hash)
51
50
  "".tap do |str|
52
51
  tree.each do |entry, subtree|
53
- str << "#{" " * lev}#{(lev > 0)? "+-#{lev}- " : ""}#{entry.name} (#{entry.external_id}|#{entry.email}|#{entry.id})\n"
52
+ str << "#{" " * lev}#{lev.positive? ? "+-#{lev}- " : ""}"
53
+ str << entry.name
54
+ str << " (#{entry.external_id}|#{entry.email}|#{entry.id})\n"
54
55
  str << tree_to_str(subtree, lev: lev + 1, format: format) unless !subtree || subtree.empty?
55
56
  end
56
57
  end
@@ -0,0 +1,9 @@
1
+ module Eco::API::UseCases::Default::People
2
+ module Treat
3
+ end
4
+ end
5
+
6
+ require_relative 'treat/analyse_people_case'
7
+ require_relative 'treat/supers_hierarchy_case'
8
+ require_relative 'treat/supers_cyclic_identify_case'
9
+ require_relative 'treat/org_data_convert_case'
@@ -1,4 +1,4 @@
1
- class Eco::API::UseCases::Default::People::ChangeEMailCase < Eco::API::Common::Loaders::UseCase
1
+ class Eco::API::UseCases::Default::People::Utils::ChangeEMailCase < Eco::API::Common::Loaders::UseCase
2
2
  name "change-email"
3
3
  type :sync
4
4
 
@@ -1,4 +1,4 @@
1
- class Eco::API::UseCases::Default::People::SetDefaultTagCase < Eco::API::Common::Loaders::UseCase
1
+ class Eco::API::UseCases::Default::People::Utils::SetDefaultTagCase < Eco::API::Common::Loaders::UseCase
2
2
  name "set-default-tag"
3
3
  type :transform
4
4
 
@@ -1,4 +1,4 @@
1
- class Eco::API::UseCases::Default::People::SwitchSupervisorCase < Eco::API::Common::Loaders::UseCase
1
+ class Eco::API::UseCases::Default::People::Utils::SwitchSupervisorCase < Eco::API::Common::Loaders::UseCase
2
2
  name "switch-supervisor"
3
3
  type :transform
4
4
 
@@ -1,4 +1,4 @@
1
- class Eco::API::UseCases::Default::People::TransferAccountCase < Eco::API::Common::Loaders::UseCase
1
+ class Eco::API::UseCases::Default::People::Utils::TransferAccountCase < Eco::API::Common::Loaders::UseCase
2
2
  name "transfer-account"
3
3
  type :sync
4
4
 
@@ -0,0 +1,9 @@
1
+ module Eco::API::UseCases::Default::People
2
+ module Utils
3
+ end
4
+ end
5
+
6
+ require_relative 'utils/change_email_case'
7
+ require_relative 'utils/set_default_tag_case'
8
+ require_relative 'utils/switch_supervisor_case'
9
+ require_relative 'utils/transfer_account_case'
@@ -9,17 +9,7 @@ module Eco
9
9
  end
10
10
  end
11
11
 
12
- require_relative 'people/analyse_people_case'
13
- require_relative 'people/change_email_case'
14
- require_relative 'people/clean_unknown_tags_case'
15
- require_relative 'people/clear_abilities_case'
16
- require_relative 'people/reinvite_trans_case'
17
- require_relative 'people/reinvite_sync_case'
18
- require_relative 'people/org_data_convert_case'
19
- require_relative 'people/refresh_case'
20
- require_relative 'people/restore_db_case'
21
- require_relative 'people/set_default_tag_case'
22
- require_relative 'people/supers_hierarchy_case'
23
- require_relative 'people/supers_cyclic_identify_case'
24
- require_relative 'people/switch_supervisor_case'
25
- require_relative 'people/transfer_account_case'
12
+ require_relative 'people/treat'
13
+ require_relative 'people/utils'
14
+ require_relative 'people/amend'
15
+
data/lib/eco/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Eco
2
- VERSION = '2.7.11'.freeze
2
+ VERSION = '2.7.12'.freeze
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: 2.7.11
4
+ version: 2.7.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Segura
@@ -673,21 +673,24 @@ files:
673
673
  - lib/eco/api/usecases/default/locations/tagtree_extract_case.rb
674
674
  - lib/eco/api/usecases/default/locations/tagtree_upload_case.rb
675
675
  - lib/eco/api/usecases/default/people.rb
676
- - lib/eco/api/usecases/default/people/analyse_people_case.rb
677
- - lib/eco/api/usecases/default/people/change_email_case.rb
678
- - lib/eco/api/usecases/default/people/clean_unknown_tags_case.rb
679
- - lib/eco/api/usecases/default/people/clear_abilities_case.rb
680
- - lib/eco/api/usecases/default/people/org_data_convert_case.rb
681
- - lib/eco/api/usecases/default/people/refresh_case.rb
682
- - lib/eco/api/usecases/default/people/reinvite_sync_case.rb
683
- - lib/eco/api/usecases/default/people/reinvite_trans_case.rb
684
- - lib/eco/api/usecases/default/people/reinvite_trans_cli.rb
685
- - lib/eco/api/usecases/default/people/restore_db_case.rb
686
- - lib/eco/api/usecases/default/people/set_default_tag_case.rb
687
- - lib/eco/api/usecases/default/people/supers_cyclic_identify_case.rb
688
- - lib/eco/api/usecases/default/people/supers_hierarchy_case.rb
689
- - lib/eco/api/usecases/default/people/switch_supervisor_case.rb
690
- - lib/eco/api/usecases/default/people/transfer_account_case.rb
676
+ - lib/eco/api/usecases/default/people/amend.rb
677
+ - lib/eco/api/usecases/default/people/amend/clean_unknown_tags_case.rb
678
+ - lib/eco/api/usecases/default/people/amend/clear_abilities_case.rb
679
+ - lib/eco/api/usecases/default/people/amend/refresh_case.rb
680
+ - lib/eco/api/usecases/default/people/amend/reinvite_sync_case.rb
681
+ - lib/eco/api/usecases/default/people/amend/reinvite_trans_case.rb
682
+ - lib/eco/api/usecases/default/people/amend/reinvite_trans_cli.rb
683
+ - lib/eco/api/usecases/default/people/amend/restore_db_case.rb
684
+ - lib/eco/api/usecases/default/people/treat.rb
685
+ - lib/eco/api/usecases/default/people/treat/analyse_people_case.rb
686
+ - lib/eco/api/usecases/default/people/treat/org_data_convert_case.rb
687
+ - lib/eco/api/usecases/default/people/treat/supers_cyclic_identify_case.rb
688
+ - lib/eco/api/usecases/default/people/treat/supers_hierarchy_case.rb
689
+ - lib/eco/api/usecases/default/people/utils.rb
690
+ - lib/eco/api/usecases/default/people/utils/change_email_case.rb
691
+ - lib/eco/api/usecases/default/people/utils/set_default_tag_case.rb
692
+ - lib/eco/api/usecases/default/people/utils/switch_supervisor_case.rb
693
+ - lib/eco/api/usecases/default/people/utils/transfer_account_case.rb
691
694
  - lib/eco/api/usecases/default_cases.rb
692
695
  - lib/eco/api/usecases/default_cases/create_case.rb
693
696
  - lib/eco/api/usecases/default_cases/delete_sync_case.rb
@@ -1,9 +0,0 @@
1
- class Eco::API::UseCases::Default::People::ReinviteSyncCase < Eco::API::UseCases::Default::People::ReinviteTransCase
2
- name "reinvite"
3
- type :sync
4
-
5
- def main(entries, people, session, options, usecase)
6
- found = micro.with_each_present(entries, people, options, log_starter: true)
7
- reinvite(found.users)
8
- end
9
- end
@@ -1,4 +0,0 @@
1
- class Eco::API::UseCases::Default::People::ReinviteTransCase
2
- class Cli < Eco::API::UseCases::Cli
3
- end
4
- end