peoplegroup-connectors 0.1.28 → 0.1.33

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: c51711afa3c65e5a9c502191e2be499379f23874fcd9dc2474e47c4cbb9d05f0
4
- data.tar.gz: e25cfbb760e93545fd6d45bd623cf56353405172bd068bbda26446e9986b89db
3
+ metadata.gz: 4b660ffce96d59df79bda2b48309142606ad7a5df8b684b4121f31a22071ec70
4
+ data.tar.gz: 79d28873b3b7309cc866278cfe22f14c61c967c7d7c74e4b8b0cce38ab5d96fa
5
5
  SHA512:
6
- metadata.gz: a884ff041804f3fa6036d600f5b5ea23eb9ef93c962c1593eb8402b0815605af3888f5e5102eefeda630da7a4e6f9a18dd0a77f4f9db6c33286a1af6b99529d5
7
- data.tar.gz: 585534f1e50e37783be491281aeeeb6cfcc3cc7498889d83ca0e8a511ab0968c516146b2608fae2d71d6b72d6917e3f607d0138a8995bcd66fc14256aa3a4230
6
+ metadata.gz: 33e90edb0b68f99fd05a60b67e870cc44361f4dd1824a0574f5d19c51182c03f918d2ac2d3073c56ff6c891decf49e04128ec4818bebdd2a37d10661bcc3709b
7
+ data.tar.gz: 592c6091a7d632cfa72144057eec962557c7eab55d099e11e87dc88059035bfdfce7b7e562a10374bbae6b64e86014acb91f03f43e946e6f2ffd923232c0f368
@@ -0,0 +1,4 @@
1
+ - slack_email: cristiano
2
+ bamboo_email: ccasella
3
+ - slack_email: kencjohnston
4
+ bamboo_email: kjohnston
@@ -39,6 +39,15 @@ module PeopleGroup
39
39
  end
40
40
  alias_method :search_team_member_by_field, :search_employee_by_field
41
41
 
42
+ def slack_email_lookup_with_fallback(email)
43
+ file_path = File.join(__dir__, '../../../data/email_mapper.yml')
44
+ email_mapper = YAML.load_file(file_path)
45
+ email_hit = email_mapper.find { |mapping| mapping['slack_email'] == email.delete_suffix('@gitlab.com') }
46
+ email = "#{email_hit['bamboo_email']}@gitlab.com" if email_hit
47
+
48
+ employees.find { |employee| employee['workEmail'] == email }
49
+ end
50
+
42
51
  def fetch_manager(team_member)
43
52
  active_team_members.find { |tm| tm['id'] == team_member['supervisorEId'] }
44
53
  end
@@ -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 just one of their applications
77
- candidate['applications'].one? { |application| application['status'] == 'hired' }
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module PeopleGroup
4
4
  module Connectors
5
- VERSION = '0.1.28'
5
+ VERSION = '0.1.33'
6
6
  end
7
7
  end
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.28
4
+ version: 0.1.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - lien van den steen
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-16 00:00:00.000000000 Z
11
+ date: 2021-03-29 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
@@ -173,7 +174,7 @@ metadata:
173
174
  homepage_uri: https://gitlab.com/gitlab-com/people-group/peopleops-eng/connectors-gem
174
175
  source_code_uri: https://gitlab.com/gitlab-com/people-group/peopleops-eng/connectors-gem
175
176
  changelog_uri: https://gitlab.com/gitlab-com/people-group/peopleops-eng/connectors-gem
176
- post_install_message:
177
+ post_install_message:
177
178
  rdoc_options: []
178
179
  require_paths:
179
180
  - lib
@@ -189,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
189
190
  version: '0'
190
191
  requirements: []
191
192
  rubygems_version: 3.1.4
192
- signing_key:
193
+ signing_key:
193
194
  specification_version: 4
194
195
  summary: Library for our shared connectors.
195
196
  test_files: []