jira-ruby 2.2.0 → 3.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE/bug_report.md +20 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- data/.github/dependabot.yml +6 -0
- data/.github/workflows/CI.yml +28 -0
- data/.github/workflows/codeql.yml +100 -0
- data/.github/workflows/rubocop.yml +18 -0
- data/.rubocop.yml +188 -0
- data/Gemfile +11 -3
- data/Guardfile +2 -0
- data/README.md +121 -20
- data/Rakefile +4 -5
- data/jira-ruby.gemspec +11 -17
- data/lib/jira/base.rb +37 -28
- data/lib/jira/base_factory.rb +4 -1
- data/lib/jira/client.rb +65 -46
- data/lib/jira/has_many_proxy.rb +4 -2
- data/lib/jira/http_client.rb +18 -13
- data/lib/jira/http_error.rb +4 -0
- data/lib/jira/jwt_client.rb +18 -42
- data/lib/jira/oauth_client.rb +6 -3
- data/lib/jira/railtie.rb +2 -0
- data/lib/jira/request_client.rb +5 -1
- data/lib/jira/resource/agile.rb +7 -9
- data/lib/jira/resource/applinks.rb +5 -3
- data/lib/jira/resource/attachment.rb +43 -3
- data/lib/jira/resource/board.rb +5 -3
- data/lib/jira/resource/board_configuration.rb +2 -0
- data/lib/jira/resource/comment.rb +2 -0
- data/lib/jira/resource/component.rb +2 -0
- data/lib/jira/resource/createmeta.rb +3 -1
- data/lib/jira/resource/field.rb +9 -4
- data/lib/jira/resource/filter.rb +2 -0
- data/lib/jira/resource/issue.rb +35 -44
- data/lib/jira/resource/issue_picker_suggestions.rb +4 -1
- data/lib/jira/resource/issue_picker_suggestions_issue.rb +2 -0
- data/lib/jira/resource/issuelink.rb +2 -0
- data/lib/jira/resource/issuelinktype.rb +2 -0
- data/lib/jira/resource/issuetype.rb +2 -0
- data/lib/jira/resource/priority.rb +2 -0
- data/lib/jira/resource/project.rb +4 -2
- data/lib/jira/resource/rapidview.rb +5 -3
- data/lib/jira/resource/remotelink.rb +2 -0
- data/lib/jira/resource/resolution.rb +2 -0
- data/lib/jira/resource/serverinfo.rb +2 -0
- data/lib/jira/resource/sprint.rb +14 -23
- data/lib/jira/resource/status.rb +7 -1
- data/lib/jira/resource/status_category.rb +10 -0
- data/lib/jira/resource/suggested_issue.rb +2 -0
- data/lib/jira/resource/transition.rb +2 -0
- data/lib/jira/resource/user.rb +3 -1
- data/lib/jira/resource/version.rb +2 -0
- data/lib/jira/resource/watcher.rb +2 -1
- data/lib/jira/resource/webhook.rb +4 -2
- data/lib/jira/resource/worklog.rb +3 -2
- data/lib/jira/version.rb +3 -1
- data/lib/jira-ruby.rb +5 -3
- data/lib/tasks/generate.rake +4 -2
- data/spec/data/files/short.txt +1 -0
- data/spec/integration/attachment_spec.rb +3 -3
- data/spec/integration/comment_spec.rb +8 -8
- data/spec/integration/component_spec.rb +7 -7
- data/spec/integration/field_spec.rb +3 -3
- data/spec/integration/issue_spec.rb +20 -16
- data/spec/integration/issuelinktype_spec.rb +3 -3
- data/spec/integration/issuetype_spec.rb +3 -3
- data/spec/integration/priority_spec.rb +3 -3
- data/spec/integration/project_spec.rb +7 -7
- data/spec/integration/rapidview_spec.rb +9 -9
- data/spec/integration/resolution_spec.rb +3 -3
- data/spec/integration/status_category_spec.rb +20 -0
- data/spec/integration/status_spec.rb +4 -8
- data/spec/integration/transition_spec.rb +2 -2
- data/spec/integration/user_spec.rb +22 -8
- data/spec/integration/version_spec.rb +7 -7
- data/spec/integration/watcher_spec.rb +17 -18
- data/spec/integration/webhook.rb +5 -4
- data/spec/integration/worklog_spec.rb +8 -8
- data/spec/jira/base_factory_spec.rb +2 -1
- data/spec/jira/base_spec.rb +55 -41
- data/spec/jira/client_spec.rb +48 -34
- data/spec/jira/has_many_proxy_spec.rb +3 -3
- data/spec/jira/http_client_spec.rb +98 -26
- data/spec/jira/http_error_spec.rb +2 -2
- data/spec/jira/oauth_client_spec.rb +30 -8
- data/spec/jira/request_client_spec.rb +4 -4
- data/spec/jira/resource/agile_spec.rb +28 -28
- data/spec/jira/resource/attachment_spec.rb +142 -52
- data/spec/jira/resource/board_spec.rb +21 -20
- data/spec/jira/resource/createmeta_spec.rb +48 -48
- data/spec/jira/resource/field_spec.rb +30 -12
- data/spec/jira/resource/filter_spec.rb +4 -4
- data/spec/jira/resource/issue_picker_suggestions_spec.rb +18 -18
- data/spec/jira/resource/issue_spec.rb +44 -38
- data/spec/jira/resource/jira_picker_suggestions_issue_spec.rb +3 -3
- data/spec/jira/resource/project_factory_spec.rb +3 -2
- data/spec/jira/resource/project_spec.rb +16 -16
- data/spec/jira/resource/sprint_spec.rb +70 -3
- data/spec/jira/resource/status_spec.rb +21 -0
- data/spec/jira/resource/user_factory_spec.rb +4 -4
- data/spec/jira/resource/worklog_spec.rb +3 -3
- data/spec/mock_responses/sprint/1.json +13 -0
- data/spec/mock_responses/status/1.json +8 -1
- data/spec/mock_responses/status.json +40 -5
- data/spec/mock_responses/statuscategory/1.json +7 -0
- data/spec/mock_responses/statuscategory.json +30 -0
- data/spec/mock_responses/{user_username=admin.json → user_accountId=1234567890abcdef01234567.json} +2 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/support/clients_helper.rb +3 -5
- data/spec/support/shared_examples/integration.rb +25 -28
- metadata +25 -257
- data/.travis.yml +0 -9
- data/example.rb +0 -232
- data/http-basic-example.rb +0 -113
- data/lib/jira/resource/sprint_report.rb +0 -8
- data/lib/jira/tasks.rb +0 -0
- data/spec/jira/jwt_uri_builder_spec.rb +0 -59
data/http-basic-example.rb
DELETED
@@ -1,113 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'pp'
|
3
|
-
require 'jira-ruby'
|
4
|
-
|
5
|
-
if ARGV.empty?
|
6
|
-
# If not passed any command line arguments, prompt the
|
7
|
-
# user for the username and password.
|
8
|
-
puts 'Enter the username: '
|
9
|
-
username = gets.strip
|
10
|
-
|
11
|
-
puts 'Enter the password: '
|
12
|
-
password = gets.strip
|
13
|
-
elsif ARGV.length == 2
|
14
|
-
username = ARGV[0]
|
15
|
-
password = ARGV[1]
|
16
|
-
else
|
17
|
-
# Script must be passed 0 or 2 arguments
|
18
|
-
raise "Usage: #{$PROGRAM_NAME} [ username password ]"
|
19
|
-
end
|
20
|
-
|
21
|
-
options = {
|
22
|
-
username: username,
|
23
|
-
password: password,
|
24
|
-
site: 'http://localhost:8080/',
|
25
|
-
context_path: '',
|
26
|
-
auth_type: :basic,
|
27
|
-
use_ssl: false
|
28
|
-
}
|
29
|
-
|
30
|
-
client = JIRA::Client.new(options)
|
31
|
-
|
32
|
-
# Show all projects
|
33
|
-
projects = client.Project.all
|
34
|
-
|
35
|
-
projects.each do |project|
|
36
|
-
puts "Project -> key: #{project.key}, name: #{project.name}"
|
37
|
-
end
|
38
|
-
|
39
|
-
# # Find a specific project by key
|
40
|
-
# # ------------------------------
|
41
|
-
# project = client.Project.find('SAMPLEPROJECT')
|
42
|
-
# pp project
|
43
|
-
# project.issues.each do |issue|
|
44
|
-
# puts "#{issue.id} - #{issue.fields['summary']}"
|
45
|
-
# end
|
46
|
-
#
|
47
|
-
# # List all Issues
|
48
|
-
# # ---------------
|
49
|
-
# client.Issue.all.each do |issue|
|
50
|
-
# puts "#{issue.id} - #{issue.fields['summary']}"
|
51
|
-
# end
|
52
|
-
#
|
53
|
-
# # List issues by JQL query
|
54
|
-
# # ------------------------
|
55
|
-
# client.Issue.jql('PROJECT = "SAMPLEPROJECT"', {fields: %w(summary status)}).each do |issue|
|
56
|
-
# puts "#{issue.id} - #{issue.fields['summary']}"
|
57
|
-
# end
|
58
|
-
#
|
59
|
-
# # Delete an issue
|
60
|
-
# # ---------------
|
61
|
-
# issue = client.Issue.find('SAMPLEPROJECT-2')
|
62
|
-
# if issue.delete
|
63
|
-
# puts "Delete of issue SAMPLEPROJECT-2 sucessful"
|
64
|
-
# else
|
65
|
-
# puts "Delete of issue SAMPLEPROJECT-2 failed"
|
66
|
-
# end
|
67
|
-
#
|
68
|
-
# # Create an issue
|
69
|
-
# # ---------------
|
70
|
-
# issue = client.Issue.build
|
71
|
-
# issue.save({"fields"=>{"summary"=>"blarg from in example.rb","project"=>{"id"=>"10001"},"issuetype"=>{"id"=>"3"}}})
|
72
|
-
# issue.fetch
|
73
|
-
# pp issue
|
74
|
-
#
|
75
|
-
# # Update an issue
|
76
|
-
# # ---------------
|
77
|
-
# issue = client.Issue.find("10002")
|
78
|
-
# issue.save({"fields"=>{"summary"=>"EVEN MOOOOOOARRR NINJAAAA!"}})
|
79
|
-
# pp issue
|
80
|
-
#
|
81
|
-
# # Find a user
|
82
|
-
# # -----------
|
83
|
-
# user = client.User.find('admin')
|
84
|
-
# pp user
|
85
|
-
#
|
86
|
-
# # Get all issue types
|
87
|
-
# # -------------------
|
88
|
-
# issuetypes = client.Issuetype.all
|
89
|
-
# pp issuetypes
|
90
|
-
#
|
91
|
-
# # Get a single issue type
|
92
|
-
# # -----------------------
|
93
|
-
# issuetype = client.Issuetype.find('5')
|
94
|
-
# pp issuetype
|
95
|
-
#
|
96
|
-
# # Get all comments for an issue
|
97
|
-
# # -----------------------------
|
98
|
-
# issue.comments.each do |comment|
|
99
|
-
# pp comment
|
100
|
-
# end
|
101
|
-
#
|
102
|
-
# # Build and Save a comment
|
103
|
-
# # ------------------------
|
104
|
-
# comment = issue.comments.build
|
105
|
-
# comment.save!(:body => "New comment from example script")
|
106
|
-
#
|
107
|
-
# # Delete a comment from the collection
|
108
|
-
# # ------------------------------------
|
109
|
-
# issue.comments.last.delete
|
110
|
-
#
|
111
|
-
# # Update an existing comment
|
112
|
-
# # --------------------------
|
113
|
-
# issue.comments.first.save({"body" => "an updated comment frome example.rb"})
|
data/lib/jira/tasks.rb
DELETED
File without changes
|
@@ -1,59 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe JIRA::JwtClient::JwtUriBuilder do
|
4
|
-
subject(:url_builder) do
|
5
|
-
JIRA::JwtClient::JwtUriBuilder.new(url, http_method, shared_secret, site, issuer)
|
6
|
-
end
|
7
|
-
|
8
|
-
let(:url) { '/foo' }
|
9
|
-
let(:http_method) { :get }
|
10
|
-
let(:shared_secret) { 'shared_secret' }
|
11
|
-
let(:site) { 'http://localhost:2990' }
|
12
|
-
let(:issuer) { nil }
|
13
|
-
|
14
|
-
describe '#build' do
|
15
|
-
subject { url_builder.build }
|
16
|
-
|
17
|
-
it 'includes the jwt param' do
|
18
|
-
expect(subject).to include('?jwt=')
|
19
|
-
end
|
20
|
-
|
21
|
-
context 'when the url already contains params' do
|
22
|
-
let(:url) { '/foo?expand=projects.issuetypes.fields' }
|
23
|
-
|
24
|
-
it 'includes the jwt param' do
|
25
|
-
expect(subject).to include('&jwt=')
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
context 'with a complete url' do
|
30
|
-
let(:url) { 'http://localhost:2990/rest/api/2/issue/createmeta' }
|
31
|
-
|
32
|
-
it 'includes the jwt param' do
|
33
|
-
expect(subject).to include('?jwt=')
|
34
|
-
end
|
35
|
-
|
36
|
-
it { is_expected.to start_with('/') }
|
37
|
-
|
38
|
-
it 'contains only one ?' do
|
39
|
-
expect(subject.count('?')).to eq(1)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
context 'with a complete url containing a param' do
|
44
|
-
let(:url) do
|
45
|
-
'http://localhost:2990/rest/api/2/issue/createmeta?expand=projects.issuetypes.fields'
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'includes the jwt param' do
|
49
|
-
expect(subject).to include('&jwt=')
|
50
|
-
end
|
51
|
-
|
52
|
-
it { is_expected.to start_with('/') }
|
53
|
-
|
54
|
-
it 'contains only one ?' do
|
55
|
-
expect(subject.count('?')).to eq(1)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|