jira-ruby 2.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +13 -0
- data/.travis.yml +9 -0
- data/Gemfile +14 -0
- data/Guardfile +14 -0
- data/LICENSE +19 -0
- data/README.md +427 -0
- data/Rakefile +31 -0
- data/example.rb +224 -0
- data/http-basic-example.rb +113 -0
- data/jira-ruby.gemspec +35 -0
- data/lib/jira-ruby.rb +49 -0
- data/lib/jira/base.rb +525 -0
- data/lib/jira/base_factory.rb +46 -0
- data/lib/jira/client.rb +308 -0
- data/lib/jira/has_many_proxy.rb +42 -0
- data/lib/jira/http_client.rb +112 -0
- data/lib/jira/http_error.rb +14 -0
- data/lib/jira/jwt_client.rb +67 -0
- data/lib/jira/oauth_client.rb +114 -0
- data/lib/jira/railtie.rb +10 -0
- data/lib/jira/request_client.rb +31 -0
- data/lib/jira/resource/agile.rb +79 -0
- data/lib/jira/resource/applinks.rb +39 -0
- data/lib/jira/resource/attachment.rb +50 -0
- data/lib/jira/resource/board.rb +91 -0
- data/lib/jira/resource/board_configuration.rb +9 -0
- data/lib/jira/resource/comment.rb +12 -0
- data/lib/jira/resource/component.rb +8 -0
- data/lib/jira/resource/createmeta.rb +44 -0
- data/lib/jira/resource/field.rb +83 -0
- data/lib/jira/resource/filter.rb +15 -0
- data/lib/jira/resource/issue.rb +141 -0
- data/lib/jira/resource/issuelink.rb +20 -0
- data/lib/jira/resource/issuelinktype.rb +14 -0
- data/lib/jira/resource/issuetype.rb +8 -0
- data/lib/jira/resource/priority.rb +8 -0
- data/lib/jira/resource/project.rb +41 -0
- data/lib/jira/resource/rapidview.rb +67 -0
- data/lib/jira/resource/remotelink.rb +26 -0
- data/lib/jira/resource/resolution.rb +8 -0
- data/lib/jira/resource/serverinfo.rb +18 -0
- data/lib/jira/resource/sprint.rb +105 -0
- data/lib/jira/resource/sprint_report.rb +8 -0
- data/lib/jira/resource/status.rb +8 -0
- data/lib/jira/resource/transition.rb +29 -0
- data/lib/jira/resource/user.rb +30 -0
- data/lib/jira/resource/version.rb +8 -0
- data/lib/jira/resource/watcher.rb +35 -0
- data/lib/jira/resource/webhook.rb +37 -0
- data/lib/jira/resource/worklog.rb +14 -0
- data/lib/jira/tasks.rb +0 -0
- data/lib/jira/version.rb +3 -0
- data/lib/tasks/generate.rake +18 -0
- data/spec/integration/attachment_spec.rb +32 -0
- data/spec/integration/comment_spec.rb +52 -0
- data/spec/integration/component_spec.rb +39 -0
- data/spec/integration/field_spec.rb +32 -0
- data/spec/integration/issue_spec.rb +93 -0
- data/spec/integration/issuelinktype_spec.rb +26 -0
- data/spec/integration/issuetype_spec.rb +24 -0
- data/spec/integration/priority_spec.rb +24 -0
- data/spec/integration/project_spec.rb +49 -0
- data/spec/integration/rapidview_spec.rb +74 -0
- data/spec/integration/resolution_spec.rb +26 -0
- data/spec/integration/status_spec.rb +24 -0
- data/spec/integration/transition_spec.rb +49 -0
- data/spec/integration/user_spec.rb +41 -0
- data/spec/integration/version_spec.rb +39 -0
- data/spec/integration/watcher_spec.rb +62 -0
- data/spec/integration/webhook.rb +25 -0
- data/spec/integration/worklog_spec.rb +51 -0
- data/spec/jira/base_factory_spec.rb +45 -0
- data/spec/jira/base_spec.rb +598 -0
- data/spec/jira/client_spec.rb +291 -0
- data/spec/jira/has_many_proxy_spec.rb +46 -0
- data/spec/jira/http_client_spec.rb +328 -0
- data/spec/jira/http_error_spec.rb +24 -0
- data/spec/jira/jwt_uri_builder_spec.rb +59 -0
- data/spec/jira/oauth_client_spec.rb +162 -0
- data/spec/jira/request_client_spec.rb +41 -0
- data/spec/jira/resource/agile_spec.rb +135 -0
- data/spec/jira/resource/attachment_spec.rb +138 -0
- data/spec/jira/resource/board_spec.rb +224 -0
- data/spec/jira/resource/createmeta_spec.rb +258 -0
- data/spec/jira/resource/field_spec.rb +85 -0
- data/spec/jira/resource/filter_spec.rb +97 -0
- data/spec/jira/resource/issue_spec.rb +227 -0
- data/spec/jira/resource/issuelink_spec.rb +14 -0
- data/spec/jira/resource/project_factory_spec.rb +11 -0
- data/spec/jira/resource/project_spec.rb +123 -0
- data/spec/jira/resource/sprint_spec.rb +90 -0
- data/spec/jira/resource/user_factory_spec.rb +31 -0
- data/spec/jira/resource/worklog_spec.rb +22 -0
- data/spec/mock_responses/board/1.json +33 -0
- data/spec/mock_responses/board/1_issues.json +62 -0
- data/spec/mock_responses/component.post.json +28 -0
- data/spec/mock_responses/component/10000.invalid.put.json +5 -0
- data/spec/mock_responses/component/10000.json +39 -0
- data/spec/mock_responses/component/10000.put.json +39 -0
- data/spec/mock_responses/empty_issues.json +8 -0
- data/spec/mock_responses/field.json +32 -0
- data/spec/mock_responses/field/1.json +15 -0
- data/spec/mock_responses/issue.json +1108 -0
- data/spec/mock_responses/issue.post.json +5 -0
- data/spec/mock_responses/issue/10002.invalid.put.json +6 -0
- data/spec/mock_responses/issue/10002.json +126 -0
- data/spec/mock_responses/issue/10002.put.missing_field_update.json +6 -0
- data/spec/mock_responses/issue/10002/attachments/10000.json +20 -0
- data/spec/mock_responses/issue/10002/comment.json +65 -0
- data/spec/mock_responses/issue/10002/comment.post.json +29 -0
- data/spec/mock_responses/issue/10002/comment/10000.json +29 -0
- data/spec/mock_responses/issue/10002/comment/10000.put.json +29 -0
- data/spec/mock_responses/issue/10002/transitions.json +49 -0
- data/spec/mock_responses/issue/10002/transitions.post.json +1 -0
- data/spec/mock_responses/issue/10002/watchers.json +13 -0
- data/spec/mock_responses/issue/10002/worklog.json +98 -0
- data/spec/mock_responses/issue/10002/worklog.post.json +30 -0
- data/spec/mock_responses/issue/10002/worklog/10000.json +31 -0
- data/spec/mock_responses/issue/10002/worklog/10000.put.json +30 -0
- data/spec/mock_responses/issueLinkType.json +25 -0
- data/spec/mock_responses/issueLinkType/10000.json +7 -0
- data/spec/mock_responses/issuetype.json +42 -0
- data/spec/mock_responses/issuetype/5.json +8 -0
- data/spec/mock_responses/jira/rest/webhooks/1.0/webhook.json +11 -0
- data/spec/mock_responses/jira/rest/webhooks/1.0/webhook/2.json +11 -0
- data/spec/mock_responses/priority.json +42 -0
- data/spec/mock_responses/priority/1.json +8 -0
- data/spec/mock_responses/project.json +12 -0
- data/spec/mock_responses/project/SAMPLEPROJECT.issues.json +1108 -0
- data/spec/mock_responses/project/SAMPLEPROJECT.json +84 -0
- data/spec/mock_responses/rapidview.json +10 -0
- data/spec/mock_responses/rapidview/SAMPLEPROJECT.issues.full.json +276 -0
- data/spec/mock_responses/rapidview/SAMPLEPROJECT.issues.json +111 -0
- data/spec/mock_responses/rapidview/SAMPLEPROJECT.json +6 -0
- data/spec/mock_responses/resolution.json +15 -0
- data/spec/mock_responses/resolution/1.json +7 -0
- data/spec/mock_responses/sprint/1_issues.json +125 -0
- data/spec/mock_responses/status.json +37 -0
- data/spec/mock_responses/status/1.json +7 -0
- data/spec/mock_responses/user_username=admin.json +17 -0
- data/spec/mock_responses/version.post.json +7 -0
- data/spec/mock_responses/version/10000.invalid.put.json +5 -0
- data/spec/mock_responses/version/10000.json +11 -0
- data/spec/mock_responses/version/10000.put.json +7 -0
- data/spec/mock_responses/webhook.json +11 -0
- data/spec/mock_responses/webhook/webhook.json +11 -0
- data/spec/spec_helper.rb +21 -0
- data/spec/support/clients_helper.rb +16 -0
- data/spec/support/matchers/have_attributes.rb +11 -0
- data/spec/support/matchers/have_many.rb +9 -0
- data/spec/support/matchers/have_one.rb +5 -0
- data/spec/support/shared_examples/integration.rb +177 -0
- metadata +491 -0
data/Rakefile
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
require 'rdoc/task'
|
6
|
+
|
7
|
+
Dir.glob('lib/tasks/*.rake').each { |r| import r }
|
8
|
+
|
9
|
+
task default: [:test]
|
10
|
+
|
11
|
+
task test: %i[prepare spec]
|
12
|
+
|
13
|
+
desc 'Prepare and run rspec tests'
|
14
|
+
task :prepare do
|
15
|
+
rsa_key = File.expand_path('rsakey.pem')
|
16
|
+
unless File.exist?(rsa_key)
|
17
|
+
raise 'rsakey.pem does not exist, tests will fail. Run `rake jira:generate_public_cert` first'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
desc 'Run RSpec tests'
|
22
|
+
# RSpec::Core::RakeTask.new(:spec)
|
23
|
+
RSpec::Core::RakeTask.new(:spec) do |task|
|
24
|
+
task.rspec_opts = ['--color', '--format', 'doc']
|
25
|
+
end
|
26
|
+
|
27
|
+
Rake::RDocTask.new(:doc) do |rd|
|
28
|
+
rd.main = 'README.rdoc'
|
29
|
+
rd.rdoc_dir = 'doc'
|
30
|
+
rd.rdoc_files.include('README.rdoc', 'lib/**/*.rb')
|
31
|
+
end
|
data/example.rb
ADDED
@@ -0,0 +1,224 @@
|
|
1
|
+
require 'pp'
|
2
|
+
require './lib/jira-ruby'
|
3
|
+
|
4
|
+
CONSUMER_KEY = 'test'
|
5
|
+
SITE = 'https://test.jira.com'
|
6
|
+
|
7
|
+
options = {
|
8
|
+
:private_key_file => "rsakey.pem",
|
9
|
+
:context_path => '',
|
10
|
+
:consumer_key => CONSUMER_KEY,
|
11
|
+
:site => SITE
|
12
|
+
}
|
13
|
+
|
14
|
+
client = JIRA::Client.new(options)
|
15
|
+
|
16
|
+
if ARGV.length == 0
|
17
|
+
# If not passed any command line arguments, open a browser and prompt the
|
18
|
+
# user for the OAuth verifier.
|
19
|
+
request_token = client.request_token
|
20
|
+
puts "Opening #{request_token.authorize_url}"
|
21
|
+
system "open #{request_token.authorize_url}"
|
22
|
+
|
23
|
+
puts "Enter the oauth_verifier: "
|
24
|
+
oauth_verifier = gets.strip
|
25
|
+
|
26
|
+
access_token = client.init_access_token(:oauth_verifier => oauth_verifier)
|
27
|
+
puts "Access token: #{access_token.token} secret: #{access_token.secret}"
|
28
|
+
elsif ARGV.length == 2
|
29
|
+
# Otherwise assume the arguments are a previous access token and secret.
|
30
|
+
access_token = client.set_access_token(ARGV[0], ARGV[1])
|
31
|
+
else
|
32
|
+
# Script must be passed 0 or 2 arguments
|
33
|
+
raise "Usage: #{$0} [ token secret ]"
|
34
|
+
end
|
35
|
+
|
36
|
+
# Show all projects
|
37
|
+
projects = client.Project.all
|
38
|
+
|
39
|
+
projects.each do |project|
|
40
|
+
puts "Project -> key: #{project.key}, name: #{project.name}"
|
41
|
+
end
|
42
|
+
issue = client.Issue.find('SAMPLEPROJECT-1')
|
43
|
+
pp issue
|
44
|
+
|
45
|
+
# # Handling fields by name, rather than by id
|
46
|
+
# # ------------------------------------------
|
47
|
+
# Cache the Field list from the server
|
48
|
+
client.Field.map_fields
|
49
|
+
# This allows use of friendlier names for custom fields
|
50
|
+
# Say that 'Special Field' is customfield_12345
|
51
|
+
# It becomes mapped to Special_Field which is usable as a method call
|
52
|
+
#
|
53
|
+
# Say that there is a second 'Special Field' is customfield_54321
|
54
|
+
# Names are deduplicated so the second 'Special Field' becomes Special_Field_54321
|
55
|
+
#
|
56
|
+
# Names are massaged to get rid of special characters, and spaces
|
57
|
+
# So 'Special & @ Field' becomes Special_____Field - not perfect, but usable
|
58
|
+
old_way = issue.customfield_12345
|
59
|
+
new_way = issue.Special_Field
|
60
|
+
(old_way == new_way) && puts 'much easier'
|
61
|
+
#
|
62
|
+
# You can also specify fields to be returned in the response
|
63
|
+
# This is especially useful in regards to shortening JQL query response times if performance becomes an issue
|
64
|
+
client.Issue.jql(a_normal_jql_search, fields:[:description, :summary, :Special_field, :created])
|
65
|
+
# Or you could always do it the old way - if you can remember the custom field numbers...
|
66
|
+
client.Issue.jql(a_normal_jql_search, fields:[:description, :summary, :customfield_1234, :created])
|
67
|
+
# You can also specify the maximum number of results to be returned in the response, i.e. 500
|
68
|
+
client.Issue.jql(a_normal_jql_search, max_results: 500)
|
69
|
+
|
70
|
+
# # Find a specific project by key
|
71
|
+
# # ------------------------------
|
72
|
+
# project = client.Project.find('SAMPLEPROJECT')
|
73
|
+
# pp project
|
74
|
+
# project.issues.each do |issue|
|
75
|
+
# puts "#{issue.id} - #{issue.fields['summary']}"
|
76
|
+
# end
|
77
|
+
#
|
78
|
+
# # List all Issues
|
79
|
+
# # ---------------
|
80
|
+
# client.Issue.all.each do |issue|
|
81
|
+
# puts "#{issue.id} - #{issue.fields['summary']}"
|
82
|
+
# end
|
83
|
+
#
|
84
|
+
# # List issues by JQL query
|
85
|
+
# # ------------------------
|
86
|
+
# client.Issue.jql('PROJECT = "SAMPLEPROJECT"', [comments, summary]).each do |issue|
|
87
|
+
# puts "#{issue.id} - #{issue.fields['summary']}"
|
88
|
+
# end
|
89
|
+
#
|
90
|
+
# # Delete an issue
|
91
|
+
# # ---------------
|
92
|
+
# issue = client.Issue.find('SAMPLEPROJECT-2')
|
93
|
+
# if issue.delete
|
94
|
+
# puts "Delete of issue SAMPLEPROJECT-2 sucessful"
|
95
|
+
# else
|
96
|
+
# puts "Delete of issue SAMPLEPROJECT-2 failed"
|
97
|
+
# end
|
98
|
+
#
|
99
|
+
# # Create an issue
|
100
|
+
# # ---------------
|
101
|
+
# issue = client.Issue.build
|
102
|
+
# labels = ['label1', 'label2']
|
103
|
+
# issue.save({
|
104
|
+
# "fields" => {
|
105
|
+
# "summary" => "blarg from in example.rb",
|
106
|
+
# "project" => {"key" => "SAMPLEPROJECT"},
|
107
|
+
# "issuetype" => {"id" => "3"},
|
108
|
+
# "labels" => labels,
|
109
|
+
# "priority" => {"id" => "1"}
|
110
|
+
# }
|
111
|
+
# })
|
112
|
+
# issue.fetch
|
113
|
+
# pp issue
|
114
|
+
#
|
115
|
+
# # Update an issue
|
116
|
+
# # ---------------
|
117
|
+
# issue = client.Issue.find("10002")
|
118
|
+
# issue.save({"fields"=>{"summary"=>"EVEN MOOOOOOARRR NINJAAAA!"}})
|
119
|
+
# pp issue
|
120
|
+
#
|
121
|
+
# # Transition an issue
|
122
|
+
# # -------------------
|
123
|
+
# issue_transition = issue.transitions.build
|
124
|
+
# issue_transition.save!('transition' => {'id' => transition_id})
|
125
|
+
#
|
126
|
+
# # Change assignee
|
127
|
+
# # -------------------
|
128
|
+
# issue.save({'fields' => {'assignee' => {'name' => person_name}}})
|
129
|
+
#
|
130
|
+
# # Find a user
|
131
|
+
# # -----------
|
132
|
+
# user = client.User.find('admin')
|
133
|
+
# pp user
|
134
|
+
#
|
135
|
+
# # Get all issue watchers
|
136
|
+
# # ----------------------
|
137
|
+
# issue = client.Issue.find("10002")
|
138
|
+
# watchers = issue.watchers.all
|
139
|
+
# watchers = client.Watcher.all(:issue => issue)
|
140
|
+
# # Get all issue types
|
141
|
+
# # -------------------
|
142
|
+
# issuetypes = client.Issuetype.all
|
143
|
+
# pp issuetypes
|
144
|
+
#
|
145
|
+
# # Get a single issue type
|
146
|
+
# # -----------------------
|
147
|
+
# issuetype = client.Issuetype.find('5')
|
148
|
+
# pp issuetype
|
149
|
+
#
|
150
|
+
# # Get all comments for an issue
|
151
|
+
# # -----------------------------
|
152
|
+
# issue.comments.each do |comment|
|
153
|
+
# pp comment
|
154
|
+
# end
|
155
|
+
#
|
156
|
+
# # Build and Save a comment
|
157
|
+
# # ------------------------
|
158
|
+
# comment = issue.comments.build
|
159
|
+
# comment.save!(:body => "New comment from example script")
|
160
|
+
#
|
161
|
+
# # Delete a comment from the collection
|
162
|
+
# # ------------------------------------
|
163
|
+
# issue.comments.last.delete
|
164
|
+
#
|
165
|
+
# # Update an existing comment
|
166
|
+
# # --------------------------
|
167
|
+
# issue.comments.first.save({"body" => "an updated comment frome example.rb"})
|
168
|
+
|
169
|
+
# List all available link types
|
170
|
+
# ------------------------------
|
171
|
+
pp client.Issuelinktype.all
|
172
|
+
|
173
|
+
# List issue's links
|
174
|
+
# -------------------------
|
175
|
+
issue = client.Issue.find("10002")
|
176
|
+
pp issue.issuelinks
|
177
|
+
|
178
|
+
# Link two issues (on the same Jira instance)
|
179
|
+
# --------------------------------------------
|
180
|
+
link = client.Issuelink.build
|
181
|
+
link.save(
|
182
|
+
{
|
183
|
+
:type => {:name => 'Relates'},
|
184
|
+
:inwardIssue => {:key => 'AL-1'},
|
185
|
+
:outwardIssue => {:key => 'AL-2'}
|
186
|
+
}
|
187
|
+
)
|
188
|
+
|
189
|
+
# List issue's remote links
|
190
|
+
# -------------------------
|
191
|
+
pp issue.remotelink.all
|
192
|
+
|
193
|
+
# Link two remote issues (on the different Jira instance)
|
194
|
+
# In order to add remote links, you have to add
|
195
|
+
# Application Links between two Jira instances first.
|
196
|
+
# More information:
|
197
|
+
# https://developer.atlassian.com/jiradev/jira-platform/guides/other/guide-jira-remote-issue-links/fields-in-remote-issue-links
|
198
|
+
# http://stackoverflow.com/questions/29850252/jira-api-issuelink-connect-two-different-instances
|
199
|
+
# -------------------------------------------------------
|
200
|
+
client_1 = JIRA::Client.new(options)
|
201
|
+
client_2 = JIRA::Client.new(options)
|
202
|
+
|
203
|
+
# you have to search for your app id here, instead of getting the first
|
204
|
+
client_2_app_link = client_2.ApplicationLink.manifest
|
205
|
+
issue_1 = client_1.Issue.find('BB-2')
|
206
|
+
issue_2 = client_2.Issue.find('AA-1')
|
207
|
+
|
208
|
+
remote_link = issue_2.remotelink.build
|
209
|
+
|
210
|
+
remote_link.save(
|
211
|
+
{
|
212
|
+
:globalId => "appId=#{client_2_app_link.id}&issueId=#{issue_1.id}",
|
213
|
+
:application => {
|
214
|
+
:type => 'com.atlassian.jira',
|
215
|
+
:name => client_2_app_link['name']
|
216
|
+
},
|
217
|
+
:relationship => 'relates to',
|
218
|
+
|
219
|
+
:object => {
|
220
|
+
:url => client_1.options[:site] + client_1.options[:context_path] + "/browse/#{issue_1.key}",
|
221
|
+
:title => issue_1.key,
|
222
|
+
}
|
223
|
+
}
|
224
|
+
)
|
@@ -0,0 +1,113 @@
|
|
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/jira-ruby.gemspec
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
$LOAD_PATH.push File.expand_path('lib', __dir__)
|
2
|
+
require 'jira/version'
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = 'jira-ruby'
|
6
|
+
s.version = JIRA::VERSION
|
7
|
+
s.authors = ['SUMO Heavy Industries', 'test IO']
|
8
|
+
s.homepage = 'http://www.sumoheavy.com'
|
9
|
+
s.summary = 'Ruby Gem for use with the Atlassian JIRA REST API'
|
10
|
+
s.description = 'API for JIRA'
|
11
|
+
s.licenses = ['MIT']
|
12
|
+
s.metadata = { 'source_code_uri' => 'https://github.com/sumoheavy/jira-ruby' }
|
13
|
+
|
14
|
+
s.required_ruby_version = '>= 1.9.3'
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
19
|
+
s.require_paths = ['lib']
|
20
|
+
|
21
|
+
# Runtime Dependencies
|
22
|
+
s.add_runtime_dependency 'activesupport'
|
23
|
+
s.add_runtime_dependency 'atlassian-jwt'
|
24
|
+
s.add_runtime_dependency 'multipart-post'
|
25
|
+
s.add_runtime_dependency 'oauth', '~> 0.5', '>= 0.5.0'
|
26
|
+
|
27
|
+
# Development Dependencies
|
28
|
+
s.add_development_dependency 'guard', '~> 2.13', '>= 2.13.0'
|
29
|
+
s.add_development_dependency 'guard-rspec', '~> 4.6', '>= 4.6.5'
|
30
|
+
s.add_development_dependency 'pry', '~> 0.10', '>= 0.10.3'
|
31
|
+
s.add_development_dependency 'railties'
|
32
|
+
s.add_development_dependency 'rake', '~> 10.3', '>= 10.3.2'
|
33
|
+
s.add_development_dependency 'rspec', '~> 3.0', '>= 3.0.0'
|
34
|
+
s.add_development_dependency 'webmock', '~> 1.18', '>= 1.18.0'
|
35
|
+
end
|
data/lib/jira-ruby.rb
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
$LOAD_PATH << __dir__
|
2
|
+
|
3
|
+
require 'active_support/inflector'
|
4
|
+
ActiveSupport::Inflector.inflections do |inflector|
|
5
|
+
inflector.singular /status$/, 'status'
|
6
|
+
end
|
7
|
+
|
8
|
+
require 'jira/base'
|
9
|
+
require 'jira/base_factory'
|
10
|
+
require 'jira/has_many_proxy'
|
11
|
+
require 'jira/http_error'
|
12
|
+
|
13
|
+
require 'jira/resource/user'
|
14
|
+
require 'jira/resource/watcher'
|
15
|
+
require 'jira/resource/attachment'
|
16
|
+
require 'jira/resource/component'
|
17
|
+
require 'jira/resource/issuetype'
|
18
|
+
require 'jira/resource/version'
|
19
|
+
require 'jira/resource/status'
|
20
|
+
require 'jira/resource/transition'
|
21
|
+
require 'jira/resource/project'
|
22
|
+
require 'jira/resource/priority'
|
23
|
+
require 'jira/resource/comment'
|
24
|
+
require 'jira/resource/worklog'
|
25
|
+
require 'jira/resource/applinks'
|
26
|
+
require 'jira/resource/issuelinktype'
|
27
|
+
require 'jira/resource/issuelink'
|
28
|
+
require 'jira/resource/remotelink'
|
29
|
+
require 'jira/resource/sprint'
|
30
|
+
require 'jira/resource/sprint_report'
|
31
|
+
require 'jira/resource/issue'
|
32
|
+
require 'jira/resource/filter'
|
33
|
+
require 'jira/resource/field'
|
34
|
+
require 'jira/resource/rapidview'
|
35
|
+
require 'jira/resource/resolution'
|
36
|
+
require 'jira/resource/serverinfo'
|
37
|
+
require 'jira/resource/createmeta'
|
38
|
+
require 'jira/resource/webhook'
|
39
|
+
require 'jira/resource/agile'
|
40
|
+
require 'jira/resource/board'
|
41
|
+
require 'jira/resource/board_configuration'
|
42
|
+
|
43
|
+
require 'jira/request_client'
|
44
|
+
require 'jira/oauth_client'
|
45
|
+
require 'jira/http_client'
|
46
|
+
require 'jira/jwt_client'
|
47
|
+
require 'jira/client'
|
48
|
+
|
49
|
+
require 'jira/railtie' if defined?(Rails)
|