peoplegroup-connectors 0.1.94 → 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: 5ce77a29706646a2d586a67fd5339e0cd108389672c9c8a0bad75a65166214f3
4
- data.tar.gz: 4e7f6cf42a7e17458c102c27ae0f1648cff700b991654951f13494829a9114e1
3
+ metadata.gz: a0be7c675b0111f44ac068ea7760213db4a1185f274ee5ce7013cb7d2523c9da
4
+ data.tar.gz: 9f476d18190ea653d7ea95fc94ca2ab09a694825e08d6d0bd754d9fdcd065e9d
5
5
  SHA512:
6
- metadata.gz: d77b9503817d157b458c9add7e1147360dccaa3aa6803904afc5de6fc2838c60e804e29a9ef984bc8e75d34dabf8456ad1ace5bc649ce99a4e67655be97cc462
7
- data.tar.gz: 4a8f83ca5d6d6bf08b924d715a27bb656fd10686c144b3fba3603d61effdeeb8d4d5a5dc9d19bb47a7f6fb75759c068b986bd1c2b972d5cbdd35ca7fcad40d10
6
+ metadata.gz: 919075595ea9748646157b40c678d460f33ce644281766815366f8f4917299afcb783cfd037ab9a8901bf3e61cf4c3ad555d6d53c7542cb1b6ad8de2aad92c98
7
+ data.tar.gz: 46eb40d8499e675bced2e0b84a71a93c849174fc81d9a328cb36a6df668af561a3794864f9d3410bc85e8bad102f873a0f2523ebfcff4ab49eab0acc13982ea0
@@ -67,6 +67,7 @@ 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
72
  def search_team_member_by_email!(email)
72
73
  team_member = search_team_member_by_email(email)
@@ -74,22 +75,7 @@ module PeopleGroup
74
75
 
75
76
  team_member
76
77
  end
77
-
78
- def slack_email_lookup_with_fallback(email)
79
- file_path = File.join(__dir__, '../../../data/email_mapper.yml')
80
- email_mapper = YAML.load_file(file_path)
81
- email_hit = email_mapper.find { |mapping| mapping['slack_email'] == email.delete_suffix('@gitlab.com') }
82
- email = "#{email_hit['bamboo_email']}@gitlab.com" if email_hit
83
-
84
- employees.find { |employee| employee['workEmail'] == email }
85
- end
86
-
87
- def slack_email_lookup_with_fallback!(email)
88
- employee = slack_email_lookup_with_fallback(email)
89
- raise EmployeeNotFoundError, "No employee found with Slack email #{email}" if employee.nil?
90
-
91
- employee
92
- end
78
+ alias_method :slack_email_lookup_with_fallback!, :search_team_member_by_email!
93
79
 
94
80
  def team_members_by_department(department)
95
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.94'
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.94
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-29 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,2 +0,0 @@
1
- - slack_email: cristiano
2
- bamboo_email: ccasella