jira-ruby 0.1.4 → 0.1.5
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/.travis.yml +2 -2
- data/Rakefile +1 -1
- data/jira-ruby.gemspec +1 -0
- data/lib/jira.rb +2 -1
- data/lib/jira/client.rb +4 -0
- data/lib/jira/resource/issue.rb +6 -1
- data/lib/jira/resource/transition.rb +33 -0
- data/lib/jira/version.rb +1 -1
- data/lib/tasks/generate.rake +1 -1
- data/spec/integration/comment_spec.rb +3 -2
- data/spec/integration/transition_spec.rb +52 -0
- data/spec/mock_responses/issue/10002/transitions.json +49 -0
- data/spec/mock_responses/issue/10002/transitions.post.json +1 -0
- metadata +10 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c75127a06e6226f648f380f18578b9c63d4f781f
|
4
|
+
data.tar.gz: 8721b558929673f2ac4c54894c9ea5b76e3833a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb03466008cc9fcbce530a7eed8bb16e17d9c9c9313c98f2c12a068af0f52fa92e9c4fa841c7fca73d263527c2ae1a235579a6341def921c059a9c905cb7363a
|
7
|
+
data.tar.gz: cf6d4f40e871b9b2849518041654988ab31c47e6f9a37e36abd81f8de554925755ca964f2f8545a1c360dba2383dfb2bd96394b0d78521214fd48adeae650c09
|
data/.travis.yml
CHANGED
data/Rakefile
CHANGED
@@ -13,7 +13,7 @@ task :test => [:prepare, :spec]
|
|
13
13
|
desc 'Prepare and run rspec tests'
|
14
14
|
task :prepare do
|
15
15
|
rsa_key = File.expand_path('rsakey.pem')
|
16
|
-
|
16
|
+
unless File.exists?(rsa_key)
|
17
17
|
raise 'rsakey.pem does not exist, tests will fail. Run `rake jira:generate_public_cert` first'
|
18
18
|
end
|
19
19
|
end
|
data/jira-ruby.gemspec
CHANGED
data/lib/jira.rb
CHANGED
@@ -15,9 +15,10 @@ require 'jira/resource/attachment'
|
|
15
15
|
require 'jira/resource/component'
|
16
16
|
require 'jira/resource/issuetype'
|
17
17
|
require 'jira/resource/version'
|
18
|
+
require 'jira/resource/status'
|
19
|
+
require 'jira/resource/transition'
|
18
20
|
require 'jira/resource/project'
|
19
21
|
require 'jira/resource/priority'
|
20
|
-
require 'jira/resource/status'
|
21
22
|
require 'jira/resource/comment'
|
22
23
|
require 'jira/resource/worklog'
|
23
24
|
require 'jira/resource/issue'
|
data/lib/jira/client.rb
CHANGED
@@ -111,6 +111,10 @@ module JIRA
|
|
111
111
|
JIRA::Resource::VersionFactory.new(self)
|
112
112
|
end
|
113
113
|
|
114
|
+
def Transition # :nodoc:
|
115
|
+
JIRA::Resource::TransitionFactory.new(self)
|
116
|
+
end
|
117
|
+
|
114
118
|
# HTTP methods without a body
|
115
119
|
def delete(path, headers = {})
|
116
120
|
request(:delete, path, nil, merge_default_headers(headers))
|
data/lib/jira/resource/issue.rb
CHANGED
@@ -20,6 +20,8 @@ module JIRA
|
|
20
20
|
|
21
21
|
has_one :status, :nested_under => 'fields'
|
22
22
|
|
23
|
+
has_many :transitions
|
24
|
+
|
23
25
|
has_many :components, :nested_under => 'fields'
|
24
26
|
|
25
27
|
has_many :comments, :nested_under => ['fields','comment']
|
@@ -32,7 +34,10 @@ module JIRA
|
|
32
34
|
has_many :worklogs, :nested_under => ['fields','worklog']
|
33
35
|
|
34
36
|
def self.all(client)
|
35
|
-
response = client.get(
|
37
|
+
response = client.get(
|
38
|
+
client.options[:rest_base_path] + "/search",
|
39
|
+
:expand => 'transitions.fields'
|
40
|
+
)
|
36
41
|
json = parse_json(response.body)
|
37
42
|
json['issues'].map do |issue|
|
38
43
|
client.Issue.build(issue)
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module JIRA
|
2
|
+
module Resource
|
3
|
+
|
4
|
+
class TransitionFactory < JIRA::BaseFactory # :nodoc:
|
5
|
+
end
|
6
|
+
|
7
|
+
class Transition < JIRA::Base
|
8
|
+
has_one :to, :class => JIRA::Resource::Status
|
9
|
+
belongs_to :issue
|
10
|
+
|
11
|
+
nested_collections true
|
12
|
+
|
13
|
+
def self.endpoint_name
|
14
|
+
'transitions'
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.all(client, options = {})
|
18
|
+
issue = options[:issue]
|
19
|
+
unless issue
|
20
|
+
raise ArgumentError.new("parent issue is required")
|
21
|
+
end
|
22
|
+
|
23
|
+
path = "#{issue.self}/#{endpoint_name}?expand=transitions.fields"
|
24
|
+
response = client.get(path)
|
25
|
+
json = parse_json(response.body)
|
26
|
+
json['transitions'].map do |transition|
|
27
|
+
issue.transitions.build(transition)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
data/lib/jira/version.rb
CHANGED
data/lib/tasks/generate.rake
CHANGED
@@ -10,7 +10,7 @@ namespace :jira do
|
|
10
10
|
desc "Run the system call to generate a RSA public certificate"
|
11
11
|
task :generate_public_cert do
|
12
12
|
puts "Executing 'openssl req -x509 -nodes -newkey rsa:1024 -sha1 -keyout rsakey.pem -out rsacert.pem'"
|
13
|
-
system(
|
13
|
+
system('openssl req -x509 -subj "/C=US/ST=New York/L=New York/O=SUMO Heavy Industries/CN=www.sumoheavy.com" -nodes -newkey rsa:1024 -sha1 -keyout rsakey.pem -out rsacert.pem')
|
14
14
|
puts "Done. The RSA-SHA1 private keyfile is in the current directory: \'rsakey.pem\'."
|
15
15
|
puts "You will need to copy the following certificate into your application link configuration in Jira:"
|
16
16
|
system("cat rsacert.pem")
|
@@ -14,7 +14,8 @@ describe JIRA::Resource::Comment do
|
|
14
14
|
|
15
15
|
let(:belongs_to) {
|
16
16
|
JIRA::Resource::Issue.new(client, :attrs => {
|
17
|
-
'id' => '10002',
|
17
|
+
'id' => '10002',
|
18
|
+
'fields' => {
|
18
19
|
'comment' => {'comments' => []}
|
19
20
|
}
|
20
21
|
})
|
@@ -29,7 +30,7 @@ describe JIRA::Resource::Comment do
|
|
29
30
|
end
|
30
31
|
|
31
32
|
let(:attributes_for_post) {
|
32
|
-
{"body" => "new comment"}
|
33
|
+
{ "body" => "new comment" }
|
33
34
|
}
|
34
35
|
let(:expected_attributes_from_post) {
|
35
36
|
{ "id" => "10001", "body" => "new comment"}
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe JIRA::Resource::Transition do
|
4
|
+
|
5
|
+
with_each_client do |site_url, client|
|
6
|
+
let(:client) { client }
|
7
|
+
let(:site_url) { site_url }
|
8
|
+
|
9
|
+
let(:key) { '10000' }
|
10
|
+
|
11
|
+
let(:target) { JIRA::Resource::Transition.new(client, :attrs => {'id' => '99999'}, :issue_id => '10014') }
|
12
|
+
|
13
|
+
let(:belongs_to) {
|
14
|
+
JIRA::Resource::Issue.new(client, :attrs => {
|
15
|
+
'id' => '10002',
|
16
|
+
'self' => "#{site_url}/jira/rest/api/2/issue/10002",
|
17
|
+
'fields' => {
|
18
|
+
'comment' => {'comments' => []}
|
19
|
+
}
|
20
|
+
})
|
21
|
+
}
|
22
|
+
|
23
|
+
let(:expected_attributes) do
|
24
|
+
{
|
25
|
+
'self' => "#{site_url}/jira/rest/api/2/issue/10002/transition/10000",
|
26
|
+
'id' => key
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
let(:attributes_for_post) {
|
31
|
+
{
|
32
|
+
'transition' => {
|
33
|
+
'id' => '42'
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
it_should_behave_like "a resource"
|
39
|
+
|
40
|
+
describe "POST endpoint" do
|
41
|
+
it "saves a new resource" do
|
42
|
+
stub_request(:post, /#{described_class.collection_path(client, prefix)}$/)
|
43
|
+
.with(:body => attributes_for_post.to_json)
|
44
|
+
.to_return(:status => 200, :body => get_mock_from_path(:post))
|
45
|
+
subject = build_receiver.build
|
46
|
+
subject.save(attributes_for_post).should be_true
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
{
|
2
|
+
"expand": "transitions",
|
3
|
+
"transitions": [
|
4
|
+
{
|
5
|
+
"id": "41",
|
6
|
+
"name": "Review",
|
7
|
+
"to": {
|
8
|
+
"self": "http://localhost:2990/rest/api/2/status/10006",
|
9
|
+
"description": "",
|
10
|
+
"iconUrl": "http://localhost:2990/images/icons/statuses/generic.png",
|
11
|
+
"name": "Reviewable",
|
12
|
+
"id": "10006"
|
13
|
+
}
|
14
|
+
},
|
15
|
+
{
|
16
|
+
"id": "101",
|
17
|
+
"name": "Stop Progress",
|
18
|
+
"to": {
|
19
|
+
"self": "http://localhost:2990/rest/api/2/status/10017",
|
20
|
+
"description": "Mapping for Accepted in Pivotal Tracker",
|
21
|
+
"iconUrl": "http://localhost:2990/images/icons/statuses/closed.png",
|
22
|
+
"name": "Accepted",
|
23
|
+
"id": "10017"
|
24
|
+
}
|
25
|
+
},
|
26
|
+
{
|
27
|
+
"id": "21",
|
28
|
+
"name": "Remove from Backlog",
|
29
|
+
"to": {
|
30
|
+
"self": "http://localhost:2990/rest/api/2/status/1",
|
31
|
+
"description": "The issue is open and ready for the assignee to start work on it.",
|
32
|
+
"iconUrl": "http://localhost:2990/images/icons/statuses/open.png",
|
33
|
+
"name": "Open",
|
34
|
+
"id": "1"
|
35
|
+
}
|
36
|
+
},
|
37
|
+
{
|
38
|
+
"id": "71",
|
39
|
+
"name": "Resolve",
|
40
|
+
"to": {
|
41
|
+
"self": "http://localhost:2990/rest/api/2/status/5",
|
42
|
+
"description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.",
|
43
|
+
"iconUrl": "http://localhost:2990/images/icons/statuses/resolved.png",
|
44
|
+
"name": "Resolved",
|
45
|
+
"id": "5"
|
46
|
+
}
|
47
|
+
}
|
48
|
+
]
|
49
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jira-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SUMO Heavy Industries
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oauth
|
@@ -155,6 +155,7 @@ files:
|
|
155
155
|
- lib/jira/resource/priority.rb
|
156
156
|
- lib/jira/resource/project.rb
|
157
157
|
- lib/jira/resource/status.rb
|
158
|
+
- lib/jira/resource/transition.rb
|
158
159
|
- lib/jira/resource/user.rb
|
159
160
|
- lib/jira/resource/version.rb
|
160
161
|
- lib/jira/resource/worklog.rb
|
@@ -169,6 +170,7 @@ files:
|
|
169
170
|
- spec/integration/priority_spec.rb
|
170
171
|
- spec/integration/project_spec.rb
|
171
172
|
- spec/integration/status_spec.rb
|
173
|
+
- spec/integration/transition_spec.rb
|
172
174
|
- spec/integration/user_spec.rb
|
173
175
|
- spec/integration/version_spec.rb
|
174
176
|
- spec/integration/worklog_spec.rb
|
@@ -199,6 +201,8 @@ files:
|
|
199
201
|
- spec/mock_responses/issue/10002/comment.post.json
|
200
202
|
- spec/mock_responses/issue/10002/comment/10000.json
|
201
203
|
- spec/mock_responses/issue/10002/comment/10000.put.json
|
204
|
+
- spec/mock_responses/issue/10002/transitions.json
|
205
|
+
- spec/mock_responses/issue/10002/transitions.post.json
|
202
206
|
- spec/mock_responses/issue/10002/worklog.json
|
203
207
|
- spec/mock_responses/issue/10002/worklog.post.json
|
204
208
|
- spec/mock_responses/issue/10002/worklog/10000.json
|
@@ -242,7 +246,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
242
246
|
version: '0'
|
243
247
|
requirements: []
|
244
248
|
rubyforge_project: jira-ruby
|
245
|
-
rubygems_version: 2.0.
|
249
|
+
rubygems_version: 2.0.5
|
246
250
|
signing_key:
|
247
251
|
specification_version: 4
|
248
252
|
summary: Ruby Gem for use with the Atlassian JIRA REST API
|
@@ -255,6 +259,7 @@ test_files:
|
|
255
259
|
- spec/integration/priority_spec.rb
|
256
260
|
- spec/integration/project_spec.rb
|
257
261
|
- spec/integration/status_spec.rb
|
262
|
+
- spec/integration/transition_spec.rb
|
258
263
|
- spec/integration/user_spec.rb
|
259
264
|
- spec/integration/version_spec.rb
|
260
265
|
- spec/integration/worklog_spec.rb
|
@@ -285,6 +290,8 @@ test_files:
|
|
285
290
|
- spec/mock_responses/issue/10002/comment.post.json
|
286
291
|
- spec/mock_responses/issue/10002/comment/10000.json
|
287
292
|
- spec/mock_responses/issue/10002/comment/10000.put.json
|
293
|
+
- spec/mock_responses/issue/10002/transitions.json
|
294
|
+
- spec/mock_responses/issue/10002/transitions.post.json
|
288
295
|
- spec/mock_responses/issue/10002/worklog.json
|
289
296
|
- spec/mock_responses/issue/10002/worklog.post.json
|
290
297
|
- spec/mock_responses/issue/10002/worklog/10000.json
|