eco-helpers 0.6.9 → 0.6.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a4077d63348b8ec7af402d3d9a410392eda90aad
4
- data.tar.gz: 9be53c478c67b022e12e55cc77acca57c592a52e
3
+ metadata.gz: f14a745ec8896dcddd2775565f45079b079e40d1
4
+ data.tar.gz: 51a45079f0b74c451ea491b8e11bd17ec5fea82e
5
5
  SHA512:
6
- metadata.gz: 63beb34156723095b8c3c1a72acf28608f35467defac8f2e97a1c3a7cd97ce9d9e6dec66d60128168544ecc964582fca4c153d944e3d316af96df6659810002e
7
- data.tar.gz: 64f63702ae2330a7ebe7a1a7aa67579c513c56ccf35a4de03019bfca89119345f4639d3625bf1a891d95de563765631959cfed8609efd1a4a4c874b3cc8845e3
6
+ metadata.gz: 1c71d8db59b184279cdf4e038a85226fadc569106d6e38bba79b5fe327144842da40afd92bc3a6e164b44df92dbc551cfaa8919aadb24d6940e4c7b237134406
7
+ data.tar.gz: 7e5c3d4bb4f92e52373efc5d72c749e41e9eb551a8e1c16153f70318e84ec2c9ad42e11ca67dff25e404b5120b2ed2df6d1b73b5635ebe7f1a9f40a59389f828
@@ -0,0 +1,54 @@
1
+ module Eco
2
+ module API
3
+ module UseCases
4
+ class DefaultCases
5
+ class RecoverDBCase < BaseCase
6
+
7
+ def process
8
+ @cases.define("recover-db", type: :sync) do |entries, people, session, options|
9
+ unless entries.is_a?(Eco::API::Organization::People)
10
+ raise "Your input should be an 'Eco::API::Organization::People' object. Got: #{entries.class}"
11
+ end
12
+
13
+ creation = session.job_group("main").new("create", type: :create, sets: [:core, :details, :account])
14
+ update = session.job_group("main").new("update", type: :update, sets: [:core, :details, :account])
15
+ remove = session.job_group("main").new("remove", type: :delete, sets: [:core, :details, :account])
16
+
17
+ pgs = session.policy_groups
18
+
19
+ if options.dig(:include, :delete)
20
+ people.exclude(entries).map {|person| remove.add(person)}
21
+ end
22
+
23
+
24
+ entries.each.with_index do |entry, i|
25
+ create = ! (person = people.find(entry))
26
+
27
+ if create && !options.dig(:include, :create)
28
+ session.logger.error("Entry(#{i}) - this person does not exist: #{entry.email}")
29
+ else
30
+ person = session.new_person if create
31
+
32
+ unless options.dig(:exclude, :core)
33
+ person.external_id = entry.external_id
34
+ person.name = entry.name
35
+ person.email = entry.email unless (options.dig(:exclude, :email))
36
+ person.supervisor_id = entry.supervisor_id
37
+ end
38
+
39
+ person.account = entry.account unless options.dig(:exclude, :account)
40
+ person.details = entry.details unless options.dig(:exclude, :details)
41
+
42
+ creation.add(person) if create
43
+ update.add(person) unless create
44
+ end
45
+ end
46
+ end
47
+ end
48
+
49
+ end
50
+
51
+ end
52
+ end
53
+ end
54
+ end
@@ -25,6 +25,7 @@ module Eco
25
25
  ReinviteCase.new(self).process
26
26
  DeleteCase.new(self).process
27
27
  RemoveAccountCase.new(self).process
28
+ RecoverDBCase.new(self).process
28
29
  RefreshPresets.new(self).process
29
30
  ChangeEMailCase.new(self).process
30
31
  SetDefaultTagCase.new(self).process
@@ -52,7 +53,8 @@ require_relative 'default_cases/create_details_with_supervisor_case'
52
53
  require_relative 'default_cases/reinvite_case'
53
54
  require_relative 'default_cases/delete_case'
54
55
  require_relative 'default_cases/remove_account_case'
55
- require_relative 'default_cases/refresh_presets'
56
+ require_relative 'default_cases/refresh_presets_case'
57
+ require_relative 'default_cases/recover_db_case'
56
58
  require_relative 'default_cases/change_email_case'
57
59
  require_relative 'default_cases/set_default_tag_case'
58
60
  require_relative 'default_cases/create_case'
data/lib/eco/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Eco
2
- VERSION = "0.6.9"
2
+ VERSION = "0.6.11"
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: 0.6.9
4
+ version: 0.6.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Segura
@@ -287,7 +287,8 @@ files:
287
287
  - lib/eco/api/usecases/default_cases/hris_case.rb
288
288
  - lib/eco/api/usecases/default_cases/new_email_case.rb
289
289
  - lib/eco/api/usecases/default_cases/new_id_case.rb
290
- - lib/eco/api/usecases/default_cases/refresh_presets.rb
290
+ - lib/eco/api/usecases/default_cases/recover_db_case.rb
291
+ - lib/eco/api/usecases/default_cases/refresh_presets_case.rb
291
292
  - lib/eco/api/usecases/default_cases/reinvite_case.rb
292
293
  - lib/eco/api/usecases/default_cases/remove_account_case.rb
293
294
  - lib/eco/api/usecases/default_cases/reset_landing_page_case.rb