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/field.rb
CHANGED
|
@@ -11,18 +11,27 @@ module Rujira
|
|
|
11
11
|
class Field < Common
|
|
12
12
|
# Retrieves all fields.
|
|
13
13
|
#
|
|
14
|
-
#
|
|
14
|
+
# Optional query parameters can be passed in a block, for example:
|
|
15
|
+
# - filtering by field type or custom criteria (if supported by Jira API)
|
|
16
|
+
#
|
|
17
|
+
# @yield [builder] Optional block to configure query parameters.
|
|
15
18
|
# @return [Object] The API response containing all fields.
|
|
16
19
|
#
|
|
17
20
|
# @example List all fields
|
|
18
21
|
# client.Field.get
|
|
19
22
|
# client.Field.list
|
|
20
23
|
#
|
|
21
|
-
|
|
24
|
+
# @example List all fields with custom params (if supported)
|
|
25
|
+
# client.Field.list do
|
|
26
|
+
# params type: "custom"
|
|
27
|
+
# end
|
|
28
|
+
#
|
|
29
|
+
def list(&block)
|
|
22
30
|
builder do
|
|
23
31
|
path 'field'
|
|
32
|
+
instance_eval(&block) if block_given?
|
|
24
33
|
end
|
|
25
|
-
|
|
34
|
+
call
|
|
26
35
|
end
|
|
27
36
|
alias get list
|
|
28
37
|
|
|
@@ -33,7 +42,8 @@ module Rujira
|
|
|
33
42
|
#
|
|
34
43
|
# @example Create a custom field
|
|
35
44
|
# client.Field.create do
|
|
36
|
-
# payload name: "My Field",
|
|
45
|
+
# payload name: "My Field",
|
|
46
|
+
# type: "com.atlassian.jira.plugin.system.customfieldtypes:textfield"
|
|
37
47
|
# end
|
|
38
48
|
#
|
|
39
49
|
def create(&block)
|
|
@@ -42,7 +52,7 @@ module Rujira
|
|
|
42
52
|
path 'field'
|
|
43
53
|
instance_eval(&block) if block_given?
|
|
44
54
|
end
|
|
45
|
-
|
|
55
|
+
call
|
|
46
56
|
end
|
|
47
57
|
end
|
|
48
58
|
end
|
data/lib/rujira/api/filter.rb
CHANGED
|
@@ -9,7 +9,7 @@ module Rujira
|
|
|
9
9
|
# API reference:
|
|
10
10
|
# https://docs.atlassian.com/software/jira/docs/api/REST/9.17.0/#api/2/filter
|
|
11
11
|
#
|
|
12
|
-
class Filter < Common
|
|
12
|
+
class Filter < Common # rubocop:disable Metrics/ClassLength
|
|
13
13
|
# Creates a new filter.
|
|
14
14
|
#
|
|
15
15
|
# @yield [builder] Block to configure the payload for the new filter.
|
|
@@ -26,7 +26,7 @@ module Rujira
|
|
|
26
26
|
path 'filter'
|
|
27
27
|
instance_eval(&block) if block_given?
|
|
28
28
|
end
|
|
29
|
-
|
|
29
|
+
call
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
# Updates an existing filter by ID.
|
|
@@ -46,44 +46,50 @@ module Rujira
|
|
|
46
46
|
path "filter/#{id}"
|
|
47
47
|
instance_eval(&block) if block_given?
|
|
48
48
|
end
|
|
49
|
-
|
|
49
|
+
call
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
# Deletes a filter by ID.
|
|
53
53
|
#
|
|
54
54
|
# @param [String] id The filter ID.
|
|
55
|
+
# @yield [builder] Optional block to add query parameters.
|
|
55
56
|
# @return [Object] The API response after deletion.
|
|
56
57
|
#
|
|
57
|
-
def delete(id)
|
|
58
|
+
def delete(id, &block)
|
|
58
59
|
builder do
|
|
59
60
|
method :delete
|
|
60
61
|
path "filter/#{id}"
|
|
62
|
+
instance_eval(&block) if block_given?
|
|
61
63
|
end
|
|
62
|
-
|
|
64
|
+
call
|
|
63
65
|
end
|
|
64
66
|
|
|
65
67
|
# Retrieves a filter by ID.
|
|
66
68
|
#
|
|
67
69
|
# @param [String] id The filter ID.
|
|
70
|
+
# @yield [builder] Optional block to add query parameters.
|
|
68
71
|
# @return [Object] The API response containing filter details.
|
|
69
72
|
#
|
|
70
|
-
def get(id)
|
|
73
|
+
def get(id, &block)
|
|
71
74
|
builder do
|
|
72
75
|
path "filter/#{id}"
|
|
76
|
+
instance_eval(&block) if block_given?
|
|
73
77
|
end
|
|
74
|
-
|
|
78
|
+
call
|
|
75
79
|
end
|
|
76
80
|
|
|
77
81
|
# Retrieves columns configuration of a filter.
|
|
78
82
|
#
|
|
79
83
|
# @param [String] id The filter ID.
|
|
84
|
+
# @yield [builder] Optional block to add query parameters.
|
|
80
85
|
# @return [Object] The API response with columns configuration.
|
|
81
86
|
#
|
|
82
|
-
def columns(id)
|
|
87
|
+
def columns(id, &block)
|
|
83
88
|
builder do
|
|
84
89
|
path "filter/#{id}/columns"
|
|
90
|
+
instance_eval(&block) if block_given?
|
|
85
91
|
end
|
|
86
|
-
|
|
92
|
+
call
|
|
87
93
|
end
|
|
88
94
|
|
|
89
95
|
# Updates columns configuration of a filter.
|
|
@@ -92,43 +98,42 @@ module Rujira
|
|
|
92
98
|
# @yield [builder] Block to configure the payload for columns.
|
|
93
99
|
# @return [Object] The API response after updating columns.
|
|
94
100
|
#
|
|
95
|
-
# @example Set columns for a filter
|
|
96
|
-
# client.Filter.set_columns("10001") do
|
|
97
|
-
# payload ["summary", "assignee", "status"]
|
|
98
|
-
# end
|
|
99
|
-
#
|
|
100
101
|
def set_columns(id, &block)
|
|
101
102
|
builder do
|
|
102
103
|
method :put
|
|
103
104
|
path "filter/#{id}/columns"
|
|
104
105
|
instance_eval(&block) if block_given?
|
|
105
106
|
end
|
|
106
|
-
|
|
107
|
+
call
|
|
107
108
|
end
|
|
108
109
|
|
|
109
110
|
# Resets columns of a filter to default.
|
|
110
111
|
#
|
|
111
112
|
# @param [String] id The filter ID.
|
|
113
|
+
# @yield [builder] Optional block to add query parameters.
|
|
112
114
|
# @return [Object] The API response after resetting columns.
|
|
113
115
|
#
|
|
114
|
-
def reset_columns(id)
|
|
116
|
+
def reset_columns(id, &block)
|
|
115
117
|
builder do
|
|
116
118
|
method :delete
|
|
117
119
|
path "filter/#{id}/columns"
|
|
120
|
+
instance_eval(&block) if block_given?
|
|
118
121
|
end
|
|
119
|
-
|
|
122
|
+
call
|
|
120
123
|
end
|
|
121
124
|
|
|
122
125
|
# Lists permissions of a filter.
|
|
123
126
|
#
|
|
124
127
|
# @param [String] id The filter ID.
|
|
128
|
+
# @yield [builder] Optional block to add query parameters.
|
|
125
129
|
# @return [Object] The API response containing permissions.
|
|
126
130
|
#
|
|
127
|
-
def list_permission(id)
|
|
131
|
+
def list_permission(id, &block)
|
|
128
132
|
builder do
|
|
129
133
|
path "filter/#{id}/permission"
|
|
134
|
+
instance_eval(&block) if block_given?
|
|
130
135
|
end
|
|
131
|
-
|
|
136
|
+
call
|
|
132
137
|
end
|
|
133
138
|
|
|
134
139
|
# Adds a permission to a filter.
|
|
@@ -137,56 +142,57 @@ module Rujira
|
|
|
137
142
|
# @yield [builder] Block to configure the permission payload.
|
|
138
143
|
# @return [Object] The API response after adding permission.
|
|
139
144
|
#
|
|
140
|
-
# @example Add permission to a filter
|
|
141
|
-
# client.Filter.add_permission("10001") do
|
|
142
|
-
# payload type: "group", groupname: "jira-users"
|
|
143
|
-
# end
|
|
144
|
-
#
|
|
145
145
|
def add_permission(id, &block)
|
|
146
146
|
builder do
|
|
147
147
|
method :post
|
|
148
148
|
path "filter/#{id}/permission"
|
|
149
149
|
instance_eval(&block) if block_given?
|
|
150
150
|
end
|
|
151
|
-
|
|
151
|
+
call
|
|
152
152
|
end
|
|
153
153
|
|
|
154
154
|
# Retrieves a specific permission of a filter.
|
|
155
155
|
#
|
|
156
156
|
# @param [String] id The filter ID.
|
|
157
157
|
# @param [String] permission_id The permission ID.
|
|
158
|
+
# @yield [builder] Optional block to add query parameters.
|
|
158
159
|
# @return [Object] The API response containing the permission details.
|
|
159
160
|
#
|
|
160
|
-
def permission(id, permission_id)
|
|
161
|
+
def permission(id, permission_id, &block)
|
|
161
162
|
builder do
|
|
162
163
|
path "filter/#{id}/permission/#{permission_id}"
|
|
164
|
+
instance_eval(&block) if block_given?
|
|
163
165
|
end
|
|
164
|
-
|
|
166
|
+
call
|
|
165
167
|
end
|
|
166
168
|
|
|
167
169
|
# Deletes a specific permission of a filter.
|
|
168
170
|
#
|
|
169
171
|
# @param [String] id The filter ID.
|
|
170
172
|
# @param [String] permission_id The permission ID.
|
|
173
|
+
# @yield [builder] Optional block to add query parameters.
|
|
171
174
|
# @return [Object] The API response after deletion.
|
|
172
175
|
#
|
|
173
|
-
def delete_permission(id, permission_id)
|
|
176
|
+
def delete_permission(id, permission_id, &block)
|
|
174
177
|
builder do
|
|
175
178
|
method :delete
|
|
176
179
|
path "filter/#{id}/permission/#{permission_id}"
|
|
180
|
+
instance_eval(&block) if block_given?
|
|
177
181
|
end
|
|
178
|
-
|
|
182
|
+
call
|
|
179
183
|
end
|
|
180
184
|
|
|
181
185
|
# Retrieves the default share scope of filters.
|
|
182
186
|
#
|
|
187
|
+
# @yield [builder] Optional block to add query parameters.
|
|
183
188
|
# @return [Object] The API response with default share scope.
|
|
184
189
|
#
|
|
185
|
-
def default_share_scope
|
|
190
|
+
def default_share_scope(&block)
|
|
186
191
|
builder do
|
|
187
192
|
path 'filter/defaultShareScope'
|
|
193
|
+
instance_eval(&block) if block_given?
|
|
188
194
|
end
|
|
189
|
-
|
|
195
|
+
call
|
|
190
196
|
end
|
|
191
197
|
|
|
192
198
|
# Updates the default share scope of filters.
|
|
@@ -194,29 +200,26 @@ module Rujira
|
|
|
194
200
|
# @yield [builder] Block to configure the payload.
|
|
195
201
|
# @return [Object] The API response after updating default share scope.
|
|
196
202
|
#
|
|
197
|
-
# @example Set default share scope
|
|
198
|
-
# client.Filter.set_default_share_scope do
|
|
199
|
-
# payload type: "PROJECT", projectId: "10000"
|
|
200
|
-
# end
|
|
201
|
-
#
|
|
202
203
|
def set_default_share_scope(&block)
|
|
203
204
|
builder do
|
|
204
205
|
method :put
|
|
205
206
|
path 'filter/defaultShareScope'
|
|
206
207
|
instance_eval(&block) if block_given?
|
|
207
208
|
end
|
|
208
|
-
|
|
209
|
+
call
|
|
209
210
|
end
|
|
210
211
|
|
|
211
212
|
# Retrieves favorite filters.
|
|
212
213
|
#
|
|
214
|
+
# @yield [builder] Optional block to add query parameters.
|
|
213
215
|
# @return [Object] The API response containing favorite filters.
|
|
214
216
|
#
|
|
215
|
-
def favourite
|
|
217
|
+
def favourite(&block)
|
|
216
218
|
builder do
|
|
217
219
|
path 'filter/favourite'
|
|
220
|
+
instance_eval(&block) if block_given?
|
|
218
221
|
end
|
|
219
|
-
|
|
222
|
+
call
|
|
220
223
|
end
|
|
221
224
|
end
|
|
222
225
|
end
|
|
@@ -6,7 +6,8 @@ module Rujira
|
|
|
6
6
|
# Module providing methods to manage comments on Jira issues.
|
|
7
7
|
#
|
|
8
8
|
# This module is included in the `Issue` class and allows you to:
|
|
9
|
-
# -
|
|
9
|
+
# - List comments
|
|
10
|
+
# - Add a new comment
|
|
10
11
|
# - Retrieve a specific comment
|
|
11
12
|
# - Update a comment
|
|
12
13
|
# - Delete a comment
|
|
@@ -21,31 +22,15 @@ module Rujira
|
|
|
21
22
|
# payload({ body: "This is a comment" })
|
|
22
23
|
# end
|
|
23
24
|
#
|
|
24
|
-
# @example Update a comment
|
|
25
|
-
# client.Issue.update_comment("TEST-123", "10001") do
|
|
26
|
-
# payload({ body: "Updated comment text" })
|
|
27
|
-
# end
|
|
28
|
-
#
|
|
29
|
-
# @example Delete a comment
|
|
30
|
-
# client.Issue.delete_comment("TEST-123", "10001")
|
|
31
|
-
#
|
|
32
|
-
# @example Get a pinned comment
|
|
33
|
-
# client.Issue.get_pinned_comment("TEST-123")
|
|
34
|
-
#
|
|
35
|
-
# @example Pin a comment
|
|
36
|
-
# client.Issue.pin_comment("TEST-123", "10001")
|
|
37
25
|
module Comments
|
|
38
|
-
# Retrieves comments for a given issue.
|
|
26
|
+
# Retrieves all comments for a given issue.
|
|
39
27
|
#
|
|
40
28
|
# @param [String] id_or_key The issue ID or key.
|
|
41
|
-
# @yield [builder] Optional block to configure
|
|
29
|
+
# @yield [builder] Optional block to configure the request (headers, query params).
|
|
42
30
|
# @return [Object] The API response containing the issue's comments.
|
|
43
31
|
#
|
|
44
32
|
# @example Get comments for an issue
|
|
45
|
-
# client.Issue.
|
|
46
|
-
# # Optional: add query parameters or headers
|
|
47
|
-
# params startAt: 0, maxResults: 50
|
|
48
|
-
# end
|
|
33
|
+
# client.Issue.list_comment("TEST-123")
|
|
49
34
|
#
|
|
50
35
|
def list_comment(id_or_key, &block)
|
|
51
36
|
abort 'Issue ID or KEY is required' if id_or_key.to_s.strip.empty?
|
|
@@ -54,19 +39,20 @@ module Rujira
|
|
|
54
39
|
method :get
|
|
55
40
|
instance_eval(&block) if block_given?
|
|
56
41
|
end
|
|
57
|
-
|
|
42
|
+
call
|
|
58
43
|
end
|
|
59
44
|
|
|
60
|
-
# Adds a comment to
|
|
45
|
+
# Adds a new comment to an issue.
|
|
61
46
|
#
|
|
62
47
|
# @param [String] id_or_key The issue ID or key.
|
|
63
48
|
# @yield [builder] Block to configure the payload for the new comment.
|
|
64
|
-
# @return [Object] The API response
|
|
49
|
+
# @return [Object] The API response containing the created comment.
|
|
65
50
|
#
|
|
66
|
-
# @example Add a comment
|
|
51
|
+
# @example Add a comment
|
|
67
52
|
# client.Issue.add_comment("TEST-123") do
|
|
68
|
-
# payload body: "
|
|
53
|
+
# payload body: "New comment text"
|
|
69
54
|
# end
|
|
55
|
+
#
|
|
70
56
|
def add_comment(id_or_key, &block)
|
|
71
57
|
abort 'Issue ID or KEY is required' if id_or_key.to_s.strip.empty?
|
|
72
58
|
builder do
|
|
@@ -74,20 +60,40 @@ module Rujira
|
|
|
74
60
|
method :post
|
|
75
61
|
instance_eval(&block) if block_given?
|
|
76
62
|
end
|
|
77
|
-
|
|
63
|
+
call
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Retrieves a specific comment by its ID.
|
|
67
|
+
#
|
|
68
|
+
# @param [String] id_or_key The issue ID or key.
|
|
69
|
+
# @param [String] id The comment ID.
|
|
70
|
+
# @yield [builder] Optional block to configure the request.
|
|
71
|
+
# @return [Object] The API response containing the comment details.
|
|
72
|
+
#
|
|
73
|
+
# @example Get a comment
|
|
74
|
+
# client.Issue.get_comment("TEST-123", "10001")
|
|
75
|
+
#
|
|
76
|
+
def get_comment(id_or_key, id, &block)
|
|
77
|
+
abort 'Issue ID or KEY is required' if id_or_key.to_s.strip.empty?
|
|
78
|
+
builder do
|
|
79
|
+
path "issue/#{id_or_key}/comment/#{id}"
|
|
80
|
+
instance_eval(&block) if block_given?
|
|
81
|
+
end
|
|
82
|
+
call
|
|
78
83
|
end
|
|
79
84
|
|
|
80
|
-
# Updates an existing comment
|
|
85
|
+
# Updates an existing comment.
|
|
81
86
|
#
|
|
82
87
|
# @param [String] id_or_key The issue ID or key.
|
|
83
88
|
# @param [String] id The comment ID.
|
|
84
89
|
# @yield [builder] Block to configure the payload for updating the comment.
|
|
85
90
|
# @return [Object] The API response after updating the comment.
|
|
86
91
|
#
|
|
87
|
-
# @example Update a comment
|
|
92
|
+
# @example Update a comment
|
|
88
93
|
# client.Issue.update_comment("TEST-123", "10001") do
|
|
89
|
-
# payload body: "Updated comment
|
|
94
|
+
# payload body: "Updated comment text"
|
|
90
95
|
# end
|
|
96
|
+
#
|
|
91
97
|
def update_comment(id_or_key, id, &block)
|
|
92
98
|
abort 'Issue ID or KEY is required' if id_or_key.to_s.strip.empty?
|
|
93
99
|
builder do
|
|
@@ -95,20 +101,19 @@ module Rujira
|
|
|
95
101
|
method :put
|
|
96
102
|
instance_eval(&block) if block_given?
|
|
97
103
|
end
|
|
98
|
-
|
|
104
|
+
call
|
|
99
105
|
end
|
|
100
106
|
|
|
101
|
-
# Deletes a comment from
|
|
107
|
+
# Deletes a comment from an issue.
|
|
102
108
|
#
|
|
103
109
|
# @param [String] id_or_key The issue ID or key.
|
|
104
110
|
# @param [String] id The comment ID.
|
|
105
111
|
# @yield [builder] Optional block to configure additional request parameters.
|
|
106
112
|
# @return [Object] The API response after deleting the comment.
|
|
107
113
|
#
|
|
108
|
-
# @example Delete a comment
|
|
109
|
-
# client.Issue.delete_comment("TEST-123", "10001")
|
|
110
|
-
#
|
|
111
|
-
# end
|
|
114
|
+
# @example Delete a comment
|
|
115
|
+
# client.Issue.delete_comment("TEST-123", "10001")
|
|
116
|
+
#
|
|
112
117
|
def delete_comment(id_or_key, id, &block)
|
|
113
118
|
abort 'Issue ID or KEY is required' if id_or_key.to_s.strip.empty?
|
|
114
119
|
builder do
|
|
@@ -116,50 +121,45 @@ module Rujira
|
|
|
116
121
|
method :delete
|
|
117
122
|
instance_eval(&block) if block_given?
|
|
118
123
|
end
|
|
119
|
-
|
|
124
|
+
call
|
|
120
125
|
end
|
|
121
126
|
|
|
122
|
-
#
|
|
127
|
+
# Pins a comment to the top of an issue's comment list.
|
|
123
128
|
#
|
|
124
129
|
# @param [String] id_or_key The issue ID or key.
|
|
125
130
|
# @param [String] id The comment ID.
|
|
126
131
|
# @yield [builder] Optional block to configure additional request parameters.
|
|
127
|
-
# @return [Object] The API response
|
|
132
|
+
# @return [Object] The API response after pinning the comment.
|
|
128
133
|
#
|
|
129
|
-
# @example
|
|
130
|
-
# client.Issue.
|
|
131
|
-
# # Optional: add headers or query parameters if needed
|
|
132
|
-
# end
|
|
134
|
+
# @example Pin a comment
|
|
135
|
+
# client.Issue.pin_comment("TEST-123", "10001")
|
|
133
136
|
#
|
|
134
|
-
def
|
|
137
|
+
def pin_comment(id_or_key, id, &block)
|
|
135
138
|
abort 'Issue ID or KEY is required' if id_or_key.to_s.strip.empty?
|
|
136
139
|
builder do
|
|
137
|
-
|
|
140
|
+
method :put
|
|
141
|
+
path "issue/#{id_or_key}/comment/#{id}/pin"
|
|
138
142
|
instance_eval(&block) if block_given?
|
|
139
143
|
end
|
|
140
|
-
|
|
144
|
+
call
|
|
141
145
|
end
|
|
142
146
|
|
|
143
|
-
#
|
|
147
|
+
# Retrieves all pinned comments for a given issue.
|
|
144
148
|
#
|
|
145
149
|
# @param [String] id_or_key The issue ID or key.
|
|
146
|
-
# @
|
|
147
|
-
# @
|
|
148
|
-
# @return [Object] The API response after pinning the comment.
|
|
150
|
+
# @yield [builder] Optional block to configure the request.
|
|
151
|
+
# @return [Object] The API response containing pinned comments.
|
|
149
152
|
#
|
|
150
|
-
# @example
|
|
151
|
-
# client.Issue.
|
|
152
|
-
# # Optional: add headers or query parameters if needed
|
|
153
|
-
# end
|
|
153
|
+
# @example Get pinned comments
|
|
154
|
+
# client.Issue.get_pinned_comments("TEST-123")
|
|
154
155
|
#
|
|
155
|
-
def
|
|
156
|
+
def get_pinned_comments(id_or_key, &block)
|
|
156
157
|
abort 'Issue ID or KEY is required' if id_or_key.to_s.strip.empty?
|
|
157
158
|
builder do
|
|
158
|
-
|
|
159
|
-
path "issue/#{id_or_key}/comment/#{id}/pin"
|
|
159
|
+
path "issue/#{id_or_key}/pinned-comments"
|
|
160
160
|
instance_eval(&block) if block_given?
|
|
161
161
|
end
|
|
162
|
-
|
|
162
|
+
call
|
|
163
163
|
end
|
|
164
164
|
|
|
165
165
|
# Adds a comment to an issue.
|
|
@@ -177,26 +177,6 @@ module Rujira
|
|
|
177
177
|
abort 'Issue ID or KEY is required' if id_or_key.to_s.strip.empty?
|
|
178
178
|
@client.Comment.create id_or_key, &block
|
|
179
179
|
end
|
|
180
|
-
|
|
181
|
-
# Retrieves the pinned comment(s) for a given issue.
|
|
182
|
-
#
|
|
183
|
-
# @param [String] id_or_key The issue ID or key.
|
|
184
|
-
# @yield [builder] Optional block to configure additional request parameters.
|
|
185
|
-
# @return [Object] The API response containing the pinned comment(s).
|
|
186
|
-
#
|
|
187
|
-
# @example Get pinned comments for an issue
|
|
188
|
-
# client.Issue.get_pinned_comment("TEST-123") do
|
|
189
|
-
# # Optional: add query parameters or headers
|
|
190
|
-
# params expand: "renderedBody"
|
|
191
|
-
# end
|
|
192
|
-
def get_pinned_comments(id_or_key, &block)
|
|
193
|
-
abort 'Issue ID or KEY is required' if id_or_key.to_s.strip.empty?
|
|
194
|
-
builder do
|
|
195
|
-
path "issue/#{id_or_key}/pinned-comments"
|
|
196
|
-
instance_eval(&block) if block_given?
|
|
197
|
-
end
|
|
198
|
-
run
|
|
199
|
-
end
|
|
200
180
|
end
|
|
201
181
|
end
|
|
202
182
|
end
|
|
@@ -2,113 +2,108 @@
|
|
|
2
2
|
|
|
3
3
|
module Rujira
|
|
4
4
|
module Api
|
|
5
|
-
# Provides access to Jira issues via the REST API.
|
|
6
|
-
# API reference:
|
|
7
|
-
# https://docs.atlassian.com/software/jira/docs/api/REST/9.17.0/#api/2/issue
|
|
8
|
-
#
|
|
9
5
|
class Issue < Common
|
|
10
6
|
# Module providing methods to manage watchers on Jira issues.
|
|
11
7
|
#
|
|
12
8
|
# This module is included in the `Issue` class and allows you to:
|
|
13
9
|
# - Retrieve the list of watchers for an issue
|
|
14
|
-
# - Add watchers to an issue
|
|
10
|
+
# - Add single or multiple watchers to an issue
|
|
15
11
|
# - Remove watchers from an issue
|
|
16
12
|
#
|
|
17
13
|
# All methods support an optional block to customize the request using the
|
|
18
|
-
# builder DSL
|
|
14
|
+
# builder DSL (headers, query parameters, or payload).
|
|
19
15
|
#
|
|
20
16
|
# @example Get all watchers for an issue
|
|
21
17
|
# client.Issue.get_watchers("TEST-123")
|
|
22
18
|
#
|
|
23
|
-
# @example Add watchers to an issue
|
|
19
|
+
# @example Add multiple watchers to an issue
|
|
24
20
|
# client.Issue.add_watchers("TEST-123") do
|
|
25
21
|
# payload ["john.doe", "jane.smith"]
|
|
26
22
|
# end
|
|
27
23
|
#
|
|
24
|
+
# @example Add a single watcher to an issue
|
|
25
|
+
# client.Issue.watcher("TEST-123", "john.doe")
|
|
26
|
+
#
|
|
28
27
|
# @example Remove a watcher from an issue
|
|
29
28
|
# client.Issue.remove_watchers("TEST-123", "john.doe")
|
|
30
29
|
module Watchers
|
|
31
|
-
#
|
|
30
|
+
# Retrieves the list of watchers for a specific issue.
|
|
32
31
|
#
|
|
33
32
|
# @param [String] id_or_key The issue ID or key.
|
|
34
|
-
# @
|
|
35
|
-
# @
|
|
36
|
-
# @return [Object] The API response after removing the watcher.
|
|
33
|
+
# @yield [builder] Optional block to customize headers, query parameters, or other request options.
|
|
34
|
+
# @return [Object] The API response containing the watchers.
|
|
37
35
|
#
|
|
38
|
-
# @example
|
|
39
|
-
# client.Issue.
|
|
40
|
-
|
|
41
|
-
# end
|
|
42
|
-
def remove_watchers(id_or_key, username, &block)
|
|
36
|
+
# @example Retrieve watchers
|
|
37
|
+
# client.Issue.get_watchers("TEST-123")
|
|
38
|
+
def get_watchers(id_or_key, &block)
|
|
43
39
|
abort 'Issue ID or KEY is required' if id_or_key.to_s.strip.empty?
|
|
44
|
-
abort 'USERNAME is required' if username.to_s.strip.empty?
|
|
45
40
|
builder do
|
|
46
|
-
method :delete
|
|
47
41
|
path "issue/#{id_or_key}/watchers"
|
|
48
|
-
params username: username
|
|
49
42
|
instance_eval(&block) if block_given?
|
|
50
43
|
end
|
|
51
|
-
|
|
44
|
+
call
|
|
52
45
|
end
|
|
53
46
|
|
|
54
|
-
#
|
|
47
|
+
# Adds multiple watchers to a specific issue.
|
|
55
48
|
#
|
|
56
49
|
# @param [String] id_or_key The issue ID or key.
|
|
57
|
-
# @yield [builder]
|
|
58
|
-
# @return [Object] The API response
|
|
50
|
+
# @yield [builder] Block to configure the request payload (array of usernames).
|
|
51
|
+
# @return [Object] The API response after adding watchers.
|
|
59
52
|
#
|
|
60
|
-
# @example
|
|
61
|
-
# client.Issue.
|
|
62
|
-
#
|
|
53
|
+
# @example Add multiple watchers
|
|
54
|
+
# client.Issue.add_watchers("TEST-123") do
|
|
55
|
+
# payload ["john.doe", "jane.smith"]
|
|
63
56
|
# end
|
|
64
|
-
def
|
|
57
|
+
def add_watchers(id_or_key, &block)
|
|
65
58
|
abort 'Issue ID or KEY is required' if id_or_key.to_s.strip.empty?
|
|
66
59
|
builder do
|
|
60
|
+
method :post
|
|
67
61
|
path "issue/#{id_or_key}/watchers"
|
|
68
62
|
instance_eval(&block) if block_given?
|
|
69
63
|
end
|
|
70
|
-
|
|
64
|
+
call
|
|
71
65
|
end
|
|
72
66
|
|
|
73
|
-
# Adds
|
|
67
|
+
# Adds a single watcher to a specific issue.
|
|
74
68
|
#
|
|
75
69
|
# @param [String] id_or_key The issue ID or key.
|
|
76
|
-
# @
|
|
77
|
-
# @
|
|
70
|
+
# @param [String] username The username of the watcher to add.
|
|
71
|
+
# @yield [builder] Optional block to customize the request.
|
|
72
|
+
# @return [Object] The API response after adding the watcher.
|
|
78
73
|
#
|
|
79
|
-
# @example Add
|
|
80
|
-
# client.Issue.
|
|
81
|
-
|
|
82
|
-
# end
|
|
83
|
-
def add_watchers(id_or_key, &block)
|
|
74
|
+
# @example Add a single watcher
|
|
75
|
+
# client.Issue.watcher("TEST-123", "john.doe")
|
|
76
|
+
def watcher(id_or_key, username, &block)
|
|
84
77
|
abort 'Issue ID or KEY is required' if id_or_key.to_s.strip.empty?
|
|
78
|
+
abort 'USERNAME is required' if username.to_s.strip.empty?
|
|
85
79
|
builder do
|
|
86
|
-
method :post
|
|
87
80
|
path "issue/#{id_or_key}/watchers"
|
|
81
|
+
method :post
|
|
82
|
+
payload username.to_json
|
|
88
83
|
instance_eval(&block) if block_given?
|
|
89
84
|
end
|
|
90
|
-
|
|
85
|
+
call
|
|
91
86
|
end
|
|
92
87
|
|
|
93
|
-
#
|
|
88
|
+
# Removes a watcher from a specific issue.
|
|
94
89
|
#
|
|
95
90
|
# @param [String] id_or_key The issue ID or key.
|
|
96
|
-
# @param [String]
|
|
97
|
-
# @yield [builder] Optional block to
|
|
98
|
-
# @return [Object] The API response after
|
|
99
|
-
#
|
|
100
|
-
# @example Add a watcher
|
|
101
|
-
# client.Issue.watchers("TEST-123", "johndoe")
|
|
91
|
+
# @param [String] username The username of the watcher to remove.
|
|
92
|
+
# @yield [builder] Optional block to customize headers, query parameters, or other request options.
|
|
93
|
+
# @return [Object] The API response after removing the watcher.
|
|
102
94
|
#
|
|
103
|
-
|
|
95
|
+
# @example Remove a watcher
|
|
96
|
+
# client.Issue.remove_watchers("TEST-123", "john.doe")
|
|
97
|
+
def remove_watchers(id_or_key, username, &block)
|
|
104
98
|
abort 'Issue ID or KEY is required' if id_or_key.to_s.strip.empty?
|
|
99
|
+
abort 'USERNAME is required' if username.to_s.strip.empty?
|
|
105
100
|
builder do
|
|
101
|
+
method :delete
|
|
106
102
|
path "issue/#{id_or_key}/watchers"
|
|
107
|
-
|
|
108
|
-
payload name.to_json
|
|
103
|
+
params username: username
|
|
109
104
|
instance_eval(&block) if block_given?
|
|
110
105
|
end
|
|
111
|
-
|
|
106
|
+
call
|
|
112
107
|
end
|
|
113
108
|
end
|
|
114
109
|
end
|