peoplegroup-connectors 0.1.57 → 0.1.62
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63e558e3b0b23937bc35569600026b755d8df4b16d30b4d4d7598bba6284b1e3
|
4
|
+
data.tar.gz: fce5ddb020adc11c9a323b6c47fe9c6ae57e1e9a3c546b8c2ecb74c41c8fcbe6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 359d52f20f5eb1166a79b8e2a39c431811ee0ca3dc84d49defde2c81dcff11a2fcc02d4adf5e8be4a64e58c61ed2d62df4bf9d5af070446fb7bfd3e4d7ba68ce
|
7
|
+
data.tar.gz: 5944fa5d2962193be9cd49f6f29ad04fcb2077e9cf11a28cc51e2f1dc5be51b5dcb7b9632019b57949b3e147aaeae1cc85d405dc75c276648f0efd243bce42a2
|
@@ -5,6 +5,8 @@ require 'bamboozled'
|
|
5
5
|
module PeopleGroup
|
6
6
|
module Connectors
|
7
7
|
class Bamboo
|
8
|
+
attr_accessor :client
|
9
|
+
|
8
10
|
EmployeeNotFoundError = Class.new(StandardError)
|
9
11
|
|
10
12
|
def initialize(use_report: false)
|
@@ -15,6 +17,7 @@ module PeopleGroup
|
|
15
17
|
def get_employee_details(id)
|
16
18
|
employees.find { |emp| emp['id'] == id.to_s }
|
17
19
|
end
|
20
|
+
alias_method :get_team_member_details, :get_employee_details
|
18
21
|
|
19
22
|
def get_employee_details!(id)
|
20
23
|
employee_details = get_employee_details(id)
|
@@ -87,6 +90,14 @@ module PeopleGroup
|
|
87
90
|
employee
|
88
91
|
end
|
89
92
|
|
93
|
+
def team_members_by_department(department)
|
94
|
+
active_and_current_team_members.select { |team_member| team_member['department'] == department }
|
95
|
+
end
|
96
|
+
|
97
|
+
def team_members_by_division(division)
|
98
|
+
active_and_current_team_members.select { |team_member| team_member['division'] == division }
|
99
|
+
end
|
100
|
+
|
90
101
|
def fetch_manager(team_member)
|
91
102
|
active_team_members.find { |tm| tm['id'] == team_member['supervisorEId'] }
|
92
103
|
end
|
@@ -121,6 +132,45 @@ module PeopleGroup
|
|
121
132
|
manager
|
122
133
|
end
|
123
134
|
|
135
|
+
def people_managers_in_functions(departments: [], divisions: [])
|
136
|
+
active_and_current_team_members.select do |team_member|
|
137
|
+
(departments.include?(team_member['department']) || divisions.include?(team_member['division'])) && has_direct_reports?(team_member['id'])
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
def all_reports_for(id)
|
142
|
+
direct_reports_to_check = direct_reports_for(id)
|
143
|
+
reports_to_return = []
|
144
|
+
while direct_reports_to_check.present?
|
145
|
+
current_node = direct_reports_to_check.shift
|
146
|
+
reports_to_return << current_node
|
147
|
+
direct_reports_to_check.concat(direct_reports_for(current_node['id']))
|
148
|
+
end
|
149
|
+
reports_to_return
|
150
|
+
end
|
151
|
+
|
152
|
+
def direct_reports_for(id)
|
153
|
+
active_and_current_team_members.select { |team_member| team_member['supervisorEId'] == id.to_s }
|
154
|
+
end
|
155
|
+
|
156
|
+
def has_direct_reports?(id)
|
157
|
+
active_and_current_team_members.any? { |team_member| team_member['supervisorEId'] == id.to_s }
|
158
|
+
end
|
159
|
+
|
160
|
+
def reports_in_departments(departments, exclude_email)
|
161
|
+
active_and_current_team_members.select do |team_member|
|
162
|
+
# exclude_email is for example to filter out the PBP itself in case their department is also the department they manage
|
163
|
+
departments.include?(team_member['department']) && team_member['workEmail'] != exclude_email
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
def reports_in_divisions(divisions, exclude_email)
|
168
|
+
active_and_current_team_members.select do |team_member|
|
169
|
+
# exclude_email is for example to filter out the PBP itself in case their department is also the department they manage
|
170
|
+
divisions.include?(team_member['division']) && team_member['workEmail'] != exclude_email
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
124
174
|
def create_employee(employee_details_hash)
|
125
175
|
@client.employee.add(employee_details_hash)
|
126
176
|
end
|
@@ -207,7 +257,7 @@ module PeopleGroup
|
|
207
257
|
end
|
208
258
|
|
209
259
|
def time_off_adjustment(employee_id, options)
|
210
|
-
@client.employee.time_off_balance_adjustment(
|
260
|
+
@client.employee.time_off_balance_adjustment(employee_id, options)
|
211
261
|
end
|
212
262
|
|
213
263
|
def accrued_days(employee_id)
|
@@ -303,8 +353,13 @@ module PeopleGroup
|
|
303
353
|
@client.employee.add_table_row(team_member_id, 'customBonus', data)
|
304
354
|
end
|
305
355
|
|
306
|
-
def
|
307
|
-
|
356
|
+
def add_rating_details(team_member_id, performance, potential)
|
357
|
+
data = {
|
358
|
+
customEffectiveDate4: Date.today.to_s,
|
359
|
+
customPerformanceFactor: performance,
|
360
|
+
customPotentialFactor: potential
|
361
|
+
}
|
362
|
+
@client.employee.add_table_row(team_member_id, 'customPerformanceandPotentialTable', data)
|
308
363
|
end
|
309
364
|
|
310
365
|
private
|
@@ -72,8 +72,8 @@ module PeopleGroup
|
|
72
72
|
epic || retry_on_error { @client.create_epic(group_id, title, options) }
|
73
73
|
end
|
74
74
|
|
75
|
-
def commit_new_files_to_new_merge_request(project_id, branch_name, new_files, commit_message, description = nil)
|
76
|
-
retry_on_error { @client.create_branch(project_id, branch_name,
|
75
|
+
def commit_new_files_to_new_merge_request(project_id, branch_name, new_files, commit_message, description = nil, target_branch: 'master')
|
76
|
+
retry_on_error { @client.create_branch(project_id, branch_name, target_branch) }
|
77
77
|
actions = []
|
78
78
|
new_files.each do |file|
|
79
79
|
actions << {
|
@@ -85,12 +85,12 @@ module PeopleGroup
|
|
85
85
|
|
86
86
|
retry_on_error { @client.create_commit(project_id, branch_name, commit_message, actions) }
|
87
87
|
|
88
|
-
options = { source_branch: branch_name, target_branch:
|
88
|
+
options = { source_branch: branch_name, target_branch: target_branch, remove_source_branch: true }
|
89
89
|
options[:description] = description if description
|
90
90
|
retry_on_error { @client.create_merge_request(project_id, commit_message, options) }
|
91
91
|
end
|
92
92
|
|
93
|
-
def commit_change_to_new_merge_request_v2(project_id, branch_name, commit_message, description = nil, files_to_delete = [], files_to_update = [])
|
93
|
+
def commit_change_to_new_merge_request_v2(project_id, branch_name, commit_message, description = nil, files_to_delete = [], files_to_update = [], target_branch: 'master')
|
94
94
|
actions = []
|
95
95
|
|
96
96
|
files_to_delete.each do |file|
|
@@ -112,16 +112,16 @@ module PeopleGroup
|
|
112
112
|
|
113
113
|
return unless actions.any?
|
114
114
|
|
115
|
-
retry_on_error { @client.create_branch(project_id, branch_name,
|
115
|
+
retry_on_error { @client.create_branch(project_id, branch_name, target_branch) }
|
116
116
|
retry_on_error { @client.create_commit(project_id, branch_name, commit_message, actions) }
|
117
117
|
|
118
|
-
options = { source_branch: branch_name, target_branch:
|
118
|
+
options = { source_branch: branch_name, target_branch: target_branch, remove_source_branch: true }
|
119
119
|
options[:description] = description if description
|
120
120
|
retry_on_error { @client.create_merge_request(project_id, commit_message, options) }
|
121
121
|
end
|
122
122
|
|
123
|
-
def commit_change_to_new_merge_request(project_id, branch_name, file_path, file_with_change, commit_message, description = nil)
|
124
|
-
retry_on_error { @client.create_branch(project_id, branch_name,
|
123
|
+
def commit_change_to_new_merge_request(project_id, branch_name, file_path, file_with_change, commit_message, description = nil, target_branch: 'master')
|
124
|
+
retry_on_error { @client.create_branch(project_id, branch_name, target_branch) }
|
125
125
|
actions = [
|
126
126
|
{
|
127
127
|
action: 'update',
|
@@ -131,7 +131,7 @@ module PeopleGroup
|
|
131
131
|
]
|
132
132
|
retry_on_error { @client.create_commit(project_id, branch_name, commit_message, actions) }
|
133
133
|
|
134
|
-
options = { source_branch: branch_name, target_branch:
|
134
|
+
options = { source_branch: branch_name, target_branch: target_branch, remove_source_branch: true }
|
135
135
|
options[:description] = description if description
|
136
136
|
retry_on_error { @client.create_merge_request(project_id, commit_message, options) }
|
137
137
|
end
|
@@ -162,8 +162,8 @@ module PeopleGroup
|
|
162
162
|
epics.first
|
163
163
|
end
|
164
164
|
|
165
|
-
def create_branch(project_id, branch_name)
|
166
|
-
retry_on_error { @client.create_branch(project_id, branch_name,
|
165
|
+
def create_branch(project_id, branch_name, target_branch: 'master')
|
166
|
+
retry_on_error { @client.create_branch(project_id, branch_name, target_branch) }
|
167
167
|
end
|
168
168
|
|
169
169
|
def create_merge_request(project_id, title, options = {})
|
@@ -54,8 +54,8 @@ module PeopleGroup
|
|
54
54
|
@client.chat_postMessage(channel: channel, text: text, as_user: true, attachments: attachments, unfurl_links: false, thread_ts: thread_ts, reply_broadcast: reply_broadcast, blocks: formatted_message)
|
55
55
|
end
|
56
56
|
|
57
|
-
def update_message(channel:, timestamp:, text
|
58
|
-
@client.chat_update(channel: channel, text: text, ts: timestamp, as_user: true, attachments: attachments)
|
57
|
+
def update_message(channel:, timestamp:, text: '', attachments: [], formatted_message: [])
|
58
|
+
@client.chat_update(channel: channel, text: text, ts: timestamp, as_user: true, attachments: attachments, blocks: formatted_message)
|
59
59
|
end
|
60
60
|
|
61
61
|
def send_modal_message(trigger:, view:)
|
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.
|
4
|
+
version: 0.1.62
|
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-
|
11
|
+
date: 2021-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gitlab
|
@@ -190,7 +190,7 @@ metadata:
|
|
190
190
|
homepage_uri: https://gitlab.com/gitlab-com/people-group/peopleops-eng/connectors-gem
|
191
191
|
source_code_uri: https://gitlab.com/gitlab-com/people-group/peopleops-eng/connectors-gem
|
192
192
|
changelog_uri: https://gitlab.com/gitlab-com/people-group/peopleops-eng/connectors-gem
|
193
|
-
post_install_message:
|
193
|
+
post_install_message:
|
194
194
|
rdoc_options: []
|
195
195
|
require_paths:
|
196
196
|
- lib
|
@@ -205,8 +205,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
205
205
|
- !ruby/object:Gem::Version
|
206
206
|
version: '0'
|
207
207
|
requirements: []
|
208
|
-
rubygems_version: 3.
|
209
|
-
signing_key:
|
208
|
+
rubygems_version: 3.1.4
|
209
|
+
signing_key:
|
210
210
|
specification_version: 4
|
211
211
|
summary: Library for our shared connectors.
|
212
212
|
test_files: []
|