peoplegroup-connectors 0.1.82 → 0.1.83
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cca763ed8852ce618ef4c82006488515f46a562ab9ec1b286a84391dfa3c4565
|
4
|
+
data.tar.gz: 0a433378f060adb81dbfb5dc4d27260ba16c61206a6fd29d182091ed3709f6b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2af490e0c3e0d8156ba79a8e99e0e06a04308f0bb9fd499bea7650b2067e7b5174e161f310c7825ed5cd4a2bba47cca3c1dfe63b33f661823c96492d90118955
|
7
|
+
data.tar.gz: 14ceec93579b4370fd7eb6189ce2ebba9ace211ab98798ce2841b311605c57996c4139d2ee4b76f4e3e1ed6df97c7443102bb1ab774a473ca4f08553649060d4
|
@@ -4,6 +4,8 @@
|
|
4
4
|
module PeopleGroup
|
5
5
|
module Connectors
|
6
6
|
class Hris
|
7
|
+
EmployeeNotFoundError = Class.new(StandardError)
|
8
|
+
|
7
9
|
def initialize
|
8
10
|
@workday = Workday.new
|
9
11
|
end
|
@@ -12,10 +14,35 @@ module PeopleGroup
|
|
12
14
|
@workday.workers.map { |worker| format_worker(worker) }
|
13
15
|
end
|
14
16
|
|
17
|
+
def get_employee_details(id)
|
18
|
+
employees.find { |emp| emp['id'] == id.to_s }
|
19
|
+
end
|
20
|
+
alias_method :get_team_member_details, :get_employee_details
|
21
|
+
|
22
|
+
def get_employee_details!(id)
|
23
|
+
employee_details = get_employee_details(id)
|
24
|
+
raise EmployeeNotFoundError, "No employee found with id #{id}" if employee_details.nil?
|
25
|
+
|
26
|
+
employee_details
|
27
|
+
end
|
28
|
+
|
29
|
+
def get_employee(id)
|
30
|
+
format_worker(@workday.get_worker(id))
|
31
|
+
end
|
32
|
+
|
33
|
+
def get_employee!(id)
|
34
|
+
employee = get_employee(id)
|
35
|
+
raise EmployeeNotFoundError, "No employee found with id #{id}" if employee.nil?
|
36
|
+
|
37
|
+
employee
|
38
|
+
end
|
39
|
+
|
15
40
|
private
|
16
41
|
|
17
42
|
# Convert Workday worker to BambooHR employee
|
18
43
|
def format_worker(worker)
|
44
|
+
return nil if worker.nil?
|
45
|
+
|
19
46
|
{
|
20
47
|
'id' => worker.dig(:worker_data, :worker_id),
|
21
48
|
'firstName' => worker.dig(:worker_data, :personal_data, :name_data, :legal_name_data, :name_detail_data, :first_name),
|
@@ -42,6 +42,31 @@ module PeopleGroup
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
+
def get_worker(id)
|
46
|
+
message = {
|
47
|
+
'wd:Request_References' => {
|
48
|
+
'wd:Worker_Reference' => {
|
49
|
+
'wd:ID' => id,
|
50
|
+
attributes!: {
|
51
|
+
'wd:ID' => {
|
52
|
+
'wd:type' => 'Employee_ID'
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}
|
56
|
+
},
|
57
|
+
attributes!: {
|
58
|
+
'wd:Request_References' => {
|
59
|
+
'wd:Skip_Non_Existing_Instances' => 'true',
|
60
|
+
'wd:Ignore_Invalid_References' => 'true'
|
61
|
+
}
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
retry_on_error do
|
66
|
+
auto_paginated_call(:get_workers, { message_tag: 'wd:Get_Workers_Request', message: message, attributes: attributes })
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
45
70
|
private
|
46
71
|
|
47
72
|
def retry_on_error(&block)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: peoplegroup-connectors
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.83
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- lien van den steen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-12-
|
11
|
+
date: 2021-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gitlab
|