peoplegroup-connectors 0.1.26 → 0.1.31

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: af55cdf2e86d5eb632c397ba7b67b0580aa1ced948006795a5983846f8c3a558
4
- data.tar.gz: 4ddde46c0504d7ef17a390ff6331a685ac543c7f9590c7e16d14029f97b86ac9
3
+ metadata.gz: 8f8e9b381041269a553b63f9c64fc86de1dedf730ba10191d055b2d30eaeb205
4
+ data.tar.gz: cd5512eef60b5d2bc05450790ed6181b013ac7f7bacc3c888a4c1c91fb4c5a65
5
5
  SHA512:
6
- metadata.gz: 6b344ea96bd3bb6e40f7a5c94df47f52be8850b1fcd7a6887b938e0c49efd332f41953bbb7f47f20fe8b03c8e07e88865f80bcecf89898c34fcfdeaafa3db5f0
7
- data.tar.gz: 7d9c28962044fe7e4cdbedfe88a26f5c5a7f958d9e29ccf016b1d15ce6b14f20eb58d5f45762ed15b767dd2157f08c9f9ac3cd8b519a9c5383de047b4a3b4de2
6
+ metadata.gz: 85014b51651109152eff8a1232b13bc653f5d0855bc1408044ffd5f304bbe20768cd861c4683097bd7d9f8d4123a09f52ca5dd84dbf9948dd26f4eaf6522ee0f
7
+ data.tar.gz: 8324034a0ce7ddd6038a56a0a5b9680a0a64f2cbdf8cece9b72f5bbc8a063743c85940577728bb7b7aca244dd00ff598762d806ba82b65f801da8e140b65ace6
@@ -5,6 +5,8 @@ require 'gitlab'
5
5
  module PeopleGroup
6
6
  module Connectors
7
7
  class GitLab
8
+ attr_accessor :client
9
+
8
10
  MAX_RETRIES = 3
9
11
 
10
12
  API_URL = ENV['GITLAB_API_V4_URL'] || 'https://gitlab.com/api/v4'
@@ -24,6 +26,21 @@ module PeopleGroup
24
26
  end
25
27
  end
26
28
 
29
+ def find_gitlabber_on(field, query, group)
30
+ return if !query || query.empty?
31
+
32
+ possible_members = retry_on_error { @client.group_members(group, query: query) }
33
+ if field === :email
34
+ possible_members.first
35
+ else
36
+ possible_members.find { |team_member| team_member.public_send(field) === query }
37
+ end
38
+ end
39
+
40
+ def remove_group_member(group, user_id)
41
+ retry_on_error { @client.remove_group_member(group, user_id) }
42
+ end
43
+
27
44
  def create_issue(project, title, options = {})
28
45
  retry_on_error do
29
46
  @client.create_issue(project, title, options)
@@ -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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module PeopleGroup
4
4
  module Connectors
5
- VERSION = '0.1.26'
5
+ VERSION = '0.1.31'
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.26
4
+ version: 0.1.31
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-03-03 00:00:00.000000000 Z
11
+ date: 2021-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gitlab