peoplegroup-connectors 0.1.10 → 0.1.16

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: c78c67d1667a5441fdc3c59cd7aceaead99cc3c23e6f646a2a29a837ceef8c69
4
- data.tar.gz: 666e6fec2e69ea4ed830a9247a61fa5fe9f43d9ae363aff5223c8a07554f5262
3
+ metadata.gz: f8847d05d5e51183ec2a4d92c80e87c33da93d78784550f28408187a4190253b
4
+ data.tar.gz: 2cb11bd6247f69133e5965025460e4b969ed9dd3f82125f10b2e4ab851e5b7fd
5
5
  SHA512:
6
- metadata.gz: 6493e56abb36adacbab060fcf91f41db56bd69e8280d028e7086bc73ceae8a144ef8f7c84850640ffcc70a5577323387365a936099c93c3611875171a0dd6d12
7
- data.tar.gz: c3bda22d3e0612c3c059c80cee5aea1f866b4dfbae0b0fa391b320d87063b4f8ec1bc65f86dcae192a71bd9c68a0dcc0facc6536106ad3553fb9d279d5f3e3de
6
+ metadata.gz: 004abace3f43d42ae71370a648db2c025a30c41d8ddf4f55a76d59950b6609c23769f00d6f39e7ef29009d9530209253a855cb76c0cd9fd64ee1d60ed34f75c1
7
+ data.tar.gz: 7685f31b08d82817c0eb66e8494bd12401add246a2f4a2d3a5e3705a3f17a695e83ea8f75688509fd92b64d7b3737514fa6d9265d74e95c9113e686fce06136b
@@ -37,6 +37,7 @@ module PeopleGroup
37
37
  def search_employee_by_field(field:, value:)
38
38
  employees.find { |employee| employee[field] == value.to_s }
39
39
  end
40
+ alias_method :search_team_member_by_field, :search_employee_by_field
40
41
 
41
42
  def fetch_manager(team_member)
42
43
  active_team_members.find { |tm| tm['id'] == team_member['supervisorEId'] }
@@ -71,7 +72,7 @@ module PeopleGroup
71
72
 
72
73
  begin
73
74
  @employees ||= @client.report.custom(fields, 'JSON').reject { |employee| employee['lastName'] == 'Test-Gitlab' }
74
- rescue Net::ReadTimeout
75
+ rescue Net::ReadTimeout, Bamboozled::GatewayError
75
76
  retry if (retries += 1) < MAX_RETRIES
76
77
  end
77
78
  end
@@ -81,6 +82,14 @@ module PeopleGroup
81
82
  end
82
83
  alias_method :active_team_members, :active_employees
83
84
 
85
+ def active_and_current_employees
86
+ today = Date.current
87
+ employees.select do |employee|
88
+ employee['status'] == 'Active' && Date.parse(employee['hireDate']) <= today
89
+ end
90
+ end
91
+ alias_method :active_and_current_team_members, :active_and_current_employees
92
+
84
93
  def add_stock_options(employee_id, data)
85
94
  @client.employee.add_table_row(employee_id, 'customEquity', data)
86
95
  end
@@ -45,7 +45,25 @@ module PeopleGroup
45
45
  epic || @client.create_epic(group_id, title, options)
46
46
  end
47
47
 
48
- def commit_change_to_new_merge_request_v2(project_id, branch_name, commit_message, description = '', files_to_delete = [], files_to_update = [])
48
+ def commit_new_files_to_new_merge_request(project_id, branch_name, new_files, commit_message, description = nil)
49
+ @client.create_branch(project_id, branch_name, 'master')
50
+ actions = []
51
+ new_files.each do |file|
52
+ actions << {
53
+ action: 'create',
54
+ file_path: file.sub('tmp', '/data/team_members/person'),
55
+ content: File.read(file)
56
+ }
57
+ end
58
+
59
+ @client.create_commit(project_id, branch_name, commit_message, actions)
60
+
61
+ options = { source_branch: branch_name, target_branch: 'master', remove_source_branch: true }
62
+ options[:description] = description if description
63
+ @client.create_merge_request(project_id, commit_message, options)
64
+ end
65
+
66
+ def commit_change_to_new_merge_request_v2(project_id, branch_name, commit_message, description = nil, files_to_delete = [], files_to_update = [])
49
67
  actions = []
50
68
 
51
69
  files_to_delete.each do |file|
@@ -60,7 +78,7 @@ module PeopleGroup
60
78
  action = {
61
79
  action: 'update',
62
80
  file_path: file[:file_path],
63
- content: file[:file_with_change]
81
+ content: File.read(file[:tmp_file_path])
64
82
  }
65
83
  actions << action
66
84
  end
@@ -71,7 +89,7 @@ module PeopleGroup
71
89
  @client.create_commit(project_id, branch_name, commit_message, actions)
72
90
 
73
91
  options = { source_branch: branch_name, target_branch: 'master', remove_source_branch: true }
74
- options[:description] = description if description.present?
92
+ options[:description] = description if description
75
93
  @client.create_merge_request(project_id, commit_message, options)
76
94
  end
77
95
 
@@ -18,6 +18,12 @@ module PeopleGroup
18
18
  nil
19
19
  end
20
20
 
21
+ def find_user_by_id(id)
22
+ @client.users_info(user: id)
23
+ rescue ::Slack::Web::Api::Errors::SlackError
24
+ nil
25
+ end
26
+
21
27
  def list_public_channels
22
28
  channels = @client.channels_list(exclude_archived: true).channels
23
29
  channels.reject(&:is_private)&.map(:name)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module PeopleGroup
4
4
  module Connectors
5
- VERSION = '0.1.10'
5
+ VERSION = '0.1.16'
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.10
4
+ version: 0.1.16
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-02-03 00:00:00.000000000 Z
11
+ date: 2021-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gitlab