gitlab_support_readiness 1.0.131 → 1.0.133
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/support_readiness/support_super_form_processor/create_article.rb +2 -6
- data/lib/support_readiness/support_super_form_processor/create_macro.rb +3 -5
- data/lib/support_readiness/support_super_form_processor/disable_us_government.rb +10 -1
- data/lib/support_readiness/support_super_form_processor/edit_macro.rb +2 -4
- data/lib/support_readiness/support_super_form_processor/enable_us_government.rb +10 -1
- data/lib/support_readiness/support_super_form_processor/global_set_collaboration_id.rb +3 -5
- data/lib/support_readiness/support_super_form_processor/global_set_org_ase.rb +5 -7
- data/lib/support_readiness/support_super_form_processor/namespace_availability.rb +4 -4
- data/lib/support_readiness/support_super_form_processor/team_member_license.rb +3 -3
- data/lib/support_readiness/support_super_form_processor/usgov_set_collaboration_id.rb +3 -5
- data/lib/support_readiness/support_super_form_processor/usgov_set_org_ase.rb +5 -7
- data/lib/support_readiness/zendesk/oauth_tokens.rb +115 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5725d3ed4f90dc1debc220178b5c2e0c68204f3ddb556ad55142adaed95d1d40
|
4
|
+
data.tar.gz: da9a6c914594b3fb6e6df9e21c9e2f69fc6ecaef17f63549a3d0446cecd6c7d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '08c623cb5a466a6f295232558a203a977533341cb3737513fbfb0380a61bf5dae091cc66a5fcb2d08400f53b728805a99bc3428d4a2963dba51584201926ab48'
|
7
|
+
data.tar.gz: a545b7f85e65b48e57fee31825dc54a8ca9abd478154d501d899eae7f0790648d3719408b1e0d1bae5a278401f7ca00e310ec104e9be41a236b5a69c9ca65525
|
@@ -245,7 +245,7 @@ module Readiness
|
|
245
245
|
# @author Jason Colyer
|
246
246
|
# @since 1.0.42
|
247
247
|
def self.project
|
248
|
-
@project ||= Readiness::GitLab::Projects.find!(@gitlab_client,
|
248
|
+
@project ||= Readiness::GitLab::Projects.find!(@gitlab_client, 68534119)
|
249
249
|
end
|
250
250
|
|
251
251
|
##
|
@@ -321,9 +321,7 @@ module Readiness
|
|
321
321
|
|
322
322
|
This process should be completely automated. If you see any issues, please rectify them and notify Jason so the processor can be looked into.
|
323
323
|
|
324
|
-
/label ~"
|
325
|
-
|
326
|
-
/label ~"Readiness::Completed"
|
324
|
+
/label ~"administrative" ~"Stage::Completed" ~zendesk ~"Customer::Support" ~"p4"
|
327
325
|
|
328
326
|
/assign @jcolyer @dtragjasi
|
329
327
|
STRING
|
@@ -342,8 +340,6 @@ module Readiness
|
|
342
340
|
|
343
341
|
If you see any issues, please reopen this issue and post in the support operations channel in Slack.
|
344
342
|
|
345
|
-
/label ~"Readiness::Completed"
|
346
|
-
|
347
343
|
/close
|
348
344
|
STRING
|
349
345
|
end
|
@@ -74,7 +74,7 @@ module Readiness
|
|
74
74
|
|
75
75
|
If you have any problems, please reopen this issue and ping the Support Readiness team for assistance.
|
76
76
|
|
77
|
-
/label ~"
|
77
|
+
/label ~"Stage::Completed"
|
78
78
|
|
79
79
|
/close
|
80
80
|
STRING
|
@@ -197,7 +197,7 @@ module Readiness
|
|
197
197
|
# @author Jason Colyer
|
198
198
|
# @since 1.0.42
|
199
199
|
def self.project
|
200
|
-
@project ||= Readiness::GitLab::Projects.find!(@gitlab_client,
|
200
|
+
@project ||= Readiness::GitLab::Projects.find!(@gitlab_client, 68534119)
|
201
201
|
end
|
202
202
|
|
203
203
|
##
|
@@ -289,9 +289,7 @@ module Readiness
|
|
289
289
|
|
290
290
|
```
|
291
291
|
|
292
|
-
/label ~"
|
293
|
-
|
294
|
-
/label ~"Readiness::Triage"
|
292
|
+
/label ~"Stage::Development" ~administrative ~p4 ~"Customer::Support" ~zendesk
|
295
293
|
|
296
294
|
/assign #{issue_assignees}
|
297
295
|
STRING
|
@@ -34,6 +34,15 @@ module Readiness
|
|
34
34
|
exit 0
|
35
35
|
end
|
36
36
|
|
37
|
+
##
|
38
|
+
# Sets the global variable project
|
39
|
+
#
|
40
|
+
# @author Jason Colyer
|
41
|
+
# @since 1.0.133
|
42
|
+
def self.project
|
43
|
+
@project ||= Readiness::GitLab::Projects.find!(@gitlab_client, 68534119)
|
44
|
+
end
|
45
|
+
|
37
46
|
##
|
38
47
|
# Peform validity checks for this request
|
39
48
|
#
|
@@ -168,7 +177,7 @@ module Readiness
|
|
168
177
|
|
169
178
|
/assign @#{requester.username} @jcolyer @secole @lyle
|
170
179
|
|
171
|
-
/label ~"
|
180
|
+
/label ~"Stage::Development" ~p4 ~zendesk ~administrative ~"Customer::Field"
|
172
181
|
|
173
182
|
cc @leeeee-gtlb
|
174
183
|
STRING
|
@@ -80,7 +80,7 @@ module Readiness
|
|
80
80
|
# @author Jason Colyer
|
81
81
|
# @since 1.0.42
|
82
82
|
def self.project
|
83
|
-
@project ||= Readiness::GitLab::Projects.find!(@gitlab_client,
|
83
|
+
@project ||= Readiness::GitLab::Projects.find!(@gitlab_client, 68534119)
|
84
84
|
end
|
85
85
|
|
86
86
|
##
|
@@ -150,9 +150,7 @@ module Readiness
|
|
150
150
|
|
151
151
|
```
|
152
152
|
|
153
|
-
/label ~"
|
154
|
-
|
155
|
-
/label ~"Readiness::Triage"
|
153
|
+
/label ~"Stage::Development" ~zendesk ~"Customer::Support" ~p4 ~administrative
|
156
154
|
|
157
155
|
/assign #{issue_assignees}
|
158
156
|
STRING
|
@@ -34,6 +34,15 @@ module Readiness
|
|
34
34
|
exit 0
|
35
35
|
end
|
36
36
|
|
37
|
+
##
|
38
|
+
# Sets the global variable project
|
39
|
+
#
|
40
|
+
# @author Jason Colyer
|
41
|
+
# @since 1.0.133
|
42
|
+
def self.project
|
43
|
+
@project ||= Readiness::GitLab::Projects.find!(@gitlab_client, 68534119)
|
44
|
+
end
|
45
|
+
|
37
46
|
##
|
38
47
|
# Peform validity checks for this request
|
39
48
|
#
|
@@ -231,7 +240,7 @@ module Readiness
|
|
231
240
|
|
232
241
|
/assign @#{requester.username} @jcolyer @secole @lyle
|
233
242
|
|
234
|
-
/label ~"
|
243
|
+
/label ~"Stage::Development" ~p4 ~zendesk ~administrative ~"Customer::Field"
|
235
244
|
|
236
245
|
cc @jscarborough @leeeee-gtlb
|
237
246
|
STRING
|
@@ -73,7 +73,7 @@ module Readiness
|
|
73
73
|
# @author Jason Colyer
|
74
74
|
# @since 1.0.42
|
75
75
|
def self.project
|
76
|
-
@project ||= Readiness::GitLab::Projects.find!(@gitlab_client,
|
76
|
+
@project ||= Readiness::GitLab::Projects.find!(@gitlab_client, 68534119)
|
77
77
|
end
|
78
78
|
|
79
79
|
##
|
@@ -116,7 +116,7 @@ module Readiness
|
|
116
116
|
|
117
117
|
We have set the collaboration project ID of the Zendesk Global organization to that of #{collaboration_project_id} at this time.
|
118
118
|
|
119
|
-
/label ~"AutomatedRequests::Set Org Collab ID"
|
119
|
+
/label ~"AutomatedRequests::Set Org Collab ID" ~zendesk ~administrative ~"Stage::Completed" ~p4
|
120
120
|
|
121
121
|
/assign @#{requester.username}
|
122
122
|
STRING
|
@@ -139,9 +139,7 @@ module Readiness
|
|
139
139
|
|
140
140
|
If you need assistance in locating the organization's ID, please ask in the Slack channel [#support_operations](https://gitlab.slack.com/archives/C018ZGZAMPD)
|
141
141
|
|
142
|
-
/label ~"AutomatedRequests::Invalid Organization"
|
143
|
-
|
144
|
-
/label ~"Invalid Zendesk Global organization given"
|
142
|
+
/label ~"AutomatedRequests::Invalid Organization" ~zendesk ~administrative ~"Stage::Blocked" ~p4
|
145
143
|
|
146
144
|
/assign @#{requester.username}
|
147
145
|
STRING
|
@@ -156,7 +156,7 @@ module Readiness
|
|
156
156
|
# @author Jason Colyer
|
157
157
|
# @since 1.0.42
|
158
158
|
def self.project
|
159
|
-
@project ||= Readiness::GitLab::Projects.find!(@gitlab_client,
|
159
|
+
@project ||= Readiness::GitLab::Projects.find!(@gitlab_client, 68534119)
|
160
160
|
end
|
161
161
|
|
162
162
|
##
|
@@ -212,7 +212,7 @@ module Readiness
|
|
212
212
|
|
213
213
|
If you need assistance in locating the agent's ID, please ask in the Slack channel [#support_operations](https://gitlab.slack.com/archives/C018ZGZAMPD)
|
214
214
|
|
215
|
-
/label ~"AutomatedRequests::Set Org ASE"
|
215
|
+
/label ~"AutomatedRequests::Set Org ASE" ~"Stage::Completed" ~administrative ~p4 ~zendesk ~"Customer::Support"
|
216
216
|
|
217
217
|
/assign @#{requester.username}
|
218
218
|
STRING
|
@@ -235,9 +235,7 @@ module Readiness
|
|
235
235
|
|
236
236
|
If you need assistance in locating the organization's ID, please ask in the Slack channel [#support_operations](https://gitlab.slack.com/archives/C018ZGZAMPD)
|
237
237
|
|
238
|
-
/label ~"AutomatedRequests::Invalid Organization"
|
239
|
-
|
240
|
-
/label ~"Invalid Zendesk Global organization given"
|
238
|
+
/label ~"AutomatedRequests::Invalid Organization" ~"Stage::Blocked" ~administrative ~p4 ~zendesk ~"Customer::Support"
|
241
239
|
|
242
240
|
/assign @#{requester.username}
|
243
241
|
STRING
|
@@ -255,7 +253,7 @@ module Readiness
|
|
255
253
|
|
256
254
|
#{approved_requester_list.map { |a| "- #{a['email']}" }.join("\n")}
|
257
255
|
|
258
|
-
/label ~"AutomatedRequests::Invalid Permissions"
|
256
|
+
/label ~"AutomatedRequests::Invalid Permissions" ~"Stage::Blocked" ~administrative ~p4 ~zendesk ~"Customer::Support"
|
259
257
|
|
260
258
|
/assign @#{requester.username}
|
261
259
|
STRING
|
@@ -283,7 +281,7 @@ module Readiness
|
|
283
281
|
|
284
282
|
If you need assistance in locating the agent's ID, please ask in the Slack channel [#support_operations](https://gitlab.slack.com/archives/C018ZGZAMPD)
|
285
283
|
|
286
|
-
/label ~"AutomatedRequests::Set Org ASE" ~"
|
284
|
+
/label ~"AutomatedRequests::Set Org ASE" ~"Stage::Blocked" ~administrative ~p4 ~zendesk ~"Customer::Support"
|
287
285
|
|
288
286
|
/assign @#{requester.username}
|
289
287
|
STRING
|
@@ -96,7 +96,7 @@ module Readiness
|
|
96
96
|
# @author Jason Colyer
|
97
97
|
# @since 1.0.42
|
98
98
|
def self.project
|
99
|
-
@project ||= Readiness::GitLab::Projects.find!(@gitlab_client,
|
99
|
+
@project ||= Readiness::GitLab::Projects.find!(@gitlab_client, 68534119)
|
100
100
|
end
|
101
101
|
|
102
102
|
##
|
@@ -163,7 +163,7 @@ module Readiness
|
|
163
163
|
|
164
164
|
We have looked into the availability of the namespace #{CGI.escape(namespace_to_check)} and have determined it will not be available for release at this time.
|
165
165
|
|
166
|
-
/label ~"AutomatedRequests::Namespace Availability Check"
|
166
|
+
/label ~"AutomatedRequests::Namespace Availability Check" ~p4 ~administrative ~"Stage::Completed"
|
167
167
|
|
168
168
|
/assign @#{requester.username}
|
169
169
|
STRING
|
@@ -182,7 +182,7 @@ module Readiness
|
|
182
182
|
|
183
183
|
We have looked into the availability of the namespace #{CGI.escape(namespace_to_check)} and have been unable to locate the namespace on gitlab.com. This would mean it is not currently in use at all and should be available at this exact moment in time.
|
184
184
|
|
185
|
-
/label ~"AutomatedRequests::Namespace Availability Check"
|
185
|
+
/label ~"AutomatedRequests::Namespace Availability Check" ~p4 ~administrative ~"Stage::Completed"
|
186
186
|
|
187
187
|
/assign @#{requester.username}
|
188
188
|
STRING
|
@@ -203,7 +203,7 @@ module Readiness
|
|
203
203
|
|
204
204
|
Please note this only reflects the _possibility_ of release _at this exact time_. Any number of factors or events could change in the future to change this determination.
|
205
205
|
|
206
|
-
/label ~"AutomatedRequests::Namespace Availability Check"
|
206
|
+
/label ~"AutomatedRequests::Namespace Availability Check" ~p4 ~administrative ~"Stage::Completed"
|
207
207
|
|
208
208
|
/assign @#{requester.username}
|
209
209
|
STRING
|
@@ -79,7 +79,7 @@ module Readiness
|
|
79
79
|
# @author Jason Colyer
|
80
80
|
# @since 1.0.42
|
81
81
|
def self.project
|
82
|
-
@project ||= Readiness::GitLab::Projects.find!(@gitlab_client,
|
82
|
+
@project ||= Readiness::GitLab::Projects.find!(@gitlab_client, 68534119)
|
83
83
|
end
|
84
84
|
|
85
85
|
##
|
@@ -156,7 +156,7 @@ module Readiness
|
|
156
156
|
|
157
157
|
### Support Operations
|
158
158
|
|
159
|
-
* [ ] Follow the directions of the workflow, which can be found [here](https://handbook.gitlab.com/handbook/support
|
159
|
+
* [ ] Follow the directions of the workflow, which can be found [here](https://handbook.gitlab.com/handbook/security/customer-support-operations/docs/team_member_licenses/)
|
160
160
|
|
161
161
|
---
|
162
162
|
|
@@ -164,7 +164,7 @@ module Readiness
|
|
164
164
|
|
165
165
|
/assign @nabeel.bilgrami @avilla4 @secole @rverschoor
|
166
166
|
|
167
|
-
/label ~"
|
167
|
+
/label ~"Stage::Development" ~administrative ~p4
|
168
168
|
STRING
|
169
169
|
end
|
170
170
|
end
|
@@ -73,7 +73,7 @@ module Readiness
|
|
73
73
|
# @author Jason Colyer
|
74
74
|
# @since 1.0.42
|
75
75
|
def self.project
|
76
|
-
@project ||= Readiness::GitLab::Projects.find!(@gitlab_client,
|
76
|
+
@project ||= Readiness::GitLab::Projects.find!(@gitlab_client, 68534119)
|
77
77
|
end
|
78
78
|
|
79
79
|
##
|
@@ -116,7 +116,7 @@ module Readiness
|
|
116
116
|
|
117
117
|
We have set the collaboration project ID of the Zendesk US Government organization to that of #{collaboriation_project_id} at this time.
|
118
118
|
|
119
|
-
/label ~"AutomatedRequests::Set Org Collab ID"
|
119
|
+
/label ~"AutomatedRequests::Set Org Collab ID" ~"Stage::Completed" ~administrative ~p4 ~zendesk
|
120
120
|
|
121
121
|
/assign @#{requester.username}
|
122
122
|
STRING
|
@@ -139,9 +139,7 @@ module Readiness
|
|
139
139
|
|
140
140
|
If you need assistance in locating the organization's ID, please ask in the Slack channel [#support_operations](https://gitlab.slack.com/archives/C018ZGZAMPD)
|
141
141
|
|
142
|
-
/label ~"AutomatedRequests::Invalid Organization"
|
143
|
-
|
144
|
-
/label ~"Invalid Zendesk US Government organization given"
|
142
|
+
/label ~"AutomatedRequests::Invalid Organization" ~"Stage::Blocked" ~administrative ~p4 ~zendesk
|
145
143
|
|
146
144
|
/assign @#{requester.username}
|
147
145
|
STRING
|
@@ -158,7 +158,7 @@ module Readiness
|
|
158
158
|
# @author Jason Colyer
|
159
159
|
# @since 1.0.42
|
160
160
|
def self.project
|
161
|
-
@project ||= Readiness::GitLab::Projects.find!(@gitlab_client,
|
161
|
+
@project ||= Readiness::GitLab::Projects.find!(@gitlab_client, 68534119)
|
162
162
|
end
|
163
163
|
|
164
164
|
##
|
@@ -214,7 +214,7 @@ module Readiness
|
|
214
214
|
|
215
215
|
If you need assistance in locating the agent's ID, please ask in the Slack channel [#support_operations](https://gitlab.slack.com/archives/C018ZGZAMPD)
|
216
216
|
|
217
|
-
/label ~"AutomatedRequests::Set Org ASE"
|
217
|
+
/label ~"AutomatedRequests::Set Org ASE" ~"Stage::Completed" ~administrative ~p4 ~zendesk ~"Customer::Support"
|
218
218
|
|
219
219
|
/assign @#{requester.username}
|
220
220
|
STRING
|
@@ -237,9 +237,7 @@ module Readiness
|
|
237
237
|
|
238
238
|
If you need assistance in locating the organization's ID, please ask in the Slack channel [#support_operations](https://gitlab.slack.com/archives/C018ZGZAMPD)
|
239
239
|
|
240
|
-
/label ~"AutomatedRequests::Invalid Organization"
|
241
|
-
|
242
|
-
/label ~"Invalid Zendesk US Goverment organization given"
|
240
|
+
/label ~"AutomatedRequests::Invalid Organization" ~"Stage::Blocked" ~administrative ~p4 ~zendesk ~"Customer::Support"
|
243
241
|
|
244
242
|
/assign @#{requester.username}
|
245
243
|
STRING
|
@@ -257,7 +255,7 @@ module Readiness
|
|
257
255
|
|
258
256
|
#{approved_requester_list.map { |a| "- #{a['email']}" }.join("\n")}
|
259
257
|
|
260
|
-
/label ~"AutomatedRequests::Invalid Permissions"
|
258
|
+
/label ~"AutomatedRequests::Invalid Permissions" ~"Stage::Blocked" ~administrative ~p4 ~zendesk ~"Customer::Support"
|
261
259
|
|
262
260
|
/assign @#{requester.username}
|
263
261
|
STRING
|
@@ -285,7 +283,7 @@ module Readiness
|
|
285
283
|
|
286
284
|
If you need assistance in locating the agent's ID, please ask in the Slack channel [#support_operations](https://gitlab.slack.com/archives/C018ZGZAMPD)
|
287
285
|
|
288
|
-
/label ~"AutomatedRequests::Set Org ASE" ~"
|
286
|
+
/label ~"AutomatedRequests::Set Org ASE" ~"Stage::Blocked" ~administrative ~p4 ~zendesk ~"Customer::Support"
|
289
287
|
|
290
288
|
/assign @#{requester.username}
|
291
289
|
STRING
|
@@ -9,9 +9,6 @@ module Readiness
|
|
9
9
|
#
|
10
10
|
# @author Jason Colyer
|
11
11
|
# @since 1.0.125
|
12
|
-
# @todo list - https://developer.zendesk.com/api-reference/ticketing/oauth/oauth_tokens/#list-tokens
|
13
|
-
# @todo show - https://developer.zendesk.com/api-reference/ticketing/oauth/oauth_tokens/#show-token
|
14
|
-
# @todo revoke - https://developer.zendesk.com/api-reference/ticketing/oauth/oauth_tokens/#revoke-token
|
15
12
|
class OAuthTokens < Readiness::Client
|
16
13
|
attr_accessor :client_id, :created_at, :expires_at, :full_token, :id, :refresh_token, :refresh_token_expires_at, :scopes, :token, :used_at, :user_id
|
17
14
|
|
@@ -37,7 +34,92 @@ module Readiness
|
|
37
34
|
@used_at = object['used_at']
|
38
35
|
@user_id = object['user_id']
|
39
36
|
end
|
40
|
-
|
37
|
+
|
38
|
+
##
|
39
|
+
# Lists all OAuth tokens.
|
40
|
+
#
|
41
|
+
# @author Jason Colyer
|
42
|
+
# @since 1.0.132
|
43
|
+
# @param client [Object] An instance of {Readiness::Zendesk::Client}
|
44
|
+
# @return [Array]
|
45
|
+
# @see https://developer.zendesk.com/api-reference/ticketing/oauth/oauth_tokens/#list-tokens Zendesk API > OAuth Tokens > List Tokens
|
46
|
+
# @example
|
47
|
+
# require 'support_readiness'
|
48
|
+
# config = Readiness::Zendesk::Configuration.new
|
49
|
+
# config.username = 'alice@example.com'
|
50
|
+
# config.token = 'test123abc'
|
51
|
+
# config.url = 'https://example.zendesk.com/api/v2'
|
52
|
+
# client = Readiness::Zendesk::Client.new(config)
|
53
|
+
# oauth_tokens = Readiness::Zendesk::OAuthTokens.list(client)
|
54
|
+
# pp oauth_tokens.count
|
55
|
+
# # => 24
|
56
|
+
def self.list(client)
|
57
|
+
array = []
|
58
|
+
opts = 'page[size]=100'
|
59
|
+
loop do
|
60
|
+
response = client.connection.get("oauth/tokens?#{opts}")
|
61
|
+
handle_request_error(0, 'Zendesk', response.status) unless response.status == 200
|
62
|
+
body = Oj.load(response.body)
|
63
|
+
array += body['tokens'].map { |t| OAuthTokens.new(t) }
|
64
|
+
break unless body['meta']['has_more']
|
65
|
+
|
66
|
+
opts = body['links']['next'].split('?').last
|
67
|
+
end
|
68
|
+
array
|
69
|
+
end
|
70
|
+
|
71
|
+
##
|
72
|
+
# Locates an OAuth token within Zendesk. This will not exit on error (except Authentication errors)
|
73
|
+
#
|
74
|
+
# @author Jason Colyer
|
75
|
+
# @since 1.0.132
|
76
|
+
# @param client [Object] An instance of {Readiness::Zendesk::Client}
|
77
|
+
# @param tid [Integer[ The OAuth token ID to find
|
78
|
+
# @param return [Hash]
|
79
|
+
# @see https://developer.zendesk.com/api-reference/ticketing/oauth/oauth_tokens/#show-token Zendesk API > OAuth Tokens > Show Token
|
80
|
+
# @example
|
81
|
+
# require 'support_readiness'
|
82
|
+
# config = Readiness::Zendesk::Configuration.new
|
83
|
+
# config.username = 'alice@example.com'
|
84
|
+
# config.token = 'test123abc'
|
85
|
+
# config.url = 'https://example.zendesk.com/api/v2'
|
86
|
+
# client = Readiness::Zendesk::Client.new(config)
|
87
|
+
# oauth_token = Readiness::Zendesk::OAuthTokens.find(client, 223443)
|
88
|
+
# pp oauth_token.client_id
|
89
|
+
# # => 1234
|
90
|
+
def self.find(client, tid)
|
91
|
+
response = client.connection.get("oauth/tokens/#{tid}")
|
92
|
+
handle_request_error(0, 'Zendesk', response.status, { action: 'get', id: cid }) unless response.status == 200
|
93
|
+
return OAuthTokens.new(Oj.load(response.body)['token']) if response.status == 200
|
94
|
+
|
95
|
+
Oj.load(response.body)
|
96
|
+
end
|
97
|
+
|
98
|
+
##
|
99
|
+
# Locates an OAuth token within Zendesk. This will exit on error
|
100
|
+
#
|
101
|
+
# @author Jason Colyer
|
102
|
+
# @since 1.0.132
|
103
|
+
# @param client [Object] An instance of {Readiness::Zendesk::Client}
|
104
|
+
# @param tid [Integer[ The OAuth token ID to find
|
105
|
+
# @param return [Hash]
|
106
|
+
# @see https://developer.zendesk.com/api-reference/ticketing/oauth/oauth_tokens/#show-token Zendesk API > OAuth Tokens > Show Token
|
107
|
+
# @example
|
108
|
+
# require 'support_readiness'
|
109
|
+
# config = Readiness::Zendesk::Configuration.new
|
110
|
+
# config.username = 'alice@example.com'
|
111
|
+
# config.token = 'test123abc'
|
112
|
+
# config.url = 'https://example.zendesk.com/api/v2'
|
113
|
+
# client = Readiness::Zendesk::Client.new(config)
|
114
|
+
# oauth_token = Readiness::Zendesk::OAuthTokens.find!(client, 223443)
|
115
|
+
# pp oauth_token.client_id
|
116
|
+
# # => 1234
|
117
|
+
def self.find!(client, tid)
|
118
|
+
response = client.connection.get("oauth/tokens/#{tid}")
|
119
|
+
handle_request_error(1, 'Zendesk', response.status, { action: 'Find OAuth token', id: tid }) unless response.status == 200
|
120
|
+
OAuthTokens.new(Oj.load(response.body)['token'])
|
121
|
+
end
|
122
|
+
|
41
123
|
##
|
42
124
|
# Creates an Oauth token. Will exit if unsuccessful.
|
43
125
|
#
|
@@ -65,9 +147,35 @@ module Readiness
|
|
65
147
|
# # => "4v8AR9vXCM7dV4murXlIaBAAzDrAw9lIbaHF7X9VbVPtOABAyy3dnTtHE3A6AdNC"
|
66
148
|
def self.create!(client, token)
|
67
149
|
pp to_clean_json_with_key(token, 'token')
|
68
|
-
|
69
|
-
|
70
|
-
|
150
|
+
response = client.connection.post 'oauth/tokens', to_clean_json_with_key(token, 'token')
|
151
|
+
handle_request_error(1, 'Zendesk', response.status, { action: 'Create Oauth token', message: Oj.load(response.body)}) unless response.status == 201
|
152
|
+
OAuthTokens.new(Oj.load(response.body)['token'])
|
153
|
+
end
|
154
|
+
|
155
|
+
##
|
156
|
+
# Revkokes an OAuth token. Will exit if unsuccessful
|
157
|
+
#
|
158
|
+
# @author Jason Colyer
|
159
|
+
# @since 1.0.132
|
160
|
+
# @param client [Object] An instance of {Readiness::Zendesk::Client}
|
161
|
+
# @param token [Object] An instance of {Readiness::Zendesk::OAuthTokens}
|
162
|
+
# @return [Boolean]
|
163
|
+
# @see https://developer.zendesk.com/api-reference/ticketing/oauth/oauth_tokens/#revoke-token Zendesk API > OAuth Tokens > Revoke Token
|
164
|
+
# @example
|
165
|
+
# require 'support_readiness'
|
166
|
+
# config = Readiness::Zendesk::Configuration.new
|
167
|
+
# config.username = 'alice@example.com'
|
168
|
+
# config.token = 'test123abc'
|
169
|
+
# config.url = 'https://example.zendesk.com/api/v2'
|
170
|
+
# client = Readiness::Zendesk::Client.new(config)
|
171
|
+
# oauth_token = Readiness::Zendesk::OAuthTokens.find!(client, 223443)
|
172
|
+
# revoke = Readiness::Zendesk::OAuthTokens.revoke!(client, oauth_token)
|
173
|
+
# pp revoke
|
174
|
+
# # => true
|
175
|
+
def self.revoke!(client, token)
|
176
|
+
response = client.connection.delete "oauth/tokens/#{token.id}"
|
177
|
+
handle_request_error(1, 'Zendesk', response.status, { action: 'Revoke a token', id: token.id, message: Oj.load(response.body)}) unless response.status == 204
|
178
|
+
true
|
71
179
|
end
|
72
180
|
end
|
73
181
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab_support_readiness
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.133
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Colyer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-04-
|
11
|
+
date: 2025-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|