ruby-jira 0.4.0 → 0.5.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 +7 -0
- data/lib/jira/adf.rb +41 -0
- data/lib/jira/client/attachments.rb +62 -0
- data/lib/jira/client/components.rb +61 -0
- data/lib/jira/client/fields.rb +76 -0
- data/lib/jira/client/filters.rb +41 -0
- data/lib/jira/client/issue_links.rb +51 -0
- data/lib/jira/client/metadata.rb +41 -0
- data/lib/jira/client/users.rb +52 -0
- data/lib/jira/client/versions.rb +61 -0
- data/lib/jira/client.rb +8 -0
- data/lib/jira/version.rb +1 -1
- data/lib/jira.rb +1 -0
- metadata +10 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7005090ecddf077b4a40045c4545e086873b7a7434583e4cc5d1fb1faebc2931
|
|
4
|
+
data.tar.gz: cd50c5355b72f3981bc79b21303e9672cd26f7e7a31b8459314b3772ebcbd262
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c34cc9389bdc01bc175f81f6642ad7ec58babab9976477ceef0978170ab459e36cbf5408d0b670ee8771320157d0e1a2bd8aa335412900b4688f27e2e36bf17f
|
|
7
|
+
data.tar.gz: 74e7300299f5ff2be6261feac87d43e13dcb1ef9c4df1935cf04d5ca489e4df20385a2813d0859ab7d6764f9f7d7c29ee947b9f658528fccc55134a084aebd76
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,12 @@ 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.5.0] - 2026-11-27
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Add Users, Fields, Attachments, Issue links, Versions, Components, Filters and ADF helper (#14) ([c279fd5](https://github.com/macio/ruby-jira/commit/c279fd51fb8a4562685eb1502a474e71ca33fd61))
|
|
13
|
+
|
|
8
14
|
## [0.4.0] - 2026-11-27
|
|
9
15
|
|
|
10
16
|
### Added
|
|
@@ -39,6 +45,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
39
45
|
|
|
40
46
|
- Add initial ruby-jira Jira API client gem ([09c7c53](https://github.com/macio/ruby-jira/commit/09c7c5302cec9ccd079d85f0c46466f53775e9da))
|
|
41
47
|
|
|
48
|
+
[0.5.0]: https://github.com/macio/ruby-jira/compare/v0.4.0...v0.5.0
|
|
42
49
|
[0.4.0]: https://github.com/macio/ruby-jira/compare/v0.3.0...v0.4.0
|
|
43
50
|
[0.3.0]: https://github.com/macio/ruby-jira/compare/v0.2.0...v0.3.0
|
|
44
51
|
[0.2.0]: https://github.com/macio/ruby-jira/compare/v0.1.0...v0.2.0
|
data/lib/jira/adf.rb
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Jira
|
|
4
|
+
# Builds Atlassian Document Format (ADF) documents from plain text.
|
|
5
|
+
#
|
|
6
|
+
# Jira v3 expects ADF for rich-text fields such as issue descriptions and comment bodies.
|
|
7
|
+
#
|
|
8
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/apis/document/structure/
|
|
9
|
+
module ADF
|
|
10
|
+
class << self
|
|
11
|
+
# Converts plain text into an ADF document.
|
|
12
|
+
#
|
|
13
|
+
# Blank lines separate paragraphs. A single newline inside a paragraph becomes a hardBreak node.
|
|
14
|
+
# Empty input produces a document with no content.
|
|
15
|
+
#
|
|
16
|
+
# @param text [String, nil] Plain text
|
|
17
|
+
# @return [Hash] ADF document with :version, :type and :content keys
|
|
18
|
+
def from_text(text)
|
|
19
|
+
{
|
|
20
|
+
version: 1,
|
|
21
|
+
type: "doc",
|
|
22
|
+
content: text.to_s.split(/\n{2,}/).map(&:strip).reject(&:empty?).map { |paragraph| paragraph_node(paragraph) }
|
|
23
|
+
}
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
private
|
|
27
|
+
|
|
28
|
+
def paragraph_node(text)
|
|
29
|
+
{ type: "paragraph", content: inline_nodes(text) }
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def inline_nodes(text)
|
|
33
|
+
lines = text.split("\n", -1)
|
|
34
|
+
lines.each_with_index.flat_map do |line, index|
|
|
35
|
+
nodes = line.empty? ? [] : [{ type: "text", text: line }]
|
|
36
|
+
index < lines.size - 1 ? nodes + [{ type: "hardBreak" }] : nodes
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Jira
|
|
4
|
+
class Client
|
|
5
|
+
# Defines methods related to issue attachments.
|
|
6
|
+
#
|
|
7
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-attachments/
|
|
8
|
+
module Attachments
|
|
9
|
+
# Uploads a file as an attachment to an issue
|
|
10
|
+
#
|
|
11
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-attachments/#api-rest-api-3-issue-issueidorkey-attachments-post
|
|
12
|
+
#
|
|
13
|
+
# @param issue_id_or_key [Integer, String] The ID or key of the issue
|
|
14
|
+
# @param file_path [String] Path to the local file to upload
|
|
15
|
+
# @return [Array<Hash>]
|
|
16
|
+
def add_attachment(issue_id_or_key, file_path)
|
|
17
|
+
File.open(file_path, "rb") do |file|
|
|
18
|
+
# Jira blocks multipart uploads without this header (XSRF protection).
|
|
19
|
+
# Required by the addAttachment operation in the OpenAPI spec.
|
|
20
|
+
post(
|
|
21
|
+
"/issue/#{url_encode(issue_id_or_key)}/attachments",
|
|
22
|
+
body: { file: file },
|
|
23
|
+
multipart: true,
|
|
24
|
+
headers: { "X-Atlassian-Token" => "no-check" }
|
|
25
|
+
)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Returns the metadata of an attachment
|
|
30
|
+
#
|
|
31
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-attachments/#api-rest-api-3-attachment-id-get
|
|
32
|
+
#
|
|
33
|
+
# @param id [Integer, String] The ID of the attachment
|
|
34
|
+
# @return [Hash]
|
|
35
|
+
def attachment(id)
|
|
36
|
+
get("/attachment/#{url_encode(id)}")
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Downloads the content of an attachment
|
|
40
|
+
#
|
|
41
|
+
# The body is returned as raw bytes, not parsed as JSON.
|
|
42
|
+
#
|
|
43
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-attachments/#api-rest-api-3-attachment-content-id-get
|
|
44
|
+
#
|
|
45
|
+
# @param id [Integer, String] The ID of the attachment
|
|
46
|
+
# @return [String] Binary content
|
|
47
|
+
def attachment_content(id)
|
|
48
|
+
get("/attachment/content/#{url_encode(id)}", parser: ->(body, _format) { body })
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Deletes an attachment
|
|
52
|
+
#
|
|
53
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-attachments/#api-rest-api-3-attachment-id-delete
|
|
54
|
+
#
|
|
55
|
+
# @param id [Integer, String] The ID of the attachment
|
|
56
|
+
# @return [Hash]
|
|
57
|
+
def delete_attachment(id)
|
|
58
|
+
delete("/attachment/#{url_encode(id)}")
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Jira
|
|
4
|
+
class Client
|
|
5
|
+
# Defines methods related to project components.
|
|
6
|
+
#
|
|
7
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-components/
|
|
8
|
+
module Components
|
|
9
|
+
# Creates a component
|
|
10
|
+
#
|
|
11
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-components/#api-rest-api-3-component-post
|
|
12
|
+
#
|
|
13
|
+
# @param payload [Hash] Component payload (e.g. :name, :project or :projectId)
|
|
14
|
+
# @return [Hash]
|
|
15
|
+
def create_component(payload = {})
|
|
16
|
+
post("/component", body: payload)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Returns a component by ID
|
|
20
|
+
#
|
|
21
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-components/#api-rest-api-3-component-id-get
|
|
22
|
+
#
|
|
23
|
+
# @param id [Integer, String] The ID of the component
|
|
24
|
+
# @return [Hash]
|
|
25
|
+
def component(id)
|
|
26
|
+
get("/component/#{url_encode(id)}")
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Updates a component
|
|
30
|
+
#
|
|
31
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-components/#api-rest-api-3-component-id-put
|
|
32
|
+
#
|
|
33
|
+
# @param id [Integer, String] The ID of the component
|
|
34
|
+
# @param payload [Hash] Fields to update (e.g. :name, :description)
|
|
35
|
+
# @return [Hash]
|
|
36
|
+
def update_component(id, payload = {})
|
|
37
|
+
put("/component/#{url_encode(id)}", body: payload)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Deletes a component
|
|
41
|
+
#
|
|
42
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-components/#api-rest-api-3-component-id-delete
|
|
43
|
+
#
|
|
44
|
+
# @param id [Integer, String] The ID of the component
|
|
45
|
+
# @return [Hash]
|
|
46
|
+
def delete_component(id)
|
|
47
|
+
delete("/component/#{url_encode(id)}")
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Returns all components of a project
|
|
51
|
+
#
|
|
52
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-components/#api-rest-api-3-project-projectidorkey-components-get
|
|
53
|
+
#
|
|
54
|
+
# @param project_id_or_key [Integer, String] The ID or key of the project
|
|
55
|
+
# @return [Array<Hash>]
|
|
56
|
+
def project_components(project_id_or_key)
|
|
57
|
+
get("/project/#{url_encode(project_id_or_key)}/components")
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Jira
|
|
4
|
+
class Client
|
|
5
|
+
# Defines methods related to fields, issue types, priorities, statuses, resolutions and labels.
|
|
6
|
+
#
|
|
7
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-fields/
|
|
8
|
+
module Fields
|
|
9
|
+
# Returns all system and custom fields
|
|
10
|
+
#
|
|
11
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-fields/#api-rest-api-3-field-get
|
|
12
|
+
#
|
|
13
|
+
# @param options [Hash] Query parameters
|
|
14
|
+
# @return [Array<Hash>]
|
|
15
|
+
def fields(options = {})
|
|
16
|
+
get("/field", query: options)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Searches fields with pagination
|
|
20
|
+
#
|
|
21
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-fields/#api-rest-api-3-field-search-get
|
|
22
|
+
#
|
|
23
|
+
# @param options [Hash] Query parameters (e.g. :query, :type, :startAt, :maxResults)
|
|
24
|
+
# @return [Jira::PaginatedResponse]
|
|
25
|
+
def field_search(options = {})
|
|
26
|
+
get("/field/search", query: options)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Returns all issue types
|
|
30
|
+
#
|
|
31
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-types/#api-rest-api-3-issuetype-get
|
|
32
|
+
#
|
|
33
|
+
# @return [Array<Hash>]
|
|
34
|
+
def issue_types
|
|
35
|
+
get("/issuetype")
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Returns all priorities
|
|
39
|
+
#
|
|
40
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-priorities/#api-rest-api-3-priority-get
|
|
41
|
+
#
|
|
42
|
+
# @return [Array<Hash>]
|
|
43
|
+
def priorities
|
|
44
|
+
get("/priority")
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Returns all statuses
|
|
48
|
+
#
|
|
49
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-workflow-statuses/#api-rest-api-3-status-get
|
|
50
|
+
#
|
|
51
|
+
# @return [Array<Hash>]
|
|
52
|
+
def statuses
|
|
53
|
+
get("/status")
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Returns all resolutions
|
|
57
|
+
#
|
|
58
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-resolutions/#api-rest-api-3-resolution-get
|
|
59
|
+
#
|
|
60
|
+
# @return [Array<Hash>]
|
|
61
|
+
def resolutions
|
|
62
|
+
get("/resolution")
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Returns all labels, paginated
|
|
66
|
+
#
|
|
67
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-labels/#api-rest-api-3-label-get
|
|
68
|
+
#
|
|
69
|
+
# @param options [Hash] Query parameters (e.g. :startAt, :maxResults)
|
|
70
|
+
# @return [Jira::PaginatedResponse]
|
|
71
|
+
def labels(options = {})
|
|
72
|
+
get("/label", query: options)
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Jira
|
|
4
|
+
class Client
|
|
5
|
+
# Defines methods related to filters.
|
|
6
|
+
#
|
|
7
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-filters/
|
|
8
|
+
module Filters
|
|
9
|
+
# Returns the filters owned by or shared with the current user
|
|
10
|
+
#
|
|
11
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-filters/#api-rest-api-3-filter-my-get
|
|
12
|
+
#
|
|
13
|
+
# @param options [Hash] Query parameters (e.g. :expand, :includeFavourites)
|
|
14
|
+
# @return [Array<Hash>]
|
|
15
|
+
def my_filters(options = {})
|
|
16
|
+
get("/filter/my", query: options)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Returns a filter by ID
|
|
20
|
+
#
|
|
21
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-filters/#api-rest-api-3-filter-id-get
|
|
22
|
+
#
|
|
23
|
+
# @param id [Integer, String] The ID of the filter
|
|
24
|
+
# @param options [Hash] Query parameters (e.g. :expand)
|
|
25
|
+
# @return [Hash]
|
|
26
|
+
def filter(id, options = {})
|
|
27
|
+
get("/filter/#{url_encode(id)}", query: options)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Searches filters with pagination
|
|
31
|
+
#
|
|
32
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-filters/#api-rest-api-3-filter-search-get
|
|
33
|
+
#
|
|
34
|
+
# @param options [Hash] Query parameters (e.g. :filterName, :projectId, :startAt, :maxResults)
|
|
35
|
+
# @return [Jira::PaginatedResponse]
|
|
36
|
+
def filter_search(options = {})
|
|
37
|
+
get("/filter/search", query: options)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Jira
|
|
4
|
+
class Client
|
|
5
|
+
# Defines methods related to links between issues.
|
|
6
|
+
#
|
|
7
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-links/
|
|
8
|
+
module IssueLinks
|
|
9
|
+
# Creates a link between two issues
|
|
10
|
+
#
|
|
11
|
+
# The response has an empty body (HTTP 201).
|
|
12
|
+
#
|
|
13
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-links/#api-rest-api-3-issuelink-post
|
|
14
|
+
#
|
|
15
|
+
# @param payload [Hash] Link payload with :type, :inwardIssue, :outwardIssue and optional :comment
|
|
16
|
+
# @return [Hash]
|
|
17
|
+
def create_issue_link(payload = {})
|
|
18
|
+
post("/issueLink", body: payload)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Returns an issue link by ID
|
|
22
|
+
#
|
|
23
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-links/#api-rest-api-3-issuelink-linkid-get
|
|
24
|
+
#
|
|
25
|
+
# @param link_id [Integer, String] The ID of the issue link
|
|
26
|
+
# @return [Hash]
|
|
27
|
+
def issue_link(link_id)
|
|
28
|
+
get("/issueLink/#{url_encode(link_id)}")
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Deletes an issue link
|
|
32
|
+
#
|
|
33
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-links/#api-rest-api-3-issuelink-linkid-delete
|
|
34
|
+
#
|
|
35
|
+
# @param link_id [Integer, String] The ID of the issue link
|
|
36
|
+
# @return [Hash]
|
|
37
|
+
def delete_issue_link(link_id)
|
|
38
|
+
delete("/issueLink/#{url_encode(link_id)}")
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Returns all issue link types. The items are under the `issueLinkTypes` key.
|
|
42
|
+
#
|
|
43
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-link-types/#api-rest-api-3-issuelinktype-get
|
|
44
|
+
#
|
|
45
|
+
# @return [Hash]
|
|
46
|
+
def issue_link_types
|
|
47
|
+
get("/issueLinkType")
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Jira
|
|
4
|
+
class Client
|
|
5
|
+
# Defines methods returning field metadata required to create issues.
|
|
6
|
+
#
|
|
7
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/
|
|
8
|
+
module Metadata
|
|
9
|
+
# Returns issue types of a project with their create-screen field metadata
|
|
10
|
+
#
|
|
11
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-createmeta-projectidorkey-issuetypes-get
|
|
12
|
+
#
|
|
13
|
+
# @param project_id_or_key [Integer, String] The ID or key of the project
|
|
14
|
+
# @param options [Hash] Query parameters (e.g. :startAt, :maxResults)
|
|
15
|
+
# The response holds `createMetaIssueType` and `issueTypes`; PaginatedResponse uses the first array,
|
|
16
|
+
# so the items are `createMetaIssueType` entries.
|
|
17
|
+
#
|
|
18
|
+
# @return [Jira::PaginatedResponse]
|
|
19
|
+
def create_metadata(project_id_or_key, options = {})
|
|
20
|
+
get("/issue/createmeta/#{url_encode(project_id_or_key)}/issuetypes", query: options)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Returns the create-screen field metadata for one issue type of a project
|
|
24
|
+
#
|
|
25
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-createmeta-projectidorkey-issuetypes-issuetypeid-get
|
|
26
|
+
#
|
|
27
|
+
# @param project_id_or_key [Integer, String] The ID or key of the project
|
|
28
|
+
# @param issue_type_id [Integer, String] The ID of the issue type
|
|
29
|
+
# @param options [Hash] Query parameters (e.g. :startAt, :maxResults)
|
|
30
|
+
# The response holds `fields` and `results`; PaginatedResponse uses the first array (`fields`).
|
|
31
|
+
#
|
|
32
|
+
# @return [Jira::PaginatedResponse]
|
|
33
|
+
def create_metadata_for_issue_type(project_id_or_key, issue_type_id, options = {})
|
|
34
|
+
get(
|
|
35
|
+
"/issue/createmeta/#{url_encode(project_id_or_key)}/issuetypes/#{url_encode(issue_type_id)}",
|
|
36
|
+
query: options
|
|
37
|
+
)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Jira
|
|
4
|
+
class Client
|
|
5
|
+
# Defines methods related to users.
|
|
6
|
+
#
|
|
7
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-users/
|
|
8
|
+
module Users
|
|
9
|
+
# Returns the user associated with the credentials used for the request
|
|
10
|
+
#
|
|
11
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-myself/#api-rest-api-3-myself-get
|
|
12
|
+
#
|
|
13
|
+
# @param options [Hash] Query parameters
|
|
14
|
+
# @return [Hash]
|
|
15
|
+
def myself(options = {})
|
|
16
|
+
get("/myself", query: options)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Returns a user by account ID
|
|
20
|
+
#
|
|
21
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-users/#api-rest-api-3-user-get
|
|
22
|
+
#
|
|
23
|
+
# @param account_id [String] The account ID of the user
|
|
24
|
+
# @param options [Hash] Query parameters
|
|
25
|
+
# @return [Hash]
|
|
26
|
+
def user(account_id, options = {})
|
|
27
|
+
get("/user", query: { accountId: account_id }.merge(options))
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Searches for users matching a query string
|
|
31
|
+
#
|
|
32
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-users/#api-rest-api-3-user-search-get
|
|
33
|
+
#
|
|
34
|
+
# @param query [String] Text to match against display name or email
|
|
35
|
+
# @param options [Hash] Query parameters
|
|
36
|
+
# @return [Array<Hash>]
|
|
37
|
+
def user_search(query, options = {})
|
|
38
|
+
get("/user/search", query: { query: query }.merge(options))
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Returns users that can be assigned to issues in a project or for an issue
|
|
42
|
+
#
|
|
43
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-users/#api-rest-api-3-user-assignable-search-get
|
|
44
|
+
#
|
|
45
|
+
# @param options [Hash] Query parameters (e.g. :project, :issueKey, :query)
|
|
46
|
+
# @return [Array<Hash>]
|
|
47
|
+
def user_assignable_search(options = {})
|
|
48
|
+
get("/user/assignable/search", query: options)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Jira
|
|
4
|
+
class Client
|
|
5
|
+
# Defines methods related to project versions.
|
|
6
|
+
#
|
|
7
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-versions/
|
|
8
|
+
module Versions
|
|
9
|
+
# Creates a version
|
|
10
|
+
#
|
|
11
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-versions/#api-rest-api-3-version-post
|
|
12
|
+
#
|
|
13
|
+
# @param payload [Hash] Version payload (e.g. :name, :project or :projectId)
|
|
14
|
+
# @return [Hash]
|
|
15
|
+
def create_version(payload = {})
|
|
16
|
+
post("/version", body: payload)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Returns a version by ID
|
|
20
|
+
#
|
|
21
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-versions/#api-rest-api-3-version-id-get
|
|
22
|
+
#
|
|
23
|
+
# @param id [Integer, String] The ID of the version
|
|
24
|
+
# @return [Hash]
|
|
25
|
+
def version(id)
|
|
26
|
+
get("/version/#{url_encode(id)}")
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Updates a version
|
|
30
|
+
#
|
|
31
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-versions/#api-rest-api-3-version-id-put
|
|
32
|
+
#
|
|
33
|
+
# @param id [Integer, String] The ID of the version
|
|
34
|
+
# @param payload [Hash] Fields to update (e.g. :name, :released, :releaseDate)
|
|
35
|
+
# @return [Hash]
|
|
36
|
+
def update_version(id, payload = {})
|
|
37
|
+
put("/version/#{url_encode(id)}", body: payload)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Deletes a version
|
|
41
|
+
#
|
|
42
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-versions/#api-rest-api-3-version-id-delete
|
|
43
|
+
#
|
|
44
|
+
# @param id [Integer, String] The ID of the version
|
|
45
|
+
# @return [Hash]
|
|
46
|
+
def delete_version(id)
|
|
47
|
+
delete("/version/#{url_encode(id)}")
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Returns all versions of a project
|
|
51
|
+
#
|
|
52
|
+
# @url https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-versions/#api-rest-api-3-project-projectidorkey-versions-get
|
|
53
|
+
#
|
|
54
|
+
# @param project_id_or_key [Integer, String] The ID or key of the project
|
|
55
|
+
# @return [Array<Hash>]
|
|
56
|
+
def project_versions(project_id_or_key)
|
|
57
|
+
get("/project/#{url_encode(project_id_or_key)}/versions")
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
data/lib/jira/client.rb
CHANGED
|
@@ -5,18 +5,26 @@ module Jira
|
|
|
5
5
|
Dir[File.expand_path("client/*.rb", __dir__)].each { |file| require file }
|
|
6
6
|
|
|
7
7
|
include AgileIssues
|
|
8
|
+
include Attachments
|
|
8
9
|
include Boards
|
|
10
|
+
include Components
|
|
9
11
|
include Epics
|
|
12
|
+
include Fields
|
|
13
|
+
include Filters
|
|
10
14
|
include IssueComments
|
|
15
|
+
include IssueLinks
|
|
11
16
|
include IssueSearch
|
|
12
17
|
include Issues
|
|
13
18
|
include IssueWorklogs
|
|
19
|
+
include Metadata
|
|
14
20
|
include ProjectCategories
|
|
15
21
|
include ProjectPermissionSchemes
|
|
16
22
|
include ProjectProperties
|
|
17
23
|
include Projects
|
|
18
24
|
include Sprints
|
|
19
25
|
include TimeTracking
|
|
26
|
+
include Users
|
|
27
|
+
include Versions
|
|
20
28
|
|
|
21
29
|
# Text representation of the client, masking auth secrets.
|
|
22
30
|
#
|
data/lib/jira/version.rb
CHANGED
data/lib/jira.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruby-jira
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Maciej Kozak
|
|
@@ -34,21 +34,30 @@ files:
|
|
|
34
34
|
- LICENSE.txt
|
|
35
35
|
- README.md
|
|
36
36
|
- lib/jira.rb
|
|
37
|
+
- lib/jira/adf.rb
|
|
37
38
|
- lib/jira/api.rb
|
|
38
39
|
- lib/jira/client.rb
|
|
39
40
|
- lib/jira/client/agile_issues.rb
|
|
41
|
+
- lib/jira/client/attachments.rb
|
|
40
42
|
- lib/jira/client/boards.rb
|
|
43
|
+
- lib/jira/client/components.rb
|
|
41
44
|
- lib/jira/client/epics.rb
|
|
45
|
+
- lib/jira/client/fields.rb
|
|
46
|
+
- lib/jira/client/filters.rb
|
|
42
47
|
- lib/jira/client/issue_comments.rb
|
|
48
|
+
- lib/jira/client/issue_links.rb
|
|
43
49
|
- lib/jira/client/issue_search.rb
|
|
44
50
|
- lib/jira/client/issue_worklogs.rb
|
|
45
51
|
- lib/jira/client/issues.rb
|
|
52
|
+
- lib/jira/client/metadata.rb
|
|
46
53
|
- lib/jira/client/project_categories.rb
|
|
47
54
|
- lib/jira/client/project_permission_schemes.rb
|
|
48
55
|
- lib/jira/client/project_properties.rb
|
|
49
56
|
- lib/jira/client/projects.rb
|
|
50
57
|
- lib/jira/client/sprints.rb
|
|
51
58
|
- lib/jira/client/time_tracking.rb
|
|
59
|
+
- lib/jira/client/users.rb
|
|
60
|
+
- lib/jira/client/versions.rb
|
|
52
61
|
- lib/jira/configuration.rb
|
|
53
62
|
- lib/jira/error.rb
|
|
54
63
|
- lib/jira/logging.rb
|