ruby-jira 0.1.0 → 0.3.0
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 +24 -0
- data/README.md +200 -19
- data/lib/jira/client/agile_issues.rb +57 -0
- data/lib/jira/client/boards.rb +291 -0
- data/lib/jira/client/epics.rb +84 -0
- data/lib/jira/client/issue_comments.rb +80 -0
- data/lib/jira/client/issue_search.rb +60 -0
- data/lib/jira/client/issue_worklogs.rb +123 -0
- data/lib/jira/client/issues.rb +191 -0
- data/lib/jira/client/project_categories.rb +60 -0
- data/lib/jira/client/project_permission_schemes.rb +18 -0
- data/lib/jira/client/project_properties.rb +54 -0
- data/lib/jira/client/projects.rb +60 -0
- data/lib/jira/client/sprints.rb +139 -0
- data/lib/jira/client/time_tracking.rb +57 -0
- data/lib/jira/client.rb +10 -0
- data/lib/jira/configuration.rb +2 -0
- data/lib/jira/error.rb +3 -0
- data/lib/jira/logging.rb +15 -0
- data/lib/jira/pagination/collection_behavior.rb +72 -0
- data/lib/jira/pagination/cursor_paginated_response.rb +57 -41
- data/lib/jira/pagination/paginated_response.rb +46 -50
- data/lib/jira/request/rate_limiting.rb +6 -6
- data/lib/jira/request/request_building.rb +7 -6
- data/lib/jira/request/response_parsing.rb +82 -16
- data/lib/jira/request.rb +57 -23
- data/lib/jira/version.rb +1 -1
- data/lib/jira.rb +2 -0
- metadata +13 -2
- data/lib/jira/request/paginated_response.rb +0 -4
data/lib/jira/client/issues.rb
CHANGED
|
@@ -3,17 +3,33 @@
|
|
|
3
3
|
module Jira
|
|
4
4
|
class Client
|
|
5
5
|
# Defines methods related to issues.
|
|
6
|
+
#
|
|
7
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/
|
|
6
8
|
module Issues
|
|
7
9
|
# Creates a new issue
|
|
8
10
|
#
|
|
11
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-post
|
|
12
|
+
#
|
|
9
13
|
# @param payload [Hash] Issue payload
|
|
10
14
|
# @return [Hash]
|
|
11
15
|
def create_issue(payload = {})
|
|
12
16
|
post("/issue", body: payload)
|
|
13
17
|
end
|
|
14
18
|
|
|
19
|
+
# Creates multiple issues in a single request
|
|
20
|
+
#
|
|
21
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-bulk-post
|
|
22
|
+
#
|
|
23
|
+
# @param payload [Hash] Bulk issue creation payload
|
|
24
|
+
# @return [Hash]
|
|
25
|
+
def bulk_create_issues(payload = {})
|
|
26
|
+
post("/issue/bulk", body: payload)
|
|
27
|
+
end
|
|
28
|
+
|
|
15
29
|
# Gets a single issue
|
|
16
30
|
#
|
|
31
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-get
|
|
32
|
+
#
|
|
17
33
|
# @param issue_id_or_key [Integer, String] The ID or key of an issue
|
|
18
34
|
# @param options [Hash] Query parameters
|
|
19
35
|
# @return [Hash]
|
|
@@ -23,6 +39,8 @@ module Jira
|
|
|
23
39
|
|
|
24
40
|
# Updates an existing issue
|
|
25
41
|
#
|
|
42
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-put
|
|
43
|
+
#
|
|
26
44
|
# @param issue_id_or_key [Integer, String] The ID or key of an issue
|
|
27
45
|
# @param payload [Hash] Issue payload
|
|
28
46
|
# @param options [Hash] Query parameters
|
|
@@ -30,6 +48,179 @@ module Jira
|
|
|
30
48
|
def edit_issue(issue_id_or_key, payload = {}, options = {})
|
|
31
49
|
put("/issue/#{url_encode(issue_id_or_key)}", body: payload, query: options)
|
|
32
50
|
end
|
|
51
|
+
|
|
52
|
+
# Deletes an issue
|
|
53
|
+
#
|
|
54
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-delete
|
|
55
|
+
#
|
|
56
|
+
# @param issue_id_or_key [Integer, String] The ID or key of an issue
|
|
57
|
+
# @param options [Hash] Query parameters (e.g. deleteSubtasks)
|
|
58
|
+
# @return [nil]
|
|
59
|
+
def delete_issue(issue_id_or_key, options = {})
|
|
60
|
+
delete("/issue/#{url_encode(issue_id_or_key)}", query: options)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Assigns an issue to a user
|
|
64
|
+
#
|
|
65
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-assignee-put
|
|
66
|
+
#
|
|
67
|
+
# @param issue_id_or_key [Integer, String] The ID or key of an issue
|
|
68
|
+
# @param payload [Hash] Assignee payload (e.g. { accountId: "..." })
|
|
69
|
+
# @return [nil]
|
|
70
|
+
def assign_issue(issue_id_or_key, payload = {})
|
|
71
|
+
put("/issue/#{url_encode(issue_id_or_key)}/assignee", body: payload)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Returns a list of transitions for an issue
|
|
75
|
+
#
|
|
76
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-transitions-get
|
|
77
|
+
#
|
|
78
|
+
# @param issue_id_or_key [Integer, String] The ID or key of an issue
|
|
79
|
+
# @param options [Hash] Query parameters
|
|
80
|
+
# @return [Hash]
|
|
81
|
+
def issue_transitions(issue_id_or_key, options = {})
|
|
82
|
+
get("/issue/#{url_encode(issue_id_or_key)}/transitions", query: options)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Performs a transition on an issue
|
|
86
|
+
#
|
|
87
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-transitions-post
|
|
88
|
+
#
|
|
89
|
+
# @param issue_id_or_key [Integer, String] The ID or key of an issue
|
|
90
|
+
# @param payload [Hash] Transition payload
|
|
91
|
+
# @return [nil]
|
|
92
|
+
def transition_issue(issue_id_or_key, payload = {})
|
|
93
|
+
post("/issue/#{url_encode(issue_id_or_key)}/transitions", body: payload)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Returns paginated changelog for an issue
|
|
97
|
+
#
|
|
98
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-changelog-get
|
|
99
|
+
#
|
|
100
|
+
# @param issue_id_or_key [Integer, String] The ID or key of an issue
|
|
101
|
+
# @param options [Hash] Query parameters
|
|
102
|
+
# @return [Jira::PaginatedResponse]
|
|
103
|
+
def issue_changelog(issue_id_or_key, options = {})
|
|
104
|
+
get("/issue/#{url_encode(issue_id_or_key)}/changelog", query: options)
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# Returns the watchers for an issue
|
|
108
|
+
#
|
|
109
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-watchers-get
|
|
110
|
+
#
|
|
111
|
+
# @param issue_id_or_key [Integer, String] The ID or key of an issue
|
|
112
|
+
# @return [Hash]
|
|
113
|
+
def issue_watchers(issue_id_or_key)
|
|
114
|
+
get("/issue/#{url_encode(issue_id_or_key)}/watchers")
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# Adds a watcher to an issue
|
|
118
|
+
#
|
|
119
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-watchers-post
|
|
120
|
+
#
|
|
121
|
+
# @param issue_id_or_key [Integer, String] The ID or key of an issue
|
|
122
|
+
# @param account_id [String] The account ID of the user to watch the issue
|
|
123
|
+
# @return [nil]
|
|
124
|
+
def add_watcher(issue_id_or_key, account_id)
|
|
125
|
+
post("/issue/#{url_encode(issue_id_or_key)}/watchers", body: account_id)
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# Removes a watcher from an issue
|
|
129
|
+
#
|
|
130
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-watchers-delete
|
|
131
|
+
#
|
|
132
|
+
# @param issue_id_or_key [Integer, String] The ID or key of an issue
|
|
133
|
+
# @param account_id [String] The account ID of the user to remove
|
|
134
|
+
# @return [nil]
|
|
135
|
+
def remove_watcher(issue_id_or_key, account_id:)
|
|
136
|
+
delete("/issue/#{url_encode(issue_id_or_key)}/watchers", query: { accountId: account_id })
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
# Returns vote information for an issue
|
|
140
|
+
#
|
|
141
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-votes-get
|
|
142
|
+
#
|
|
143
|
+
# @param issue_id_or_key [Integer, String] The ID or key of an issue
|
|
144
|
+
# @return [Hash]
|
|
145
|
+
def issue_votes(issue_id_or_key)
|
|
146
|
+
get("/issue/#{url_encode(issue_id_or_key)}/votes")
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
# Adds a vote to an issue
|
|
150
|
+
#
|
|
151
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-votes-post
|
|
152
|
+
#
|
|
153
|
+
# @param issue_id_or_key [Integer, String] The ID or key of an issue
|
|
154
|
+
# @return [nil]
|
|
155
|
+
def add_vote(issue_id_or_key)
|
|
156
|
+
post("/issue/#{url_encode(issue_id_or_key)}/votes")
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# Removes a vote from an issue
|
|
160
|
+
#
|
|
161
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-votes-delete
|
|
162
|
+
#
|
|
163
|
+
# @param issue_id_or_key [Integer, String] The ID or key of an issue
|
|
164
|
+
# @return [nil]
|
|
165
|
+
def remove_vote(issue_id_or_key)
|
|
166
|
+
delete("/issue/#{url_encode(issue_id_or_key)}/votes")
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
# Returns remote links for an issue
|
|
170
|
+
#
|
|
171
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-remotelink-get
|
|
172
|
+
#
|
|
173
|
+
# @param issue_id_or_key [Integer, String] The ID or key of an issue
|
|
174
|
+
# @param options [Hash] Query parameters
|
|
175
|
+
# @return [Array<Hash>]
|
|
176
|
+
def issue_remote_links(issue_id_or_key, options = {})
|
|
177
|
+
get("/issue/#{url_encode(issue_id_or_key)}/remotelink", query: options)
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
# Creates or updates a remote link for an issue
|
|
181
|
+
#
|
|
182
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-remotelink-post
|
|
183
|
+
#
|
|
184
|
+
# @param issue_id_or_key [Integer, String] The ID or key of an issue
|
|
185
|
+
# @param payload [Hash] Remote link payload
|
|
186
|
+
# @return [Hash]
|
|
187
|
+
def create_or_update_remote_link(issue_id_or_key, payload = {})
|
|
188
|
+
post("/issue/#{url_encode(issue_id_or_key)}/remotelink", body: payload)
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
# Returns a single remote link for an issue
|
|
192
|
+
#
|
|
193
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-remotelink-linkid-get
|
|
194
|
+
#
|
|
195
|
+
# @param issue_id_or_key [Integer, String] The ID or key of an issue
|
|
196
|
+
# @param link_id [Integer, String] The ID of the remote link
|
|
197
|
+
# @return [Hash]
|
|
198
|
+
def remote_link(issue_id_or_key, link_id)
|
|
199
|
+
get("/issue/#{url_encode(issue_id_or_key)}/remotelink/#{link_id}")
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
# Updates a remote link for an issue
|
|
203
|
+
#
|
|
204
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-remotelink-linkid-put
|
|
205
|
+
#
|
|
206
|
+
# @param issue_id_or_key [Integer, String] The ID or key of an issue
|
|
207
|
+
# @param link_id [Integer, String] The ID of the remote link
|
|
208
|
+
# @param payload [Hash] Remote link payload
|
|
209
|
+
# @return [nil]
|
|
210
|
+
def update_remote_link(issue_id_or_key, link_id, payload = {})
|
|
211
|
+
put("/issue/#{url_encode(issue_id_or_key)}/remotelink/#{link_id}", body: payload)
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
# Deletes a remote link from an issue
|
|
215
|
+
#
|
|
216
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-remotelink-linkid-delete
|
|
217
|
+
#
|
|
218
|
+
# @param issue_id_or_key [Integer, String] The ID or key of an issue
|
|
219
|
+
# @param link_id [Integer, String] The ID of the remote link
|
|
220
|
+
# @return [nil]
|
|
221
|
+
def delete_remote_link(issue_id_or_key, link_id)
|
|
222
|
+
delete("/issue/#{url_encode(issue_id_or_key)}/remotelink/#{link_id}")
|
|
223
|
+
end
|
|
33
224
|
end
|
|
34
225
|
end
|
|
35
226
|
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Jira
|
|
4
|
+
class Client
|
|
5
|
+
# Defines methods related to project categories.
|
|
6
|
+
#
|
|
7
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-categories/
|
|
8
|
+
module ProjectCategories
|
|
9
|
+
# Returns all project categories
|
|
10
|
+
#
|
|
11
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-categories/#api-rest-api-3-projectcategory-get
|
|
12
|
+
#
|
|
13
|
+
# @return [Array<Hash>]
|
|
14
|
+
def project_categories
|
|
15
|
+
get("/projectCategory")
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Creates a project category
|
|
19
|
+
#
|
|
20
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-categories/#api-rest-api-3-projectcategory-post
|
|
21
|
+
#
|
|
22
|
+
# @param payload [Hash] Project category payload
|
|
23
|
+
# @return [Hash]
|
|
24
|
+
def create_project_category(payload = {})
|
|
25
|
+
post("/projectCategory", body: payload)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Returns a project category by ID
|
|
29
|
+
#
|
|
30
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-categories/#api-rest-api-3-projectcategory-id-get
|
|
31
|
+
#
|
|
32
|
+
# @param id [Integer, String] The ID of the project category
|
|
33
|
+
# @return [Hash]
|
|
34
|
+
def project_category(id)
|
|
35
|
+
get("/projectCategory/#{url_encode(id)}")
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Updates a project category
|
|
39
|
+
#
|
|
40
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-categories/#api-rest-api-3-projectcategory-id-put
|
|
41
|
+
#
|
|
42
|
+
# @param id [Integer, String] The ID of the project category
|
|
43
|
+
# @param payload [Hash] Project category payload
|
|
44
|
+
# @return [Hash]
|
|
45
|
+
def update_project_category(id, payload = {})
|
|
46
|
+
put("/projectCategory/#{url_encode(id)}", body: payload)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Deletes a project category
|
|
50
|
+
#
|
|
51
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-categories/#api-rest-api-3-projectcategory-id-delete
|
|
52
|
+
#
|
|
53
|
+
# @param id [Integer, String] The ID of the project category
|
|
54
|
+
# @return [nil]
|
|
55
|
+
def delete_project_category(id)
|
|
56
|
+
delete("/projectCategory/#{url_encode(id)}")
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
@@ -3,9 +3,13 @@
|
|
|
3
3
|
module Jira
|
|
4
4
|
class Client
|
|
5
5
|
# Defines methods related to project permission schemes.
|
|
6
|
+
#
|
|
7
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-permission-schemes/
|
|
6
8
|
module ProjectPermissionSchemes
|
|
7
9
|
# Gets assigned issue security level scheme for a project
|
|
8
10
|
#
|
|
11
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-permission-schemes/#api-rest-api-3-project-projectkeyorid-issuesecuritylevelscheme-get
|
|
12
|
+
#
|
|
9
13
|
# @param project_key_or_id [Integer, String] Project ID or key
|
|
10
14
|
# @param options [Hash] Query parameters
|
|
11
15
|
# @return [Hash]
|
|
@@ -15,6 +19,8 @@ module Jira
|
|
|
15
19
|
|
|
16
20
|
# Gets assigned permission scheme for a project
|
|
17
21
|
#
|
|
22
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-permission-schemes/#api-rest-api-3-project-projectkeyorid-permissionscheme-get
|
|
23
|
+
#
|
|
18
24
|
# @param project_key_or_id [Integer, String] Project ID or key
|
|
19
25
|
# @param options [Hash] Query parameters
|
|
20
26
|
# @return [Hash]
|
|
@@ -22,8 +28,20 @@ module Jira
|
|
|
22
28
|
get("/project/#{url_encode(project_key_or_id)}/permissionscheme", query: options)
|
|
23
29
|
end
|
|
24
30
|
|
|
31
|
+
# Returns security levels for a project
|
|
32
|
+
#
|
|
33
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-permission-schemes/#api-rest-api-3-project-projectkeyorid-securitylevel-get
|
|
34
|
+
#
|
|
35
|
+
# @param project_key_or_id [Integer, String] Project ID or key
|
|
36
|
+
# @return [Hash]
|
|
37
|
+
def project_security_levels(project_key_or_id)
|
|
38
|
+
get("/project/#{url_encode(project_key_or_id)}/securitylevel")
|
|
39
|
+
end
|
|
40
|
+
|
|
25
41
|
# Assigns permission scheme to a project
|
|
26
42
|
#
|
|
43
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-permission-schemes/#api-rest-api-3-project-projectkeyorid-permissionscheme-put
|
|
44
|
+
#
|
|
27
45
|
# @param project_key_or_id [Integer, String] Project ID or key
|
|
28
46
|
# @param scheme_id [Integer] Permission scheme ID
|
|
29
47
|
# @param options [Hash] Additional payload
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Jira
|
|
4
|
+
class Client
|
|
5
|
+
# Defines methods related to project properties.
|
|
6
|
+
#
|
|
7
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-properties/
|
|
8
|
+
module ProjectProperties
|
|
9
|
+
# Returns all property keys for a project
|
|
10
|
+
#
|
|
11
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-properties/#api-rest-api-3-project-projectidorkey-properties-get
|
|
12
|
+
#
|
|
13
|
+
# @param project_id_or_key [Integer, String] The ID or key of the project
|
|
14
|
+
# @return [Hash]
|
|
15
|
+
def project_property_keys(project_id_or_key)
|
|
16
|
+
get("/project/#{url_encode(project_id_or_key)}/properties")
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Returns the value of a project property
|
|
20
|
+
#
|
|
21
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-properties/#api-rest-api-3-project-projectidorkey-properties-propertykey-get
|
|
22
|
+
#
|
|
23
|
+
# @param project_id_or_key [Integer, String] The ID or key of the project
|
|
24
|
+
# @param property_key [String] The key of the property
|
|
25
|
+
# @return [Hash]
|
|
26
|
+
def project_property(project_id_or_key, property_key)
|
|
27
|
+
get("/project/#{url_encode(project_id_or_key)}/properties/#{url_encode(property_key)}")
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Sets the value of a project property
|
|
31
|
+
#
|
|
32
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-properties/#api-rest-api-3-project-projectidorkey-properties-propertykey-put
|
|
33
|
+
#
|
|
34
|
+
# @param project_id_or_key [Integer, String] The ID or key of the project
|
|
35
|
+
# @param property_key [String] The key of the property
|
|
36
|
+
# @param payload [Hash] The value to set
|
|
37
|
+
# @return [nil]
|
|
38
|
+
def set_project_property(project_id_or_key, property_key, payload = {})
|
|
39
|
+
put("/project/#{url_encode(project_id_or_key)}/properties/#{url_encode(property_key)}", body: payload)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Deletes a project property
|
|
43
|
+
#
|
|
44
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-properties/#api-rest-api-3-project-projectidorkey-properties-propertykey-delete
|
|
45
|
+
#
|
|
46
|
+
# @param project_id_or_key [Integer, String] The ID or key of the project
|
|
47
|
+
# @param property_key [String] The key of the property
|
|
48
|
+
# @return [nil]
|
|
49
|
+
def delete_project_property(project_id_or_key, property_key)
|
|
50
|
+
delete("/project/#{url_encode(project_id_or_key)}/properties/#{url_encode(property_key)}")
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
data/lib/jira/client/projects.rb
CHANGED
|
@@ -3,9 +3,13 @@
|
|
|
3
3
|
module Jira
|
|
4
4
|
class Client
|
|
5
5
|
# Defines methods related to projects.
|
|
6
|
+
#
|
|
7
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-projects/
|
|
6
8
|
module Projects
|
|
7
9
|
# Search projects
|
|
8
10
|
#
|
|
11
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-projects/#api-rest-api-3-project-search-get
|
|
12
|
+
#
|
|
9
13
|
# @param options [Hash] Query parameters
|
|
10
14
|
# @return [Jira::Request::PaginatedResponse]
|
|
11
15
|
def projects(options = {})
|
|
@@ -14,6 +18,8 @@ module Jira
|
|
|
14
18
|
|
|
15
19
|
# Gets a single project
|
|
16
20
|
#
|
|
21
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-projects/#api-rest-api-3-project-projectidorkey-get
|
|
22
|
+
#
|
|
17
23
|
# @param project_id_or_key [Integer, String] Project ID or key
|
|
18
24
|
# @param options [Hash] Query parameters
|
|
19
25
|
# @return [Hash]
|
|
@@ -23,11 +29,65 @@ module Jira
|
|
|
23
29
|
|
|
24
30
|
# Archives a project
|
|
25
31
|
#
|
|
32
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-projects/#api-rest-api-3-project-projectidorkey-archive-post
|
|
33
|
+
#
|
|
26
34
|
# @param project_id_or_key [Integer, String] Project ID or key
|
|
27
35
|
# @return [Hash]
|
|
28
36
|
def archive_project(project_id_or_key)
|
|
29
37
|
post("/project/#{url_encode(project_id_or_key)}/archive")
|
|
30
38
|
end
|
|
39
|
+
|
|
40
|
+
# Updates a project
|
|
41
|
+
#
|
|
42
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-projects/#api-rest-api-3-project-projectidorkey-put
|
|
43
|
+
#
|
|
44
|
+
# @param project_id_or_key [Integer, String] Project ID or key
|
|
45
|
+
# @param payload [Hash] Fields to update
|
|
46
|
+
# @return [Hash]
|
|
47
|
+
def update_project(project_id_or_key, payload = {})
|
|
48
|
+
put("/project/#{url_encode(project_id_or_key)}", body: payload)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Deletes a project
|
|
52
|
+
#
|
|
53
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-projects/#api-rest-api-3-project-projectidorkey-delete
|
|
54
|
+
#
|
|
55
|
+
# @param project_id_or_key [Integer, String] Project ID or key
|
|
56
|
+
# @return [Hash]
|
|
57
|
+
def delete_project(project_id_or_key)
|
|
58
|
+
delete("/project/#{url_encode(project_id_or_key)}")
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Gets all issue types with their statuses for a project
|
|
62
|
+
#
|
|
63
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-projects/#api-rest-api-3-project-projectidorkey-statuses-get
|
|
64
|
+
#
|
|
65
|
+
# @param project_id_or_key [Integer, String] Project ID or key
|
|
66
|
+
# @return [Array<Hash>]
|
|
67
|
+
def project_statuses(project_id_or_key)
|
|
68
|
+
get("/project/#{url_encode(project_id_or_key)}/statuses")
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Gets the issue type hierarchy for a project
|
|
72
|
+
#
|
|
73
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-projects/#api-rest-api-3-project-projectid-hierarchy-get
|
|
74
|
+
#
|
|
75
|
+
# @param project_id [Integer, String] Project ID
|
|
76
|
+
# @return [Hash]
|
|
77
|
+
def project_issue_type_hierarchy(project_id)
|
|
78
|
+
get("/project/#{url_encode(project_id)}/hierarchy")
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Gets the notification scheme for a project
|
|
82
|
+
#
|
|
83
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-projects/#api-rest-api-3-project-projectkeyorid-notificationscheme-get
|
|
84
|
+
#
|
|
85
|
+
# @param project_key_or_id [Integer, String] Project key or ID
|
|
86
|
+
# @param options [Hash] Query parameters (e.g. expand:)
|
|
87
|
+
# @return [Hash]
|
|
88
|
+
def project_notification_scheme(project_key_or_id, options = {})
|
|
89
|
+
get("/project/#{url_encode(project_key_or_id)}/notificationscheme", query: options)
|
|
90
|
+
end
|
|
31
91
|
end
|
|
32
92
|
end
|
|
33
93
|
end
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Jira
|
|
4
|
+
class Client
|
|
5
|
+
# Defines methods related to sprints (Jira Software Cloud API).
|
|
6
|
+
#
|
|
7
|
+
# @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-sprint/
|
|
8
|
+
module Sprints
|
|
9
|
+
# Creates a sprint
|
|
10
|
+
#
|
|
11
|
+
# @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-sprint/#api-rest-agile-1-0-sprint-post
|
|
12
|
+
#
|
|
13
|
+
# @param payload [Hash] Sprint payload (name:, originBoardId:, goal:, startDate:, endDate:)
|
|
14
|
+
# @return [Hash]
|
|
15
|
+
def create_sprint(payload = {})
|
|
16
|
+
agile_post("/sprint", body: payload)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Gets a sprint by ID
|
|
20
|
+
#
|
|
21
|
+
# @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-sprint/#api-rest-agile-1-0-sprint-sprintid-get
|
|
22
|
+
#
|
|
23
|
+
# @param sprint_id [Integer] The ID of the sprint
|
|
24
|
+
# @return [Hash]
|
|
25
|
+
def sprint(sprint_id)
|
|
26
|
+
agile_get("/sprint/#{sprint_id}")
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Partially updates a sprint
|
|
30
|
+
#
|
|
31
|
+
# @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-sprint/#api-rest-agile-1-0-sprint-sprintid-post
|
|
32
|
+
#
|
|
33
|
+
# @param sprint_id [Integer] The ID of the sprint
|
|
34
|
+
# @param payload [Hash] Fields to update
|
|
35
|
+
# @return [Hash]
|
|
36
|
+
def update_sprint(sprint_id, payload = {})
|
|
37
|
+
agile_post("/sprint/#{sprint_id}", body: payload)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Fully updates a sprint (all fields required)
|
|
41
|
+
#
|
|
42
|
+
# @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-sprint/#api-rest-agile-1-0-sprint-sprintid-put
|
|
43
|
+
#
|
|
44
|
+
# @param sprint_id [Integer] The ID of the sprint
|
|
45
|
+
# @param payload [Hash] Full sprint payload
|
|
46
|
+
# @return [Hash]
|
|
47
|
+
def replace_sprint(sprint_id, payload = {})
|
|
48
|
+
agile_put("/sprint/#{sprint_id}", body: payload)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Deletes a sprint
|
|
52
|
+
#
|
|
53
|
+
# @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-sprint/#api-rest-agile-1-0-sprint-sprintid-delete
|
|
54
|
+
#
|
|
55
|
+
# @param sprint_id [Integer] The ID of the sprint
|
|
56
|
+
# @return [nil]
|
|
57
|
+
def delete_sprint(sprint_id)
|
|
58
|
+
agile_delete("/sprint/#{sprint_id}")
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Gets paginated issues for a sprint
|
|
62
|
+
#
|
|
63
|
+
# @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-sprint/#api-rest-agile-1-0-sprint-sprintid-issue-get
|
|
64
|
+
#
|
|
65
|
+
# @param sprint_id [Integer] The ID of the sprint
|
|
66
|
+
# @param options [Hash] Query parameters (startAt:, maxResults:, jql:, fields:)
|
|
67
|
+
# @return [Jira::PaginatedResponse]
|
|
68
|
+
def sprint_issues(sprint_id, options = {})
|
|
69
|
+
agile_get("/sprint/#{sprint_id}/issue", query: options)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Moves issues to a sprint
|
|
73
|
+
#
|
|
74
|
+
# @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-sprint/#api-rest-agile-1-0-sprint-sprintid-issue-post
|
|
75
|
+
#
|
|
76
|
+
# @param sprint_id [Integer] The ID of the sprint
|
|
77
|
+
# @param issues [Array<String>] List of issue keys or IDs
|
|
78
|
+
# @return [nil]
|
|
79
|
+
def move_issues_to_sprint(sprint_id, issues:)
|
|
80
|
+
agile_post("/sprint/#{sprint_id}/issue", body: { issues: issues })
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# Gets property keys for a sprint
|
|
84
|
+
#
|
|
85
|
+
# @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-sprint/#api-rest-agile-1-0-sprint-sprintid-properties-get
|
|
86
|
+
#
|
|
87
|
+
# @param sprint_id [Integer] The ID of the sprint
|
|
88
|
+
# @return [Hash]
|
|
89
|
+
def sprint_property_keys(sprint_id)
|
|
90
|
+
agile_get("/sprint/#{sprint_id}/properties")
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Gets a single sprint property
|
|
94
|
+
#
|
|
95
|
+
# @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-sprint/#api-rest-agile-1-0-sprint-sprintid-properties-propertykey-get
|
|
96
|
+
#
|
|
97
|
+
# @param sprint_id [Integer] The ID of the sprint
|
|
98
|
+
# @param property_key [String] The property key
|
|
99
|
+
# @return [Hash]
|
|
100
|
+
def sprint_property(sprint_id, property_key)
|
|
101
|
+
agile_get("/sprint/#{sprint_id}/properties/#{url_encode(property_key)}")
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Sets or updates a sprint property
|
|
105
|
+
#
|
|
106
|
+
# @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-sprint/#api-rest-agile-1-0-sprint-sprintid-properties-propertykey-put
|
|
107
|
+
#
|
|
108
|
+
# @param sprint_id [Integer] The ID of the sprint
|
|
109
|
+
# @param property_key [String] The property key
|
|
110
|
+
# @param value [Hash] The property value
|
|
111
|
+
# @return [nil]
|
|
112
|
+
def set_sprint_property(sprint_id, property_key, value = {})
|
|
113
|
+
agile_put("/sprint/#{sprint_id}/properties/#{url_encode(property_key)}", body: value)
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# Deletes a sprint property
|
|
117
|
+
#
|
|
118
|
+
# @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-sprint/#api-rest-agile-1-0-sprint-sprintid-properties-propertykey-delete
|
|
119
|
+
#
|
|
120
|
+
# @param sprint_id [Integer] The ID of the sprint
|
|
121
|
+
# @param property_key [String] The property key
|
|
122
|
+
# @return [nil]
|
|
123
|
+
def delete_sprint_property(sprint_id, property_key)
|
|
124
|
+
agile_delete("/sprint/#{sprint_id}/properties/#{url_encode(property_key)}")
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# Swaps the position of a sprint with another sprint
|
|
128
|
+
#
|
|
129
|
+
# @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-sprint/#api-rest-agile-1-0-sprint-sprintid-swap-post
|
|
130
|
+
#
|
|
131
|
+
# @param sprint_id [Integer] The ID of the sprint
|
|
132
|
+
# @param sprint_to_swap_with [Integer] The ID of the sprint to swap with
|
|
133
|
+
# @return [nil]
|
|
134
|
+
def swap_sprint(sprint_id, sprint_to_swap_with:)
|
|
135
|
+
agile_post("/sprint/#{sprint_id}/swap", body: { sprintToSwapWith: sprint_to_swap_with })
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Jira
|
|
4
|
+
class Client
|
|
5
|
+
# Defines methods related to time tracking.
|
|
6
|
+
#
|
|
7
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-time-tracking/
|
|
8
|
+
module TimeTracking
|
|
9
|
+
# Returns the time tracking provider that is currently selected
|
|
10
|
+
#
|
|
11
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-time-tracking/#api-rest-api-3-configuration-timetracking-get
|
|
12
|
+
#
|
|
13
|
+
# @return [Hash]
|
|
14
|
+
def time_tracking_provider
|
|
15
|
+
get("/configuration/timetracking")
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Selects a time tracking provider
|
|
19
|
+
#
|
|
20
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-time-tracking/#api-rest-api-3-configuration-timetracking-put
|
|
21
|
+
#
|
|
22
|
+
# @param payload [Hash] Time tracking provider payload
|
|
23
|
+
# @return [nil]
|
|
24
|
+
def select_time_tracking_provider(payload = {})
|
|
25
|
+
put("/configuration/timetracking", body: payload)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Returns all time tracking providers
|
|
29
|
+
#
|
|
30
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-time-tracking/#api-rest-api-3-configuration-timetracking-list-get
|
|
31
|
+
#
|
|
32
|
+
# @return [Array<Hash>]
|
|
33
|
+
def time_tracking_providers
|
|
34
|
+
get("/configuration/timetracking/list")
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Returns the time tracking settings
|
|
38
|
+
#
|
|
39
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-time-tracking/#api-rest-api-3-configuration-timetracking-options-get
|
|
40
|
+
#
|
|
41
|
+
# @return [Hash]
|
|
42
|
+
def time_tracking_settings
|
|
43
|
+
get("/configuration/timetracking/options")
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Sets the time tracking settings
|
|
47
|
+
#
|
|
48
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-time-tracking/#api-rest-api-3-configuration-timetracking-options-put
|
|
49
|
+
#
|
|
50
|
+
# @param payload [Hash] Time tracking settings payload
|
|
51
|
+
# @return [Hash]
|
|
52
|
+
def set_time_tracking_settings(payload = {})
|
|
53
|
+
put("/configuration/timetracking/options", body: payload)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|