peoplegroup-connectors 0.1.92 → 0.1.95

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: 7789daf921b2d71118e041de7294ef10b4ca6258704ff643f7043cb7424b79d8
4
- data.tar.gz: 38c896e3f2ea63b97b12f6d0e79654ca0d08703ec9d26cf2588520b1f3892e07
3
+ metadata.gz: a0be7c675b0111f44ac068ea7760213db4a1185f274ee5ce7013cb7d2523c9da
4
+ data.tar.gz: 9f476d18190ea653d7ea95fc94ca2ab09a694825e08d6d0bd754d9fdcd065e9d
5
5
  SHA512:
6
- metadata.gz: bad2a3a1604e0f69ccf38e78b9e8f6564f1b52630bdb694d617958c0a5e275e96c388c6554c12060543019e0c3edba4c27ea5ade63aa55f0698d5372f326c813
7
- data.tar.gz: eb1a527c6b32770812360d45fb3b6f121999f32ea57339cd4b70cd77ebd7aae08fe2a2f0ff192d6871fdb93f6e66a49210852e06419145e7e0949dc3c43daf27
6
+ metadata.gz: 919075595ea9748646157b40c678d460f33ce644281766815366f8f4917299afcb783cfd037ab9a8901bf3e61cf4c3ad555d6d53c7542cb1b6ad8de2aad92c98
7
+ data.tar.gz: 46eb40d8499e675bced2e0b84a71a93c849174fc81d9a328cb36a6df668af561a3794864f9d3410bc85e8bad102f873a0f2523ebfcff4ab49eab0acc13982ea0
@@ -67,22 +67,15 @@ module PeopleGroup
67
67
  def search_team_member_by_email(email)
68
68
  team_members.find { |team_member| team_member['workEmail']&.downcase == email&.downcase }
69
69
  end
70
+ alias_method :slack_email_lookup_with_fallback, :search_team_member_by_email
70
71
 
71
- def slack_email_lookup_with_fallback(email)
72
- file_path = File.join(__dir__, '../../../data/email_mapper.yml')
73
- email_mapper = YAML.load_file(file_path)
74
- email_hit = email_mapper.find { |mapping| mapping['slack_email'] == email.delete_suffix('@gitlab.com') }
75
- email = "#{email_hit['bamboo_email']}@gitlab.com" if email_hit
72
+ def search_team_member_by_email!(email)
73
+ team_member = search_team_member_by_email(email)
74
+ raise EmployeeNotFoundError, "No team member found with email #{email}." unless team_member
76
75
 
77
- employees.find { |employee| employee['workEmail'] == email }
78
- end
79
-
80
- def slack_email_lookup_with_fallback!(email)
81
- employee = slack_email_lookup_with_fallback(email)
82
- raise EmployeeNotFoundError, "No employee found with Slack email #{email}" if employee.nil?
83
-
84
- employee
76
+ team_member
85
77
  end
78
+ alias_method :slack_email_lookup_with_fallback!, :search_team_member_by_email!
86
79
 
87
80
  def team_members_by_department(department)
88
81
  active_and_current_team_members.select { |team_member| team_member['department'] == department }
@@ -12,22 +12,13 @@ module PeopleGroup
12
12
  @client = ::Slack::Web::Client.new
13
13
  end
14
14
 
15
- def find_user(email)
16
- @client.users_lookupByEmail(email: email)
17
- rescue ::Slack::Web::Api::Errors::SlackError
18
- nil
19
- end
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
-
15
+ def bamboo_email_lookup(email)
27
16
  @client.users_lookupByEmail(email: email)
28
17
  rescue ::Slack::Web::Api::Errors::SlackError
29
18
  nil
30
19
  end
20
+ alias_method :bamboo_email_lookup_with_fallback, :bamboo_email_lookup
21
+ alias_method :find_user, :bamboo_email_lookup
31
22
 
32
23
  def find_user_by_id(id)
33
24
  @client.users_info(user: id)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module PeopleGroup
4
4
  module Connectors
5
- VERSION = '0.1.92'
5
+ VERSION = '0.1.95'
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.92
4
+ version: 0.1.95
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: 2022-03-28 00:00:00.000000000 Z
11
+ date: 2022-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gitlab
@@ -229,7 +229,6 @@ extra_rdoc_files: []
229
229
  files:
230
230
  - LICENSE.txt
231
231
  - README.md
232
- - data/email_mapper.yml
233
232
  - lib/peoplegroup/connectors.rb
234
233
  - lib/peoplegroup/connectors/bamboo.rb
235
234
  - lib/peoplegroup/connectors/gitlab.rb
@@ -1,6 +0,0 @@
1
- - slack_email: cristiano
2
- bamboo_email: ccasella
3
- - slack_email: mjacob
4
- bamboo_email: mgomez
5
- - slack_email: nprecilla
6
- bamboo_email: ngarcia