peoplegroup-connectors 0.1.30 → 0.1.35
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: a25f593d76b85e7532fb74e0632837615afd293b5c71a8b15c8aba8c4d5aa62d
|
4
|
+
data.tar.gz: b3c761fab0a3a61a323b0d955fe9bdf07d74ac8588efa1ff52633f2f204c2689
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6aa52434151d5f2b944eeb138e5c2c8686d8b11e22b7bf28b532df5b0ea1b85493e52e589b4036795ea5f93805d9fcba0d6000f739e669d024217e2d68c5c80e
|
7
|
+
data.tar.gz: 29dc6122c7f7c8c5bc48a9cc1f3aa79565b46b98f0d2139b3709e69ab037ab54a5dba648b626bf08d484eb3ccbaff476942d6b63d7d702f6e46cf179699436ff
|
@@ -7,7 +7,8 @@ module PeopleGroup
|
|
7
7
|
class Bamboo
|
8
8
|
MAX_RETRIES = 3
|
9
9
|
|
10
|
-
def initialize
|
10
|
+
def initialize(use_report: false)
|
11
|
+
@use_report = use_report
|
11
12
|
@client = Bamboozled.client(subdomain: 'gitlab', api_key: ENV['BAMBOO_API_KEY'])
|
12
13
|
end
|
13
14
|
|
@@ -39,10 +40,24 @@ module PeopleGroup
|
|
39
40
|
end
|
40
41
|
alias_method :search_team_member_by_field, :search_employee_by_field
|
41
42
|
|
43
|
+
def slack_email_lookup_with_fallback(email)
|
44
|
+
file_path = File.join(__dir__, '../../../data/email_mapper.yml')
|
45
|
+
email_mapper = YAML.load_file(file_path)
|
46
|
+
email_hit = email_mapper.find { |mapping| mapping['slack_email'] == email.delete_suffix('@gitlab.com') }
|
47
|
+
email = "#{email_hit['bamboo_email']}@gitlab.com" if email_hit
|
48
|
+
|
49
|
+
employees.find { |employee| employee['workEmail'] == email }
|
50
|
+
end
|
51
|
+
|
42
52
|
def fetch_manager(team_member)
|
43
53
|
active_team_members.find { |tm| tm['id'] == team_member['supervisorEId'] }
|
44
54
|
end
|
45
55
|
|
56
|
+
def fetch_manager_for_id(team_member_id)
|
57
|
+
team_member = get_employee_details(team_member_id)
|
58
|
+
active_team_members.find { |tm| tm['id'] == team_member['supervisorEId'] }
|
59
|
+
end
|
60
|
+
|
46
61
|
def fetch_second_level_manager(team_member)
|
47
62
|
fetch_manager(fetch_manager(team_member))
|
48
63
|
end
|
@@ -71,7 +86,11 @@ module PeopleGroup
|
|
71
86
|
retries = 0
|
72
87
|
|
73
88
|
begin
|
74
|
-
|
89
|
+
if @use_report
|
90
|
+
@employees ||= @client.report.find(@use_report, 'JSON', true)
|
91
|
+
else
|
92
|
+
@employees ||= @client.report.custom(fields, 'JSON').reject { |employee| employee['lastName'] == 'Test-Gitlab' }
|
93
|
+
end
|
75
94
|
rescue Net::ReadTimeout, Bamboozled::GatewayError
|
76
95
|
retry if (retries += 1) < MAX_RETRIES
|
77
96
|
end
|
@@ -162,6 +181,14 @@ module PeopleGroup
|
|
162
181
|
@client.employee.add_table_row(employee_id, 'customAdditionalInformation1', data)
|
163
182
|
end
|
164
183
|
|
184
|
+
def additional_data(employee_id)
|
185
|
+
@client.employee.table_data(employee_id, 'employmentStatus')
|
186
|
+
end
|
187
|
+
|
188
|
+
def currency_conversion(employee_id)
|
189
|
+
@client.employee.table_data(employee_id, 'customCurrencyConversion')
|
190
|
+
end
|
191
|
+
|
165
192
|
def add_bonus(team_member_id, comment)
|
166
193
|
data = {
|
167
194
|
customBonusdate: Date.today.to_s,
|
@@ -73,8 +73,8 @@ module PeopleGroup
|
|
73
73
|
# If the candidate has any application that is active, we don't sync.
|
74
74
|
return false if candidate['applications'].any? { |application| application['status'] == 'active' }
|
75
75
|
|
76
|
-
# Check if candidate is hired for
|
77
|
-
candidate['applications'].
|
76
|
+
# Check if candidate is hired for at least one of their applications
|
77
|
+
candidate['applications'].any? { |application| application['status'] == 'hired' }
|
78
78
|
end
|
79
79
|
end
|
80
80
|
end
|
@@ -18,6 +18,17 @@ module PeopleGroup
|
|
18
18
|
nil
|
19
19
|
end
|
20
20
|
|
21
|
+
def bamboo_email_lookup_with_fallback(email)
|
22
|
+
file_path = File.join(__dir__, '../../../data/email_mapper.yml')
|
23
|
+
email_mapper = YAML.load_file(file_path)
|
24
|
+
email_hit = email_mapper.find { |mapping| mapping['bamboo_email'] == email.delete_suffix('@gitlab.com') }
|
25
|
+
email = "#{email_hit['slack_email']}@gitlab.com" if email_hit
|
26
|
+
|
27
|
+
@client.users_lookupByEmail(email: email)
|
28
|
+
rescue ::Slack::Web::Api::Errors::SlackError
|
29
|
+
nil
|
30
|
+
end
|
31
|
+
|
21
32
|
def find_user_by_id(id)
|
22
33
|
@client.users_info(user: id)
|
23
34
|
rescue ::Slack::Web::Api::Errors::SlackError
|
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.35
|
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-
|
11
|
+
date: 2021-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gitlab
|
@@ -159,6 +159,7 @@ extra_rdoc_files: []
|
|
159
159
|
files:
|
160
160
|
- LICENSE.txt
|
161
161
|
- README.md
|
162
|
+
- data/email_mapper.yml
|
162
163
|
- lib/peoplegroup/connectors.rb
|
163
164
|
- lib/peoplegroup/connectors/bamboo.rb
|
164
165
|
- lib/peoplegroup/connectors/gitlab.rb
|