rujira 0.4.0 → 0.5.1
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/CHANGELOG.md +15 -16
- data/README.md +0 -6
- data/compose.yaml +1 -1
- data/examples/create_issue_in_sprint.rb +3 -1
- data/lib/rujira/api/application_properties.rb +28 -11
- data/lib/rujira/api/applicationrole.rb +12 -10
- data/lib/rujira/api/attachments.rb +20 -13
- data/lib/rujira/api/avatar.rb +7 -5
- data/lib/rujira/api/board.rb +41 -7
- data/lib/rujira/api/comment.rb +1 -1
- data/lib/rujira/api/common.rb +12 -5
- data/lib/rujira/api/configuration.rb +15 -2
- data/lib/rujira/api/custom_fields.rb +20 -7
- data/lib/rujira/api/dashboard.rb +19 -5
- data/lib/rujira/api/field.rb +15 -5
- data/lib/rujira/api/filter.rb +42 -39
- data/lib/rujira/api/issue/comments.rb +57 -77
- data/lib/rujira/api/issue/watchers.rb +44 -49
- data/lib/rujira/api/issue.rb +74 -280
- data/lib/rujira/api/myself.rb +10 -11
- data/lib/rujira/api/permissions.rb +13 -15
- data/lib/rujira/api/project.rb +14 -16
- data/lib/rujira/api/search.rb +8 -5
- data/lib/rujira/api/server_info.rb +7 -5
- data/lib/rujira/api/sprint.rb +39 -17
- data/lib/rujira/client.rb +34 -28
- data/lib/rujira/version.rb +1 -1
- metadata +1 -1
data/lib/rujira/api/issue.rb
CHANGED
|
@@ -6,6 +6,9 @@ require_relative 'issue/comments'
|
|
|
6
6
|
module Rujira
|
|
7
7
|
module Api
|
|
8
8
|
# Provides access to Jira issues via the REST API.
|
|
9
|
+
# Includes support for creating, updating, deleting, archiving issues,
|
|
10
|
+
# managing assignees, comments, remote links, transitions, watchers, and attachments.
|
|
11
|
+
#
|
|
9
12
|
# API reference:
|
|
10
13
|
# https://docs.atlassian.com/software/jira/docs/api/REST/9.17.0/#api/2/issue
|
|
11
14
|
#
|
|
@@ -15,17 +18,11 @@ module Rujira
|
|
|
15
18
|
|
|
16
19
|
# Creates a new issue.
|
|
17
20
|
#
|
|
18
|
-
# @yield [builder] Optional block to configure
|
|
21
|
+
# @yield [builder] Optional block to configure payload (fields, description, etc.).
|
|
19
22
|
# @return [Object] The API response containing the created issue.
|
|
20
|
-
#
|
|
21
|
-
# @example Create an issue
|
|
23
|
+
# @example
|
|
22
24
|
# client.Issue.create do
|
|
23
|
-
# payload fields: {
|
|
24
|
-
# summary: "New bug report",
|
|
25
|
-
# issuetype: { name: 'Task' },
|
|
26
|
-
# project: { key: "TEST" },
|
|
27
|
-
# description: 'This task was generated by the bot when creating changes in the repository.'
|
|
28
|
-
# }
|
|
25
|
+
# payload fields: { summary: "New bug", issuetype: { name: 'Task' }, project: { key: "TEST" } }
|
|
29
26
|
# end
|
|
30
27
|
#
|
|
31
28
|
def create(&block)
|
|
@@ -34,20 +31,16 @@ module Rujira
|
|
|
34
31
|
method :post
|
|
35
32
|
instance_eval(&block) if block_given?
|
|
36
33
|
end
|
|
37
|
-
|
|
34
|
+
call
|
|
38
35
|
end
|
|
39
36
|
|
|
40
37
|
# Creates multiple issues in bulk.
|
|
41
38
|
#
|
|
42
|
-
# @yield [builder] Block to configure
|
|
43
|
-
# @return [Object]
|
|
44
|
-
#
|
|
45
|
-
# @example Create issues in bulk
|
|
39
|
+
# @yield [builder] Block to configure bulk payload.
|
|
40
|
+
# @return [Object] API response after creating issues.
|
|
41
|
+
# @example
|
|
46
42
|
# client.Issue.create_bulk do
|
|
47
|
-
# payload issues: [
|
|
48
|
-
# { fields: { project: { key: "TEST" }, summary: "Issue 1", issuetype: { name: "Task" } } },
|
|
49
|
-
# { fields: { project: { key: "TEST" }, summary: "Issue 2", issuetype: { name: "Bug" } } }
|
|
50
|
-
# ]
|
|
43
|
+
# payload issues: [{ fields: { summary: "Issue 1", project: { key: "TEST" }, issuetype: { name: "Task" } } }]
|
|
51
44
|
# end
|
|
52
45
|
#
|
|
53
46
|
def create_bulk(&block)
|
|
@@ -56,36 +49,30 @@ module Rujira
|
|
|
56
49
|
method :post
|
|
57
50
|
instance_eval(&block) if block_given?
|
|
58
51
|
end
|
|
59
|
-
|
|
52
|
+
call
|
|
60
53
|
end
|
|
61
54
|
|
|
62
|
-
# Retrieves an issue by
|
|
55
|
+
# Retrieves an issue by ID or key.
|
|
63
56
|
#
|
|
64
57
|
# @param [String] id_or_key The issue ID or key.
|
|
65
|
-
# @yield [builder] Optional block to configure
|
|
66
|
-
# @return [Object] The API response containing
|
|
67
|
-
#
|
|
68
|
-
# @example Get an issue
|
|
58
|
+
# @yield [builder] Optional block to configure additional request parameters or headers.
|
|
59
|
+
# @return [Object] The API response containing issue details.
|
|
60
|
+
# @example
|
|
69
61
|
# client.Issue.get("TEST-123")
|
|
70
|
-
#
|
|
71
62
|
def get(id_or_key, &block)
|
|
72
63
|
abort 'Issue ID or KEY is required' if id_or_key.to_s.strip.empty?
|
|
73
64
|
builder do
|
|
74
65
|
path "issue/#{id_or_key}"
|
|
75
66
|
instance_eval(&block) if block_given?
|
|
76
67
|
end
|
|
77
|
-
|
|
68
|
+
call
|
|
78
69
|
end
|
|
79
70
|
|
|
80
|
-
# Deletes an issue by
|
|
71
|
+
# Deletes an issue by ID or key.
|
|
81
72
|
#
|
|
82
73
|
# @param [String] id_or_key The issue ID or key.
|
|
83
|
-
# @yield [builder] Optional block to configure
|
|
84
|
-
# @return [Object]
|
|
85
|
-
#
|
|
86
|
-
# @example Delete an issue
|
|
87
|
-
# client.Issue.delete("TEST-123")
|
|
88
|
-
#
|
|
74
|
+
# @yield [builder] Optional block to configure additional request parameters.
|
|
75
|
+
# @return [Object] API response after deletion.
|
|
89
76
|
def delete(id_or_key, &block)
|
|
90
77
|
abort 'Issue ID or KEY is required' if id_or_key.to_s.strip.empty?
|
|
91
78
|
builder do
|
|
@@ -93,22 +80,15 @@ module Rujira
|
|
|
93
80
|
method :delete
|
|
94
81
|
instance_eval(&block) if block_given?
|
|
95
82
|
end
|
|
96
|
-
|
|
83
|
+
call
|
|
97
84
|
end
|
|
98
|
-
|
|
99
85
|
alias del delete
|
|
100
86
|
|
|
101
87
|
# Updates an existing issue.
|
|
102
88
|
#
|
|
103
89
|
# @param [String] id_or_key The issue ID or key.
|
|
104
90
|
# @yield [builder] Optional block to configure the update payload.
|
|
105
|
-
# @return [Object]
|
|
106
|
-
#
|
|
107
|
-
# @example Edit an issue
|
|
108
|
-
# client.Issue.edit("TEST-123") do
|
|
109
|
-
# payload fields: { summary: "Updated summary" }
|
|
110
|
-
# end
|
|
111
|
-
#
|
|
91
|
+
# @return [Object] API response after updating.
|
|
112
92
|
def edit(id_or_key, &block)
|
|
113
93
|
abort 'Issue ID or KEY is required' if id_or_key.to_s.strip.empty?
|
|
114
94
|
builder do
|
|
@@ -116,96 +96,72 @@ module Rujira
|
|
|
116
96
|
method :put
|
|
117
97
|
instance_eval(&block) if block_given?
|
|
118
98
|
end
|
|
119
|
-
|
|
99
|
+
call
|
|
120
100
|
end
|
|
121
101
|
|
|
122
|
-
# Archives an issue
|
|
102
|
+
# Archives an issue.
|
|
123
103
|
#
|
|
124
104
|
# @param [String] id_or_key The issue ID or key.
|
|
125
|
-
# @
|
|
126
|
-
#
|
|
127
|
-
|
|
128
|
-
# client.Issue.archive("TEST-123")
|
|
129
|
-
#
|
|
130
|
-
def archive(id_or_key)
|
|
105
|
+
# @yield [builder] Optional block for additional params.
|
|
106
|
+
# @return [Object] API response after archiving.
|
|
107
|
+
def archive(id_or_key, &block)
|
|
131
108
|
abort 'Issue ID or KEY is required' if id_or_key.to_s.strip.empty?
|
|
132
109
|
builder do
|
|
133
110
|
path "issue/#{id_or_key}/archive"
|
|
134
111
|
method :put
|
|
112
|
+
instance_eval(&block) if block_given?
|
|
135
113
|
end
|
|
136
|
-
|
|
114
|
+
call
|
|
137
115
|
end
|
|
138
116
|
|
|
139
|
-
#
|
|
117
|
+
# Lists archived information of an issue.
|
|
140
118
|
#
|
|
141
119
|
# @param [String] id_or_key The issue ID or key.
|
|
142
|
-
# @
|
|
143
|
-
#
|
|
144
|
-
|
|
145
|
-
# client.Issue.list_archive("TEST-123")
|
|
146
|
-
def list_archive(id_or_key)
|
|
120
|
+
# @yield [builder] Optional block to add query parameters.
|
|
121
|
+
# @return [Object] API response with archive details.
|
|
122
|
+
def list_archive(id_or_key, &block)
|
|
147
123
|
abort 'Issue ID or KEY is required' if id_or_key.to_s.strip.empty?
|
|
148
124
|
builder do
|
|
149
125
|
path "issue/#{id_or_key}/archive"
|
|
126
|
+
instance_eval(&block) if block_given?
|
|
150
127
|
end
|
|
151
|
-
|
|
128
|
+
call
|
|
152
129
|
end
|
|
153
130
|
|
|
154
131
|
# Updates the assignee of an issue.
|
|
155
132
|
#
|
|
156
|
-
# @param [String] id_or_key
|
|
157
|
-
# @yield [builder] Block to configure
|
|
158
|
-
# @return [Object]
|
|
159
|
-
|
|
160
|
-
# @example Assign an issue to a user
|
|
161
|
-
# client.Issue.assignee("TEST-123") do
|
|
162
|
-
# payload name: "john.doe"
|
|
163
|
-
# end
|
|
164
|
-
#
|
|
165
|
-
def assignee(id_or_key)
|
|
133
|
+
# @param [String] id_or_key Issue ID or key.
|
|
134
|
+
# @yield [builder] Block to configure assignee payload.
|
|
135
|
+
# @return [Object] API response after assignment.
|
|
136
|
+
def assignee(id_or_key, &block)
|
|
166
137
|
abort 'Issue ID or KEY is required' if id_or_key.to_s.strip.empty?
|
|
167
138
|
builder do
|
|
168
139
|
path "issue/#{id_or_key}/assignee"
|
|
169
140
|
method :put
|
|
141
|
+
instance_eval(&block) if block_given?
|
|
170
142
|
end
|
|
171
|
-
|
|
143
|
+
call
|
|
172
144
|
end
|
|
173
145
|
|
|
174
|
-
# Retrieves
|
|
175
|
-
# This provides information about which fields can be edited and their constraints.
|
|
176
|
-
#
|
|
177
|
-
# @param [String] id_or_key The issue ID or key.
|
|
178
|
-
# @yield [builder] Optional block to configure additional request parameters.
|
|
179
|
-
# @return [Object] The API response containing edit metadata.
|
|
146
|
+
# Retrieves edit metadata for an issue.
|
|
180
147
|
#
|
|
181
|
-
# @
|
|
182
|
-
#
|
|
183
|
-
#
|
|
184
|
-
# params expand: "projects,issuetypes.fields"
|
|
185
|
-
# end
|
|
148
|
+
# @param [String] id_or_key Issue ID or key.
|
|
149
|
+
# @yield [builder] Optional block to configure query parameters.
|
|
150
|
+
# @return [Object] API response with editable fields and constraints.
|
|
186
151
|
def editmeta(id_or_key, &block)
|
|
187
152
|
abort 'Issue ID or KEY is required' if id_or_key.to_s.strip.empty?
|
|
188
153
|
builder do
|
|
189
154
|
path "issue/#{id_or_key}/editmeta"
|
|
190
155
|
instance_eval(&block) if block_given?
|
|
191
156
|
end
|
|
192
|
-
|
|
157
|
+
call
|
|
193
158
|
end
|
|
194
159
|
|
|
195
|
-
# Sends a notification about
|
|
196
|
-
#
|
|
197
|
-
# @param [String] id_or_key The issue ID or key.
|
|
198
|
-
# @yield [builder] Block to configure the payload for the notification.
|
|
199
|
-
# @return [Object] The API response after sending the notification.
|
|
160
|
+
# Sends a notification about an issue.
|
|
200
161
|
#
|
|
201
|
-
# @
|
|
202
|
-
#
|
|
203
|
-
#
|
|
204
|
-
# subject: "Issue Update",
|
|
205
|
-
# textBody: "The issue has been updated.",
|
|
206
|
-
# to: [{ type: "user", username: "john.doe" }]
|
|
207
|
-
# }
|
|
208
|
-
# end
|
|
162
|
+
# @param [String] id_or_key Issue ID or key.
|
|
163
|
+
# @yield [builder] Block to configure notification payload.
|
|
164
|
+
# @return [Object] API response after sending notification.
|
|
209
165
|
def notify(id_or_key, &block)
|
|
210
166
|
abort 'Issue ID or KEY is required' if id_or_key.to_s.strip.empty?
|
|
211
167
|
builder do
|
|
@@ -213,172 +169,34 @@ module Rujira
|
|
|
213
169
|
path "issue/#{id_or_key}/notify"
|
|
214
170
|
instance_eval(&block) if block_given?
|
|
215
171
|
end
|
|
216
|
-
|
|
217
|
-
end
|
|
218
|
-
|
|
219
|
-
# Retrieves remote links for a given issue.
|
|
220
|
-
#
|
|
221
|
-
# @param [String] id_or_key The issue ID or key.
|
|
222
|
-
# @yield [builder] Optional block to configure additional request parameters.
|
|
223
|
-
# @return [Object] The API response containing remote links.
|
|
224
|
-
#
|
|
225
|
-
# @example Get remote links for an issue
|
|
226
|
-
# client.Issue.remotelink("TEST-123") do
|
|
227
|
-
# # Optional: add query parameters or headers
|
|
228
|
-
# params expand: "application"
|
|
229
|
-
# end
|
|
230
|
-
def remotelink(id_or_key, &block)
|
|
231
|
-
abort 'Issue ID or KEY is required' if id_or_key.to_s.strip.empty?
|
|
232
|
-
builder do
|
|
233
|
-
path "issue/#{id_or_key}/remotelink"
|
|
234
|
-
instance_eval(&block) if block_given?
|
|
235
|
-
end
|
|
236
|
-
run
|
|
172
|
+
call
|
|
237
173
|
end
|
|
238
174
|
|
|
239
|
-
#
|
|
175
|
+
# Uploads an attachment to an issue.
|
|
240
176
|
#
|
|
241
|
-
# @param [String] id_or_key
|
|
242
|
-
# @
|
|
243
|
-
# @
|
|
244
|
-
#
|
|
245
|
-
|
|
246
|
-
# client.Issue.create_remotelink("TEST-123") do
|
|
247
|
-
# payload {
|
|
248
|
-
# object: {
|
|
249
|
-
# url: "https://example.com/task/123",
|
|
250
|
-
# title: "External Task"
|
|
251
|
-
# }
|
|
252
|
-
# }
|
|
253
|
-
# end
|
|
254
|
-
def create_remotelink(id_or_key, &block)
|
|
177
|
+
# @param [String] id_or_key Issue ID or key.
|
|
178
|
+
# @param [String] path Local path to file.
|
|
179
|
+
# @yield [builder] Optional block to configure request.
|
|
180
|
+
# @return [Object] API response after attachment.
|
|
181
|
+
def create_attachments(id_or_key, path, &block)
|
|
255
182
|
abort 'Issue ID or KEY is required' if id_or_key.to_s.strip.empty?
|
|
183
|
+
client = @client
|
|
256
184
|
builder do
|
|
185
|
+
path "issue/#{id_or_key}/attachments"
|
|
257
186
|
method :post
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
end
|
|
261
|
-
run
|
|
262
|
-
end
|
|
263
|
-
|
|
264
|
-
# Deletes remote links for a given issue.
|
|
265
|
-
#
|
|
266
|
-
# @param [String] id_or_key The issue ID or key.
|
|
267
|
-
# @yield [builder] Optional block to configure additional request parameters.
|
|
268
|
-
# @return [Object] The API response after deleting the remote link(s).
|
|
269
|
-
#
|
|
270
|
-
# @example Delete remote links for an issue
|
|
271
|
-
# client.Issue.delete_remotelink("TEST-123") do
|
|
272
|
-
# # Optional: add query parameters or headers if needed
|
|
273
|
-
# params globalId: "com.example:task-123"
|
|
274
|
-
# end
|
|
275
|
-
def delete_remotelink(id_or_key, &block)
|
|
276
|
-
abort 'Issue ID or KEY is required' if id_or_key.to_s.strip.empty?
|
|
277
|
-
builder do
|
|
278
|
-
method :delete
|
|
279
|
-
path "issue/#{id_or_key}/remotelink"
|
|
280
|
-
instance_eval(&block) if block_given?
|
|
281
|
-
end
|
|
282
|
-
run
|
|
283
|
-
end
|
|
284
|
-
|
|
285
|
-
# Retrieves a specific remote link for a given issue.
|
|
286
|
-
#
|
|
287
|
-
# @param [String] id_or_key The issue ID or key.
|
|
288
|
-
# @param [String] link_id The remote link ID.
|
|
289
|
-
# @yield [builder] Optional block to configure additional request parameters.
|
|
290
|
-
# @return [Object] The API response containing the remote link details.
|
|
291
|
-
#
|
|
292
|
-
# @example Get a specific remote link
|
|
293
|
-
# client.Issue.get_remotelink_by_id("TEST-123", "20001") do
|
|
294
|
-
# # Optional: add headers or query parameters
|
|
295
|
-
# end
|
|
296
|
-
def get_remotelink_by_id(id_or_key, link_id, &block)
|
|
297
|
-
abort 'Issue ID or KEY is required' if id_or_key.to_s.strip.empty?
|
|
298
|
-
builder do
|
|
299
|
-
path "issue/#{id_or_key}/remotelink/#{link_id}"
|
|
300
|
-
instance_eval(&block) if block_given?
|
|
301
|
-
end
|
|
302
|
-
run
|
|
303
|
-
end
|
|
304
|
-
|
|
305
|
-
# Updates a specific remote link for a given issue.
|
|
306
|
-
#
|
|
307
|
-
# @param [String] id_or_key The issue ID or key.
|
|
308
|
-
# @param [String] link_id The remote link ID.
|
|
309
|
-
# @yield [builder] Block to configure the payload for updating the remote link.
|
|
310
|
-
# @return [Object] The API response after updating the remote link.
|
|
311
|
-
#
|
|
312
|
-
# @example Update a specific remote link
|
|
313
|
-
# client.Issue.update_remotelink("TEST-123", "20001") do
|
|
314
|
-
# payload {
|
|
315
|
-
# object: {
|
|
316
|
-
# url: "https://example.com/updated-task/123",
|
|
317
|
-
# title: "Updated Task"
|
|
318
|
-
# }
|
|
319
|
-
# }
|
|
320
|
-
# end
|
|
321
|
-
def update_remotelink(id_or_key, link_id, &block)
|
|
322
|
-
abort 'Issue ID or KEY is required' if id_or_key.to_s.strip.empty?
|
|
323
|
-
builder do
|
|
324
|
-
method :put
|
|
325
|
-
path "issue/#{id_or_key}/remotelink/#{link_id}"
|
|
326
|
-
instance_eval(&block) if block_given?
|
|
327
|
-
end
|
|
328
|
-
run
|
|
329
|
-
end
|
|
330
|
-
|
|
331
|
-
# Deletes a specific remote link by its ID for a given issue.
|
|
332
|
-
#
|
|
333
|
-
# @param [String] id_or_key The issue ID or key.
|
|
334
|
-
# @param [String] link_id The remote link ID.
|
|
335
|
-
# @yield [builder] Optional block to configure additional request parameters.
|
|
336
|
-
# @return [Object] The API response after deleting the remote link.
|
|
337
|
-
#
|
|
338
|
-
# @example Delete a specific remote link
|
|
339
|
-
# client.Issue.delete_remotelink_by_id("TEST-123", "20001") do
|
|
340
|
-
# # Optional: add headers or query parameters
|
|
341
|
-
# end
|
|
342
|
-
def delete_remotelink_by_id(id_or_key, link_id, &block)
|
|
343
|
-
abort 'Issue ID or KEY is required' if id_or_key.to_s.strip.empty?
|
|
344
|
-
builder do
|
|
345
|
-
method :delete
|
|
346
|
-
path "issue/#{id_or_key}/remotelink/#{link_id}"
|
|
347
|
-
instance_eval(&block) if block_given?
|
|
348
|
-
end
|
|
349
|
-
run
|
|
350
|
-
end
|
|
351
|
-
|
|
352
|
-
# Restores a previously archived issue.
|
|
353
|
-
#
|
|
354
|
-
# @param [String] id_or_key The issue ID or key.
|
|
355
|
-
# @yield [builder] Optional block to configure additional request parameters.
|
|
356
|
-
# @return [Object] The API response after restoring the issue.
|
|
357
|
-
#
|
|
358
|
-
# @example Restore an issue
|
|
359
|
-
# client.Issue.restore("TEST-123") do
|
|
360
|
-
# # Optional: add headers or payload if needed
|
|
361
|
-
# end
|
|
362
|
-
def restore(id_or_key, &block)
|
|
363
|
-
abort 'Issue ID or KEY is required' if id_or_key.to_s.strip.empty?
|
|
364
|
-
builder do
|
|
365
|
-
method :put
|
|
366
|
-
path "issue/#{id_or_key}/restore"
|
|
187
|
+
headers 'X-Atlassian-Token': 'no-check'
|
|
188
|
+
payload file: client.file(path)
|
|
367
189
|
instance_eval(&block) if block_given?
|
|
368
190
|
end
|
|
369
|
-
|
|
191
|
+
call
|
|
370
192
|
end
|
|
193
|
+
alias attachments create_attachments
|
|
371
194
|
|
|
372
|
-
# Performs a transition on
|
|
373
|
-
#
|
|
374
|
-
# @param [String] id_or_key The issue ID or key.
|
|
375
|
-
# @yield [builder] Block to configure the payload for the transition.
|
|
376
|
-
# @return [Object] The API response after performing the transition.
|
|
195
|
+
# Performs a transition on an issue.
|
|
377
196
|
#
|
|
378
|
-
# @
|
|
379
|
-
#
|
|
380
|
-
#
|
|
381
|
-
# end
|
|
197
|
+
# @param [String] id_or_key Issue ID or key.
|
|
198
|
+
# @yield [builder] Block to configure transition payload.
|
|
199
|
+
# @return [Object] API response after transition.
|
|
382
200
|
def transitions(id_or_key, &block)
|
|
383
201
|
abort 'Issue ID or KEY is required' if id_or_key.to_s.strip.empty?
|
|
384
202
|
builder do
|
|
@@ -386,48 +204,24 @@ module Rujira
|
|
|
386
204
|
path "issue/#{id_or_key}/transitions"
|
|
387
205
|
instance_eval(&block) if block_given?
|
|
388
206
|
end
|
|
389
|
-
|
|
207
|
+
call
|
|
390
208
|
end
|
|
391
209
|
|
|
392
|
-
# Retrieves available transitions for
|
|
393
|
-
#
|
|
394
|
-
# @param [String] id_or_key The issue ID or key.
|
|
395
|
-
# @yield [builder] Optional block to configure additional request parameters.
|
|
396
|
-
# @return [Object] The API response containing available transitions.
|
|
210
|
+
# Retrieves available transitions for an issue.
|
|
397
211
|
#
|
|
398
|
-
# @
|
|
399
|
-
#
|
|
400
|
-
#
|
|
401
|
-
# end
|
|
212
|
+
# @param [String] id_or_key Issue ID or key.
|
|
213
|
+
# @yield [builder] Optional block to add query parameters.
|
|
214
|
+
# @return [Object] API response with available transitions.
|
|
402
215
|
def get_transitions(id_or_key, &block)
|
|
403
216
|
abort 'Issue ID or KEY is required' if id_or_key.to_s.strip.empty?
|
|
404
217
|
builder do
|
|
405
218
|
path "issue/#{id_or_key}/transitions"
|
|
406
219
|
instance_eval(&block) if block_given?
|
|
407
220
|
end
|
|
408
|
-
|
|
221
|
+
call
|
|
409
222
|
end
|
|
410
223
|
|
|
411
|
-
#
|
|
412
|
-
#
|
|
413
|
-
# @param [String] id_or_key The issue ID or key to which the file will be attached.
|
|
414
|
-
# @param [String] path The local file path of the attachment to upload.
|
|
415
|
-
# @yield [builder] Optional block to customize the request builder.
|
|
416
|
-
# @return [Object] The API response after executing the request.
|
|
417
|
-
#
|
|
418
|
-
def create_attachments(id_or_key, path, &block)
|
|
419
|
-
abort 'Issue ID or KEY is required' if id_or_key.to_s.strip.empty?
|
|
420
|
-
client = @client
|
|
421
|
-
builder do
|
|
422
|
-
path "issue/#{id_or_key}/attachments"
|
|
423
|
-
method :post
|
|
424
|
-
headers 'X-Atlassian-Token': 'no-check'
|
|
425
|
-
payload file: client.file(path)
|
|
426
|
-
instance_eval(&block) if block_given?
|
|
427
|
-
end
|
|
428
|
-
run
|
|
429
|
-
end
|
|
430
|
-
alias attachments create_attachments
|
|
224
|
+
# NOTE: Watchers and Comments modules are included separately.
|
|
431
225
|
end
|
|
432
226
|
end
|
|
433
227
|
end
|
data/lib/rujira/api/myself.rb
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
module Rujira
|
|
4
4
|
module Api
|
|
5
5
|
# Provides access to the Jira "Myself" resource via the REST API.
|
|
6
|
-
# Allows retrieving details about the currently authenticated user
|
|
6
|
+
# Allows retrieving and updating details about the currently authenticated user,
|
|
7
|
+
# including password changes.
|
|
7
8
|
#
|
|
8
9
|
# API reference:
|
|
9
10
|
# https://docs.atlassian.com/software/jira/docs/api/REST/9.17.0/#api/2/myself
|
|
@@ -11,23 +12,22 @@ module Rujira
|
|
|
11
12
|
class Myself < Common
|
|
12
13
|
# Retrieves details of the currently authenticated user.
|
|
13
14
|
#
|
|
15
|
+
# @yield [builder] Optional block to configure additional request parameters.
|
|
14
16
|
# @return [Object] The API response containing user details.
|
|
15
|
-
#
|
|
16
17
|
# @example Get current user details
|
|
17
18
|
# client.Myself.get
|
|
18
|
-
|
|
19
|
-
def get
|
|
19
|
+
def get(&block)
|
|
20
20
|
builder do
|
|
21
21
|
path 'myself'
|
|
22
|
+
instance_eval(&block) if block_given?
|
|
22
23
|
end
|
|
23
|
-
|
|
24
|
+
call
|
|
24
25
|
end
|
|
25
26
|
|
|
26
27
|
# Updates the current user's profile.
|
|
27
28
|
#
|
|
28
29
|
# @yield [builder] Block to configure the payload or additional request parameters.
|
|
29
30
|
# @return [Object] The API response after updating the user profile.
|
|
30
|
-
#
|
|
31
31
|
# @example Update user profile
|
|
32
32
|
# client.Myself.update do
|
|
33
33
|
# payload({ displayName: "New Name", emailAddress: "new@example.com" })
|
|
@@ -38,17 +38,16 @@ module Rujira
|
|
|
38
38
|
path 'myself'
|
|
39
39
|
instance_eval(&block) if block_given?
|
|
40
40
|
end
|
|
41
|
-
|
|
41
|
+
call
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
# Changes the current user's password.
|
|
45
45
|
#
|
|
46
|
-
# @yield [builder] Block to configure the payload for
|
|
46
|
+
# @yield [builder] Block to configure the payload for password change.
|
|
47
47
|
# @return [Object] The API response after changing the password.
|
|
48
|
-
#
|
|
49
48
|
# @example Change user password
|
|
50
49
|
# client.Myself.password do
|
|
51
|
-
# payload({ password: "
|
|
50
|
+
# payload({ currentPassword: "oldpass", password: "newpass123" })
|
|
52
51
|
# end
|
|
53
52
|
def password(&block)
|
|
54
53
|
builder do
|
|
@@ -56,7 +55,7 @@ module Rujira
|
|
|
56
55
|
path 'myself'
|
|
57
56
|
instance_eval(&block) if block_given?
|
|
58
57
|
end
|
|
59
|
-
|
|
58
|
+
call
|
|
60
59
|
end
|
|
61
60
|
end
|
|
62
61
|
end
|
|
@@ -3,42 +3,40 @@
|
|
|
3
3
|
module Rujira
|
|
4
4
|
module Api
|
|
5
5
|
# Provides access to Jira permissions via the REST API.
|
|
6
|
-
# Allows listing all permission schemes
|
|
6
|
+
# Allows listing all permission schemes and the current user's permissions.
|
|
7
7
|
#
|
|
8
8
|
# API reference:
|
|
9
9
|
# https://docs.atlassian.com/software/jira/docs/api/REST/9.17.0/#api/2/permissions
|
|
10
10
|
#
|
|
11
11
|
class Permissions < Common
|
|
12
|
-
# Retrieves the list of all
|
|
12
|
+
# Retrieves the list of all permission schemes in Jira.
|
|
13
13
|
#
|
|
14
|
-
# @yield [builder] Optional block to configure
|
|
14
|
+
# @yield [builder] Optional block to configure additional request parameters.
|
|
15
15
|
# @return [Object] The API response containing permissions details.
|
|
16
|
-
#
|
|
17
16
|
# @example List all permissions
|
|
18
17
|
# client.Permissions.list
|
|
19
|
-
|
|
20
|
-
def list
|
|
18
|
+
def list(&block)
|
|
21
19
|
builder do
|
|
22
20
|
path 'permissions'
|
|
23
21
|
method :get
|
|
22
|
+
instance_eval(&block) if block_given?
|
|
24
23
|
end
|
|
25
|
-
|
|
24
|
+
call
|
|
26
25
|
end
|
|
27
26
|
|
|
28
|
-
# Retrieves the
|
|
29
|
-
#
|
|
30
|
-
# @yield [builder] Optional block to configure the request.
|
|
31
|
-
# @return [Object] The API response containing permissions details.
|
|
27
|
+
# Retrieves the current user's permissions in Jira.
|
|
32
28
|
#
|
|
33
|
-
# @
|
|
29
|
+
# @yield [builder] Optional block to configure additional request parameters.
|
|
30
|
+
# @return [Object] The API response containing the current user's permissions.
|
|
31
|
+
# @example List current user's permissions
|
|
34
32
|
# client.Permissions.my
|
|
35
|
-
|
|
36
|
-
def my
|
|
33
|
+
def my(&block)
|
|
37
34
|
builder do
|
|
38
35
|
path 'mypermissions'
|
|
39
36
|
method :get
|
|
37
|
+
instance_eval(&block) if block_given?
|
|
40
38
|
end
|
|
41
|
-
|
|
39
|
+
call
|
|
42
40
|
end
|
|
43
41
|
end
|
|
44
42
|
end
|