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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a560af049fc2790fd46fcfa42a8913ff6a3e35fb6da619d0dbee7873a872fdec
4
- data.tar.gz: d5e1af098eac6a126ca0643545effb8c9f420ef30349c716d127d7018ff3e8c5
3
+ metadata.gz: 8db967aea6d2666d5d82812d3f6bdf7b35862746e9ab7d0b41cac9f4f3cde34b
4
+ data.tar.gz: cddac80bdc8823c0a439ed6ef15529b256de051f823463859f50fc44b0c387c8
5
5
  SHA512:
6
- metadata.gz: c144da359a042b32d600661c40eb4d8588eac575ded10b1a00cec642958631fe50a878f240a97c2d8e6220824aa49973f49103fa1e4cac0f0774f6f39d754886
7
- data.tar.gz: 15b14457c90a78271c0af4644276d945dd3cea0d980919967f24081d11a53b5b0b8a710204aeaa71757c68b89798a63d5f83ca3301543d79e3f2e9d02d8f92d5
6
+ metadata.gz: b127f0122f18f5221243804aec2f75b115e326e35bdbabc25c5495392ee219a2813c3953ed7731bd440f9612deaf06028bd2cec728287991f0e675c1b01551a5
7
+ data.tar.gz: bbfc97f14cd904bfbf8b24c9012aa45813e566123ebf87600fd83840619c78aa7d58e7971c22693376d4793b3a8155d28d125f5d31a70703064c7385e8a19752
data/CHANGELOG.md CHANGED
@@ -5,10 +5,34 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.3.0] - 2026-11-27
9
+
10
+ ### Added
11
+
12
+ - Add epic and agile issue endpoints (Jira Software Cloud API) (#12) ([3ad2c31](https://github.com/macio/ruby-jira/commit/3ad2c311abae5a54de2723cbf8827400aece3ec6))
13
+ - Add board endpoints (Jira Software Cloud API) (#11) ([e62a7cb](https://github.com/macio/ruby-jira/commit/e62a7cb7c818010a0880c256690ed679e78d70eb))
14
+ - Add Jira Software Cloud agile API - sprint endpoints (#10) ([a17893d](https://github.com/macio/ruby-jira/commit/a17893dd013547430846a9a1af51901a7ced5ea4))
15
+
16
+ ## [0.2.0] - 2026-03-14
17
+
18
+ ### Added
19
+
20
+ - Issue-worklogs-api (#9) ([fefa37c](https://github.com/macio/ruby-jira/commit/fefa37c48ecabaf62353015c3cc3866f6bfb251d))
21
+ - Add time tracking api (#8) ([836bc35](https://github.com/macio/ruby-jira/commit/836bc35ba53369acf683bf3c18424816b9aecf8e))
22
+ - Add project categories (#7) ([7bd8f80](https://github.com/macio/ruby-jira/commit/7bd8f8004d708ba49dd867dd4fffa083d7021886))
23
+ - Add project properties client (#6) ([db8796f](https://github.com/macio/ruby-jira/commit/db8796fcc59f34d91b5e9835730581ff9599fb5b))
24
+ - Universal pagination (#5) ([d828945](https://github.com/macio/ruby-jira/commit/d828945b69e3e384e8e43c5b788f853bdf966963))
25
+ - Issue search api (#4) ([74f22ea](https://github.com/macio/ruby-jira/commit/74f22ea5e66583f17a124b30bc0582d81d8153a0))
26
+ - Issue comments api (#3) ([d54da8d](https://github.com/macio/ruby-jira/commit/d54da8d55c749399381c896d56ec80dfd7e9a0d1))
27
+ - Issues and permission schemes api (#2) ([d57857d](https://github.com/macio/ruby-jira/commit/d57857d0c682a338212ae1d5e2e06d78926cb767))
28
+ - Projects api methods (#1) ([e410703](https://github.com/macio/ruby-jira/commit/e4107033b0229886dab39ae865de115f78d2d911))
29
+
8
30
  ## [0.1.0] - 2026-03-09
9
31
 
10
32
  ### Added
11
33
 
12
34
  - Add initial ruby-jira Jira API client gem ([09c7c53](https://github.com/macio/ruby-jira/commit/09c7c5302cec9ccd079d85f0c46466f53775e9da))
13
35
 
36
+ [0.3.0]: https://github.com/macio/ruby-jira/compare/v0.2.0...v0.3.0
37
+ [0.2.0]: https://github.com/macio/ruby-jira/compare/v0.1.0...v0.2.0
14
38
 
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # ruby-jira
2
2
 
3
- Ruby client for the [Jira Cloud REST API v3](https://developer.atlassian.com/cloud/jira/platform/rest/v3/).
3
+ Ruby client for the [Jira Cloud REST API v3](https://developer.atlassian.com/cloud/jira/platform/rest/v3/) and the [Jira Software Cloud REST API](https://developer.atlassian.com/cloud/jira/software/rest/intro/) (agile — sprints, boards).
4
4
 
5
5
  > Inspired by and based on the architecture of [NARKOZ/gitlab](https://github.com/NARKOZ/gitlab) — a Ruby wrapper for the GitLab API. Many thanks for the solid foundation.
6
6
 
@@ -39,7 +39,7 @@ JIRA_EMAIL=you@example.com
39
39
  JIRA_API_TOKEN=your-api-token
40
40
  ```
41
41
 
42
- ### OAuth 2.0 — pre-fetched access token
42
+ ### OAuth 2.0 - pre-fetched access token
43
43
 
44
44
  ```ruby
45
45
  Jira.configure do |config|
@@ -50,7 +50,7 @@ Jira.configure do |config|
50
50
  end
51
51
  ```
52
52
 
53
- ### OAuth 2.0 — automatic token refresh (`refresh_token` grant)
53
+ ### OAuth 2.0 - automatic token refresh (`refresh_token` grant)
54
54
 
55
55
  ```ruby
56
56
  Jira.configure do |config|
@@ -64,7 +64,7 @@ Jira.configure do |config|
64
64
  end
65
65
  ```
66
66
 
67
- ### OAuth 2.0 — service account (`client_credentials` grant)
67
+ ### OAuth 2.0 - service account (`client_credentials` grant)
68
68
 
69
69
  ```ruby
70
70
  Jira.configure do |config|
@@ -160,31 +160,187 @@ Jira.issue_security_level_scheme("TEST")
160
160
  Jira.assign_permission_scheme("TEST", scheme_id: 101)
161
161
  ```
162
162
 
163
+ ### Epics (Jira Software Cloud API)
164
+
165
+ ```ruby
166
+ # Get a single epic
167
+ epic = Jira.epic(37)
168
+ epic.name # => "epic 1"
169
+ epic.summary # => "epic 1 summary"
170
+ epic.done # => false
171
+
172
+ # Partially update an epic
173
+ Jira.update_epic(37, { name: "New name", done: true })
174
+
175
+ # Issues in an epic (offset-paginated)
176
+ issues = Jira.epic_issues(37, maxResults: 50)
177
+ issues.total
178
+ issues.auto_paginate
179
+
180
+ # Issues with no epic assigned
181
+ Jira.issues_without_epic(jql: "project = TEST")
182
+
183
+ # Move issues to an epic / remove from epic
184
+ Jira.move_issues_to_epic(37, issues: ["TEST-1", "TEST-2"])
185
+ Jira.unassign_issues_from_epic(issues: ["TEST-3"])
186
+
187
+ # Rank an epic relative to another
188
+ Jira.rank_epic(37, { rankBeforeEpic: 42 })
189
+ ```
190
+
191
+ ### Agile Issues (Jira Software Cloud API)
192
+
193
+ ```ruby
194
+ # Get an issue with agile fields (sprint, epic, flagged)
195
+ issue = Jira.agile_issue("TEST-1")
196
+ issue.key # => "TEST-1"
197
+ issue.fields.sprint.name # => "sprint 2"
198
+ issue.fields.epic.name # => "epic 1"
199
+ issue.fields.flagged # => true
200
+
201
+ # Estimation
202
+ est = Jira.issue_estimation("TEST-1", boardId: 84)
203
+ est[:fieldId] # => "customfield_12532"
204
+ est[:value] # => "8.0"
205
+
206
+ Jira.update_issue_estimation("TEST-1", { value: "13.0" }, boardId: 84)
207
+
208
+ # Rank issues relative to another
209
+ Jira.rank_issues({ issues: ["TEST-1", "TEST-2"], rankBeforeIssue: "TEST-3" })
210
+ ```
211
+
212
+ ### Boards (Jira Software Cloud API)
213
+
214
+ Board methods use the Jira Software Cloud REST API (`/rest/agile/1.0`) transparently - no extra configuration needed.
215
+
216
+ ```ruby
217
+ # List all boards (offset-paginated)
218
+ boards = Jira.boards(type: "scrum", maxResults: 50)
219
+ boards.total
220
+ boards.first[:name] # => "scrum board"
221
+ boards.auto_paginate
222
+
223
+ # Boards for a filter
224
+ Jira.boards_for_filter(1001)
225
+
226
+ # Get / create / delete a board
227
+ board = Jira.board(84)
228
+ board.name # => "scrum board"
229
+ board.type # => "scrum"
230
+ Jira.create_board({ name: "New Board", type: "scrum", filterId: 1001 })
231
+ Jira.delete_board(84)
232
+
233
+ # Board configuration
234
+ config = Jira.board_configuration(84)
235
+ config[:columnConfig][:columns].map { |c| c[:name] } # => ["To Do", "In Progress", "Done"]
236
+
237
+ # Features (enable/disable board panels)
238
+ Jira.board_features(84)
239
+ Jira.toggle_board_feature(84, { feature: "BACKLOG", state: "ENABLED" })
240
+
241
+ # Backlog and issues
242
+ Jira.board_backlog(84, maxResults: 50)
243
+ Jira.board_issues(84, jql: "assignee = currentUser()")
244
+ Jira.move_issues_to_board(84, issues: ["TEST-1", "TEST-2"])
245
+
246
+ # Epics
247
+ Jira.board_epics(84, done: false)
248
+ Jira.board_issues_without_epic(84)
249
+ Jira.board_epic_issues(84, 37)
250
+
251
+ # Sprints
252
+ sprints = Jira.board_sprints(84, state: "active")
253
+ Jira.board_sprint_issues(84, 37)
254
+
255
+ # Projects and versions
256
+ Jira.board_projects(84)
257
+ Jira.board_projects_full(84)
258
+ Jira.board_versions(84, released: false)
259
+
260
+ # Quick filters
261
+ Jira.board_quick_filters(84)
262
+ Jira.board_quick_filter(84, 1)
263
+
264
+ # Reports
265
+ Jira.board_reports(84)
266
+
267
+ # Board properties
268
+ Jira.board_property_keys(84)
269
+ Jira.board_property(84, "my.key")
270
+ Jira.set_board_property(84, "my.key", { foo: "bar" })
271
+ Jira.delete_board_property(84, "my.key")
272
+ ```
273
+
274
+ ### Sprints (Jira Software Cloud API)
275
+
276
+ Sprint methods use the Jira Software Cloud REST API (`/rest/agile/1.0`) transparently — no extra configuration needed.
277
+
278
+ ```ruby
279
+ # Get a sprint
280
+ sprint = Jira.sprint(37)
281
+ sprint.name # => "sprint 1"
282
+ sprint.state # => "future"
283
+
284
+ # Create / update / delete
285
+ Jira.create_sprint({ name: "Sprint 5", originBoardId: 5, goal: "ship it" })
286
+ Jira.update_sprint(37, { name: "Sprint 5 — revised" }) # partial update (POST)
287
+ Jira.replace_sprint(37, { name: "Sprint 5", originBoardId: 5, state: "active" }) # full update (PUT)
288
+ Jira.delete_sprint(37)
289
+
290
+ # Issues in a sprint (offset-paginated)
291
+ issues = Jira.sprint_issues(37, maxResults: 50)
292
+ issues.total
293
+ issues.auto_paginate
294
+ issues.map { |i| i[:key] }
295
+
296
+ # Move issues into a sprint
297
+ Jira.move_issues_to_sprint(37, issues: ["TEST-1", "TEST-2"])
298
+
299
+ # Swap sprint position with another sprint
300
+ Jira.swap_sprint(37, sprint_to_swap_with: 42)
301
+
302
+ # Sprint properties
303
+ Jira.sprint_property_keys(37)
304
+ Jira.sprint_property(37, "my.key")
305
+ Jira.set_sprint_property(37, "my.key", { foo: "bar" })
306
+ Jira.delete_sprint_property(37, "my.key")
307
+ ```
308
+
163
309
  ### Pagination
164
310
 
165
- Offset-paginated responses (`GET /project/search`, `GET /workflow/search`, etc.) return `Jira::PaginatedResponse`:
311
+ Jira Cloud uses multiple pagination shapes across endpoints. This gem unifies them with `auto_paginate`, `each_page`,
312
+ and `paginate_with_limit`.
313
+
314
+ Offset-paginated responses return `Jira::PaginatedResponse` - includes `GET /project/search`, `GET /issue/{key}/comment`,
315
+ `GET /issue/{key}/worklog`, and others:
166
316
 
167
317
  ```ruby
168
318
  page = Jira.projects
169
- page.total # total count
170
- page.start_at # current offset
171
- page.max_results # page size
172
- page.last_page? # isLast flag
319
+ page.total # total count
320
+ page.start_at # current offset
321
+ page.max_results # page size
322
+ page.last_page? # isLast flag
173
323
  page.next_page?
174
- page.next_page # fetches the next page
175
- page.auto_paginate # fetches all pages, returns flat Array
324
+ page.next_page # fetches the next page
325
+ page.auto_paginate # fetches all pages, returns flat Array
176
326
  page.paginate_with_limit(200)
177
327
  page.each_page { |p| process(p) }
178
328
  ```
179
329
 
180
- Cursor-paginated responses (`POST /search/jql`, etc.) return `Jira::CursorPaginatedResponse`:
330
+ Cursor-paginated responses (`GET /search/jql`, `POST /search/jql`) return `Jira::CursorPaginatedResponse`:
181
331
 
182
332
  ```ruby
183
- results = Jira.search_issues(jql: "project = TEST ORDER BY created DESC")
333
+ # GET /search/jql returns minimal issue payload by default (id only).
334
+ # Pass fields/expand to fetch richer issue data.
335
+ results = Jira.search_issues_jql(
336
+ jql: "project = TEST ORDER BY created DESC",
337
+ fields: "key,summary"
338
+ )
184
339
  results.next_page_token # raw token
185
340
  results.next_page?
186
341
  results.next_page # fetches next page automatically
187
342
  results.auto_paginate # fetches all pages
343
+ results.paginate_with_limit(200)
188
344
  ```
189
345
 
190
346
  ### Rate limiting
@@ -202,7 +358,7 @@ The client automatically retries `429 Too Many Requests` and `503 Service Unavai
202
358
  | `X-RateLimit-Reset` | ISO 8601 timestamp | When the rate-limit window resets (429 only) |
203
359
  | `X-RateLimit-Limit` | integer | Max request rate for the current scope |
204
360
  | `X-RateLimit-Remaining` | integer | Remaining capacity in the current window |
205
- | `X-RateLimit-NearLimit` | `"true"` | Signals < 20% capacity remains — consider throttling proactively |
361
+ | `X-RateLimit-NearLimit` | `"true"` | Signals < 20% capacity remains - consider throttling proactively |
206
362
  | `RateLimit-Reason` | string | Which limit was exceeded (`jira-burst-based`, `jira-quota-tenant-based`, etc.) |
207
363
 
208
364
  **Retry strategy:** exponential backoff with proportional jitter (`delay × rand(0.7..1.3)`), respecting `Retry-After` and `X-RateLimit-Reset` headers. Falls back to backoff when no header is present.
@@ -217,6 +373,30 @@ Jira.configure do |config|
217
373
  end
218
374
  ```
219
375
 
376
+ ### Logging
377
+
378
+ Pass any `Logger`-compatible object to enable debug logging. All requests, detected response types, and rate-limit retries are logged at `DEBUG` level.
379
+
380
+ ```ruby
381
+ require "logger"
382
+
383
+ Jira.configure do |config|
384
+ config.logger = Logger.new($stdout)
385
+ end
386
+ ```
387
+
388
+ Sample output:
389
+
390
+ ```
391
+ GET /project/search {query: {maxResults: 50}}
392
+ → Jira::PaginatedResponse
393
+ GET /search/jql {query: {jql: "project=TEST", nextPageToken: "..."}}
394
+ → Jira::CursorPaginatedResponse
395
+ rate limited (HTTP 429), retrying in 5.0s (3 retries left)
396
+ ```
397
+
398
+ Logging is disabled by default (`config.logger = nil`).
399
+
220
400
  ### Proxy
221
401
 
222
402
  ```ruby
@@ -241,16 +421,17 @@ Jira.http_proxy("proxy.example.com", 8080, "user", "pass")
241
421
  | `ratelimit_retries` | `JIRA_RATELIMIT_RETRIES` | `4` |
242
422
  | `ratelimit_base_delay` | `JIRA_RATELIMIT_BASE_DELAY` | `2.0` |
243
423
  | `ratelimit_max_delay` | `JIRA_RATELIMIT_MAX_DELAY` | `30.0` |
424
+ | `logger` | — | `nil` |
244
425
 
245
426
  ## Error handling
246
427
 
247
428
  ```ruby
248
- rescue Jira::Error::Unauthorized # 401
249
- rescue Jira::Error::Forbidden # 403
250
- rescue Jira::Error::NotFound # 404
429
+ rescue Jira::Error::Unauthorized # 401
430
+ rescue Jira::Error::Forbidden # 403
431
+ rescue Jira::Error::NotFound # 404
251
432
  rescue Jira::Error::TooManyRequests # 429
252
- rescue Jira::Error::ResponseError # any other 4xx/5xx
253
- rescue Jira::Error::Base # all gem errors
433
+ rescue Jira::Error::ResponseError # any other 4xx/5xx
434
+ rescue Jira::Error::Base # all gem errors
254
435
  ```
255
436
 
256
437
  `Jira::Error::ResponseError` exposes:
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jira
4
+ class Client
5
+ # Defines methods related to issues via the Jira Software Cloud API.
6
+ #
7
+ # These methods complement the Platform API issue methods in the Issues module
8
+ # with agile-specific fields and operations (sprint, epic, ranking, estimation).
9
+ #
10
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-issue/
11
+ module AgileIssues
12
+ # Ranks issues before or after a given issue
13
+ #
14
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-issue/#api-rest-agile-1-0-issue-rank-put
15
+ #
16
+ # @param payload [Hash] Rank payload (issues:, rankBeforeIssue:, rankAfterIssue:, rankCustomFieldId:)
17
+ # @return [nil]
18
+ def rank_issues(payload = {})
19
+ agile_put("/issue/rank", body: payload)
20
+ end
21
+
22
+ # Returns a single issue with agile-specific fields (sprint, epic, flagged)
23
+ #
24
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-issue/#api-rest-agile-1-0-issue-issueidorkey-get
25
+ #
26
+ # @param issue_id_or_key [String] The ID or key of the issue
27
+ # @param options [Hash] Query parameters (fields:, expand:, updateHistory:)
28
+ # @return [Hash]
29
+ def agile_issue(issue_id_or_key, options = {})
30
+ agile_get("/issue/#{url_encode(issue_id_or_key)}", query: options)
31
+ end
32
+
33
+ # Returns the estimation of the issue
34
+ #
35
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-issue/#api-rest-agile-1-0-issue-issueidorkey-estimation-get
36
+ #
37
+ # @param issue_id_or_key [String] The ID or key of the issue
38
+ # @param options [Hash] Query parameters (boardId:)
39
+ # @return [Hash]
40
+ def issue_estimation(issue_id_or_key, options = {})
41
+ agile_get("/issue/#{url_encode(issue_id_or_key)}/estimation", query: options)
42
+ end
43
+
44
+ # Updates the estimation of the issue
45
+ #
46
+ # @url https://developer.atlassian.com/cloud/jira/software/rest/api-group-issue/#api-rest-agile-1-0-issue-issueidorkey-estimation-put
47
+ #
48
+ # @param issue_id_or_key [String] The ID or key of the issue
49
+ # @param payload [Hash] Estimation payload (value:)
50
+ # @param options [Hash] Query parameters (boardId:)
51
+ # @return [Hash]
52
+ def update_issue_estimation(issue_id_or_key, payload = {}, options = {})
53
+ agile_put("/issue/#{url_encode(issue_id_or_key)}/estimation", body: payload, query: options)
54
+ end
55
+ end
56
+ end
57
+ end