jiralicious 0.4.0 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +15 -1
- data/jiralicious.gemspec +11 -1
- data/lib/jiralicious.rb +1 -0
- data/lib/jiralicious/base.rb +12 -0
- data/lib/jiralicious/configuration.rb +7 -1
- data/lib/jiralicious/issue.rb +15 -11
- data/lib/jiralicious/issue/comment.rb +5 -0
- data/lib/jiralicious/issue/fields.rb +8 -0
- data/lib/jiralicious/issue/transitions.rb +4 -0
- data/lib/jiralicious/issue/watchers.rb +3 -0
- data/lib/jiralicious/oauth_session.rb +129 -0
- data/lib/jiralicious/project.rb +2 -1
- data/lib/jiralicious/version.rb +1 -1
- data/spec/issue_spec.rb +54 -2
- metadata +44 -37
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 35abe5a91ed496a677046d8d7cf6776be6388529
|
4
|
+
data.tar.gz: a5c39e5f19761e501d88fe16578bd94cbfd1b8e7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a16791567cc35d0155ebcc0400e3dc5d62f7870fbb83aa994138ff6bafb1757ce0498078640db2b73a690daed0cf8b1b05b1e6fcb258985c261d01f9e707c07f
|
7
|
+
data.tar.gz: 264071527d0704fbbd06c2523d27b911f8d5336d7456e08c406b9c0ec4817d3319a539339f96459baaf40aadb0d8f37dde870d8f113321307d6611eb22573bc4
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# jiralicious
|
2
2
|
|
3
|
-
[![Build Status](https://travis-ci.org/
|
3
|
+
[![Build Status](https://travis-ci.org/dorack/jiralicious.png)](https://travis-ci.org/dorack/jiralicious)
|
4
4
|
|
5
5
|
## Examples:
|
6
6
|
|
@@ -40,6 +40,19 @@ Finding a single issue:
|
|
40
40
|
|
41
41
|
Default auth type is now Basic auth. Cookie auth will be deprecated in the next version.
|
42
42
|
|
43
|
+
## Changes in 0.4.2
|
44
|
+
|
45
|
+
* Opened up HTTParty to any version.
|
46
|
+
* Issue.new now works if provided a hash set.
|
47
|
+
* Error is thrown if the Jira key is invalid.
|
48
|
+
* Error is thrown if issue cannot be created during new opperation.
|
49
|
+
* Corrected and Updated RSPEC
|
50
|
+
|
51
|
+
## Changes from 0.4.0 to 0.4.1
|
52
|
+
|
53
|
+
* Initial implementation of OAuth.
|
54
|
+
** Note: the system does not support webhooks at this time. **
|
55
|
+
|
43
56
|
## Changes from 0.3.0
|
44
57
|
|
45
58
|
* User and Avatars are now supported.
|
@@ -63,6 +76,7 @@ Default auth type is now Basic auth. Cookie auth will be deprecated in the next
|
|
63
76
|
* Stanley Handschuh (dorack)
|
64
77
|
* Mike Fiedler (miketheman)
|
65
78
|
* Girish Sonawane (girishso)
|
79
|
+
* Jan Lindblom (janlindblom)
|
66
80
|
|
67
81
|
## Contributing to jiralicious
|
68
82
|
|
data/jiralicious.gemspec
CHANGED
@@ -13,9 +13,19 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.email = "jstewart@fusionary.com"
|
14
14
|
s.authors = ["Jason Stewart"]
|
15
15
|
s.add_runtime_dependency 'crack', '~> 0.1.8'
|
16
|
-
|
16
|
+
if Gem::Version.new(RUBY_VERSION) > Gem::Version.new('1.9.2')
|
17
|
+
s.add_runtime_dependency 'httparty', '>= 0.10'
|
18
|
+
else
|
19
|
+
s.add_runtime_dependency 'httparty', '>= 0.10', '< 0.12.0'
|
20
|
+
end
|
17
21
|
s.add_runtime_dependency 'hashie', '>= 1.1'
|
18
22
|
s.add_runtime_dependency 'json', '>= 1.6', '< 1.9.0'
|
23
|
+
s.add_runtime_dependency 'oauth'
|
24
|
+
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('1.9.0')
|
25
|
+
s.add_runtime_dependency 'nokogiri'
|
26
|
+
else
|
27
|
+
s.add_runtime_dependency 'nokogiri', '< 1.6'
|
28
|
+
end
|
19
29
|
s.add_development_dependency 'rspec', '~> 2.6'
|
20
30
|
s.add_development_dependency 'rake'
|
21
31
|
s.add_development_dependency 'fakeweb', '~> 1.3.0'
|
data/lib/jiralicious.rb
CHANGED
data/lib/jiralicious/base.rb
CHANGED
@@ -139,6 +139,18 @@ module Jiralicious
|
|
139
139
|
end
|
140
140
|
end
|
141
141
|
|
142
|
+
##
|
143
|
+
# Validates that the provided key is not malformed
|
144
|
+
#
|
145
|
+
#
|
146
|
+
def issueKey_test(key, no_throw = false)
|
147
|
+
if key.nil? || !(/^[A-Z]+-[0-9]+$/i =~ key)
|
148
|
+
raise Jiralicious::JiraError.new("The key #{key} is invalid") unless no_throw
|
149
|
+
return false
|
150
|
+
end
|
151
|
+
return true
|
152
|
+
end
|
153
|
+
|
142
154
|
alias :all :find_all
|
143
155
|
end
|
144
156
|
|
@@ -6,7 +6,7 @@ module Jiralicious
|
|
6
6
|
#
|
7
7
|
module Configuration
|
8
8
|
# Array of available attributes
|
9
|
-
VALID_OPTIONS = [:username, :password, :uri, :api_version, :auth_type, :project]
|
9
|
+
VALID_OPTIONS = [:username, :password, :uri, :api_version, :auth_type, :project, :oauth_secret, :oauth_secret_filename, :oauth_pass_phrase, :oauth_consumer_key, :config_path]
|
10
10
|
# Default user name set prior to login attempt
|
11
11
|
DEFAULT_USERNAME = nil
|
12
12
|
# Default password set prior to login attempt
|
@@ -56,6 +56,12 @@ module Jiralicious
|
|
56
56
|
self.uri = DEFAULT_URI
|
57
57
|
self.api_version = DEFAULT_API_VERSION
|
58
58
|
self.auth_type = DEFAULT_AUTH_TYPE
|
59
|
+
self.project = nil
|
60
|
+
self.oauth_secret = nil
|
61
|
+
self.oauth_secret_filename = nil
|
62
|
+
self.oauth_pass_phrase = nil
|
63
|
+
self.oauth_consumer_key = nil
|
64
|
+
self.config_path = nil
|
59
65
|
end
|
60
66
|
|
61
67
|
##
|
data/lib/jiralicious/issue.rb
CHANGED
@@ -42,14 +42,19 @@ module Jiralicious
|
|
42
42
|
def initialize(decoded_json = nil, default = nil)
|
43
43
|
@loaded = false
|
44
44
|
if (!decoded_json.nil?)
|
45
|
+
if !decoded_json.include? 'fields'
|
46
|
+
decoded_json = {'fields' => decoded_json}
|
47
|
+
end
|
45
48
|
super(decoded_json)
|
46
49
|
parse!(decoded_json["fields"])
|
47
50
|
if default.nil?
|
48
51
|
@fields = Fields.new(self['fields']) if self['fields']
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
52
|
+
if self.jira_key
|
53
|
+
@comments = Comment.find_by_key(self.jira_key)
|
54
|
+
@watchers = Watchers.find_by_key(self.jira_key)
|
55
|
+
@transitions = Transitions.new(self.jira_key)
|
56
|
+
@loaded = true
|
57
|
+
end
|
53
58
|
end
|
54
59
|
end
|
55
60
|
@fields = Fields.new if @fields.nil?
|
@@ -77,14 +82,14 @@ module Jiralicious
|
|
77
82
|
if default.nil?
|
78
83
|
parse!(self['fields'])
|
79
84
|
@fields = Fields.new(self['fields']) if self['fields']
|
80
|
-
@comments = Comment.find_by_key(self.jira_key)
|
81
|
-
@watchers = Watchers.find_by_key(self.jira_key)
|
82
|
-
@loaded = true
|
85
|
+
@comments = Comment.find_by_key(self.jira_key) if self.jira_key
|
86
|
+
@watchers = Watchers.find_by_key(self.jira_key) if self.jira_key
|
87
|
+
@loaded = true if self.jira_key
|
83
88
|
else
|
84
89
|
parse!(decoded_hash)
|
85
90
|
end
|
86
91
|
end
|
87
|
-
|
92
|
+
|
88
93
|
##
|
89
94
|
# Forces the Jira Issue to reload with current or updated
|
90
95
|
# information. This method is used in lazy loading methods.
|
@@ -249,12 +254,11 @@ module Jiralicious
|
|
249
254
|
def save
|
250
255
|
if loaded?
|
251
256
|
self.class.update(@fields.format_for_update, self.jira_key)
|
252
|
-
key = self.jira_key
|
253
257
|
else
|
254
258
|
response = self.class.create(@fields.format_for_create)
|
255
|
-
|
259
|
+
self.jira_key = response.parsed_response['key']
|
256
260
|
end
|
257
|
-
return
|
261
|
+
return self.jira_key
|
258
262
|
end
|
259
263
|
|
260
264
|
##
|
@@ -40,6 +40,7 @@ module Jiralicious
|
|
40
40
|
# :key (required) issue key
|
41
41
|
#
|
42
42
|
def find_by_key(key)
|
43
|
+
issueKey_test(key)
|
43
44
|
response = fetch({:parent => parent_name, :parent_key => key})
|
44
45
|
a = new(response)
|
45
46
|
a.jira_key = key
|
@@ -55,6 +56,7 @@ module Jiralicious
|
|
55
56
|
# :id (required) comment id
|
56
57
|
#
|
57
58
|
def find_by_key_and_id(key, id)
|
59
|
+
issueKey_test(key)
|
58
60
|
response = fetch({:parent => parent_name, :parent_key => key, :key => id})
|
59
61
|
a = new(response)
|
60
62
|
a.jira_key = key
|
@@ -70,6 +72,7 @@ module Jiralicious
|
|
70
72
|
# :key (required) issue key
|
71
73
|
#
|
72
74
|
def add(comment, key)
|
75
|
+
issueKey_test(key)
|
73
76
|
fetch({:method => :post, :body => comment, :parent => parent_name, :parent_key => key})
|
74
77
|
end
|
75
78
|
|
@@ -84,6 +87,7 @@ module Jiralicious
|
|
84
87
|
# :id (required) comment id
|
85
88
|
#
|
86
89
|
def edit(comment, key, id)
|
90
|
+
issueKey_test(key)
|
87
91
|
fetch({:method => :put, :key => id, :body => comment, :parent => parent_name, :parent_key => key})
|
88
92
|
end
|
89
93
|
|
@@ -100,6 +104,7 @@ module Jiralicious
|
|
100
104
|
# :id (required) comment id
|
101
105
|
#
|
102
106
|
def remove(key, id)
|
107
|
+
issueKey_test(key)
|
103
108
|
fetch({:method => :delete, :body_to_params => true, :key => id, :parent => parent_name, :parent_key => key})
|
104
109
|
end
|
105
110
|
end
|
@@ -100,6 +100,14 @@ module Jiralicious
|
|
100
100
|
@fields_update[field].merge!(hash)
|
101
101
|
end
|
102
102
|
|
103
|
+
##
|
104
|
+
# Merges current to updated to allow for a forced
|
105
|
+
# update request to process.
|
106
|
+
#
|
107
|
+
def force_update
|
108
|
+
@fields_update.merge!(@fields_current)
|
109
|
+
end
|
110
|
+
|
103
111
|
##
|
104
112
|
# Sets the field key with the provided value.
|
105
113
|
#
|
@@ -55,6 +55,7 @@ module Jiralicious
|
|
55
55
|
# :key (required) issue key
|
56
56
|
#
|
57
57
|
def find(key)
|
58
|
+
issueKey_test(key)
|
58
59
|
response = fetch({:parent => parent_name, :parent_key => key})
|
59
60
|
response.parsed_response['transitions'].each do |t|
|
60
61
|
t['jira_key'] = key
|
@@ -71,6 +72,7 @@ module Jiralicious
|
|
71
72
|
# :id (required) transition id
|
72
73
|
#
|
73
74
|
def find_by_key_and_id(key, id)
|
75
|
+
issueKey_test(key)
|
74
76
|
response = fetch({:parent => parent_name, :parent_key => key, :body => {"transitionId" => id}, :body_to_params => true })
|
75
77
|
response.parsed_response['transitions'].each do |t|
|
76
78
|
t['jira_key'] = key
|
@@ -92,6 +94,7 @@ module Jiralicious
|
|
92
94
|
# based on the individual transition
|
93
95
|
#
|
94
96
|
def go(key, id, options = {})
|
97
|
+
issueKey_test(key)
|
95
98
|
transition = {"transition" => {"id" => id}}
|
96
99
|
if options[:comment].is_a? String
|
97
100
|
transition.merge!({"update" => {"comment" => [{"add" => {"body" => options[:comment].to_s}}]}})
|
@@ -120,6 +123,7 @@ module Jiralicious
|
|
120
123
|
# :return (optional) boolean flag to determine if an object or hash is returned
|
121
124
|
#
|
122
125
|
def meta(key, id, options = {})
|
126
|
+
issueKey_test(key)
|
123
127
|
response = fetch({:method => :get, :parent => parent_name, :parent_key => key, :body_to_params => true,
|
124
128
|
:body => {"transitionId" => id, "expand" => "transitions.fields"}})
|
125
129
|
response.parsed_response['transitions'].each do |t|
|
@@ -30,6 +30,7 @@ module Jiralicious
|
|
30
30
|
# :key (required) issue key to find
|
31
31
|
#
|
32
32
|
def find_by_key(key)
|
33
|
+
issueKey_test(key)
|
33
34
|
response = fetch({:parent => parent_name, :parent_key => key})
|
34
35
|
a = new(response)
|
35
36
|
a.jira_key = key
|
@@ -45,6 +46,7 @@ module Jiralicious
|
|
45
46
|
# :key (required) issue key
|
46
47
|
#
|
47
48
|
def add(name, key)
|
49
|
+
issueKey_test(key)
|
48
50
|
fetch({:method => :post, :body => name, :body_override => true, :parent => parent_name, :parent_key => key})
|
49
51
|
end
|
50
52
|
|
@@ -57,6 +59,7 @@ module Jiralicious
|
|
57
59
|
# :key (required) issue key
|
58
60
|
#
|
59
61
|
def remove(name, key)
|
62
|
+
issueKey_test(key)
|
60
63
|
fetch({:method => :delete, :body_to_params => true, :body => {:username => name}, :parent => parent_name, :parent_key => key})
|
61
64
|
end
|
62
65
|
end
|
@@ -0,0 +1,129 @@
|
|
1
|
+
require 'oauth'
|
2
|
+
require 'nokogiri'
|
3
|
+
|
4
|
+
module Jiralicious
|
5
|
+
##
|
6
|
+
# The OauthSesion class extends the default OAuth::AccessToken
|
7
|
+
# The functions herein convert between the current Jiralicious
|
8
|
+
# and HTTParty formats and those required by OAuth. This is a
|
9
|
+
# Bidirectional conversion.
|
10
|
+
#
|
11
|
+
class OauthSession < OAuth::AccessToken
|
12
|
+
attr_accessor :option
|
13
|
+
|
14
|
+
##
|
15
|
+
# After Request reprocesses the response provided in to the
|
16
|
+
# HTTParty::Response format that is expected by the rest of
|
17
|
+
# the gem.
|
18
|
+
#
|
19
|
+
def after_request(response)
|
20
|
+
@response = HTTParty::Response.new(self, response, lambda { HTTParty::Parser.new(response.body, Jiralicious::Session.format).parse }, :body => response.body)
|
21
|
+
end
|
22
|
+
|
23
|
+
##
|
24
|
+
# Initializer extends the functionality of the basic OAuth::AccessToken
|
25
|
+
# However provides the base functionality to handle the initial root
|
26
|
+
# generation for the custom Jiralicious authentication to JIRA
|
27
|
+
#
|
28
|
+
def initialize(token = nil, secret = nil)
|
29
|
+
self.option = {
|
30
|
+
:signature_method => 'RSA-SHA1',
|
31
|
+
:request_token_path => '/plugins/servlet/oauth/request-token',
|
32
|
+
:authorize_path => "/plugins/servlet/oauth/authorize",
|
33
|
+
:access_token_path => '/plugins/servlet/oauth/access-token',
|
34
|
+
:site => "http://rome:8080"
|
35
|
+
}
|
36
|
+
if (token.nil? || secret.nil?)
|
37
|
+
consumer = OAuth::Consumer.new(Jiralicious.oauth_consumer_key, OpenSSL::PKey::RSA.new(get_secret, Jiralicious.oauth_pass_phrase.to_s), self.option)
|
38
|
+
request_token = consumer.get_request_token
|
39
|
+
## request access confirmation ##
|
40
|
+
bs = Jiralicious::BasicSession.new
|
41
|
+
bsr = bs.request(:get, request_token.authorize_url)
|
42
|
+
bsp = HTTParty::Parser.new(bsr.message, :html)
|
43
|
+
bsb = Nokogiri::HTML(bsp.body)
|
44
|
+
## Parse confirm page and send form ##
|
45
|
+
a = {}
|
46
|
+
bsb.xpath('//input').each do |input|
|
47
|
+
if (input.get_attribute('name') != 'deny' && !input.get_attribute('name').nil?)
|
48
|
+
a.merge!({input.get_attribute('name').to_sym => input.get_attribute('value')})
|
49
|
+
end
|
50
|
+
end
|
51
|
+
urip = "#{request_token.authorize_url.split('?')[0]}?#{build_body(a)}"
|
52
|
+
bsr = bs.request(bsb.xpath('//form')[0].get_attribute('method').downcase.to_sym, urip)
|
53
|
+
## Parse response for access ##
|
54
|
+
bss = bsr.message.split("'") # brute force method don't know a better way to do this
|
55
|
+
crt = request_token.consumer.token_request(request_token.consumer.http_method, (request_token.consumer.access_token_url? ? request_token.consumer.access_token_url : request_token.consumer.access_token_path), request_token, {:oauth_verifier => bss[3]})
|
56
|
+
super(request_token.consumer, crt[:oauth_token], crt[:oauth_token_secret])
|
57
|
+
self.params = crt
|
58
|
+
else
|
59
|
+
super(token, secret)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
##
|
64
|
+
# Main access method to request data from the Jira API
|
65
|
+
#
|
66
|
+
# [Arguments]
|
67
|
+
# :method (required) http method type
|
68
|
+
#
|
69
|
+
# :options (required) request specific options
|
70
|
+
#
|
71
|
+
def request(method, *options)
|
72
|
+
if options.last.is_a?(Hash) && options.last[:handler]
|
73
|
+
response_handler = options.last.delete(:handler)
|
74
|
+
else
|
75
|
+
response_handler = handler
|
76
|
+
end
|
77
|
+
path = options.first
|
78
|
+
options = options.last
|
79
|
+
before_request if respond_to?(:before_request)
|
80
|
+
super(method, path, *options)
|
81
|
+
after_request(response) if respond_to?(:after_request)
|
82
|
+
|
83
|
+
response_handler.call(response)
|
84
|
+
end
|
85
|
+
|
86
|
+
protected
|
87
|
+
|
88
|
+
##
|
89
|
+
# Restructures the Hash into a param string
|
90
|
+
#
|
91
|
+
def build_body(a)
|
92
|
+
o = ''
|
93
|
+
a.each do |k, v|
|
94
|
+
o += "#{k}=#{v}&"
|
95
|
+
end
|
96
|
+
o
|
97
|
+
end
|
98
|
+
|
99
|
+
##
|
100
|
+
# returns the oauth_secret parameter or the file
|
101
|
+
#
|
102
|
+
def get_secret
|
103
|
+
if Jiralicious.oauth_secret.nil?
|
104
|
+
IO.read(Jiralicious.config_path + Jiralicious.oauth_secret_filename)
|
105
|
+
else
|
106
|
+
Jiralicious.oauth_secret
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
##
|
111
|
+
# Configures the default handler. This can be overridden in
|
112
|
+
# the child class to provide additional error handling.
|
113
|
+
#
|
114
|
+
def handler
|
115
|
+
Proc.new do |response|
|
116
|
+
case response.code
|
117
|
+
when 200..204
|
118
|
+
response
|
119
|
+
else
|
120
|
+
message = response.body
|
121
|
+
if message.is_a?(Hash)
|
122
|
+
message = message['errorMessages'].join('\n')
|
123
|
+
end
|
124
|
+
Jiralicious::JiraError.new(message)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
data/lib/jiralicious/project.rb
CHANGED
@@ -42,7 +42,8 @@ module Jiralicious
|
|
42
42
|
response.issues_raw.each do |issue|
|
43
43
|
i_out.class.property :"#{issue["key"].gsub("-", "_")}"
|
44
44
|
t = Issue.new
|
45
|
-
|
45
|
+
t.load(issue, true)
|
46
|
+
i_out[issue["key"].gsub("-", "_")] = t
|
46
47
|
end
|
47
48
|
i_out
|
48
49
|
end
|
data/lib/jiralicious/version.rb
CHANGED
data/spec/issue_spec.rb
CHANGED
@@ -123,8 +123,7 @@ describe Jiralicious::Issue, "Managing Issues" do
|
|
123
123
|
issue.watchers.watchers.count.should == 1
|
124
124
|
end
|
125
125
|
|
126
|
-
|
127
|
-
it "creates a new issue" do
|
126
|
+
it "creates a new issue through fields" do
|
128
127
|
issue = Jiralicious::Issue.new
|
129
128
|
issue.fields.set_id("project", "10000")
|
130
129
|
issue.fields.set("summary", "this is a test of creating a scratch ticket")
|
@@ -139,6 +138,59 @@ describe Jiralicious::Issue, "Managing Issues" do
|
|
139
138
|
issue.comments.comments.count.should == 0
|
140
139
|
issue.watchers.watchers.count.should == 1
|
141
140
|
end
|
141
|
+
|
142
|
+
it "creates a new issue thgrough load with reload" do
|
143
|
+
hash = {"fields" => {"project" => {"id" => "10000"},
|
144
|
+
"summary" => "this is a test of creating a scratch ticket",
|
145
|
+
"issuetype" => {"id" => "7"},
|
146
|
+
"assignee" => {"name" => "stanley.handschuh"},
|
147
|
+
"priority" => {"id" => "1"},
|
148
|
+
"labels" => ["new_label_p"],
|
149
|
+
"environment" => "example of environment",
|
150
|
+
"description" => "example of the description extending"
|
151
|
+
}}
|
152
|
+
issue = Jiralicious::Issue.new
|
153
|
+
issue.load(hash, true)
|
154
|
+
issue.save!
|
155
|
+
issue.jira_key.should == 'EX-2'
|
156
|
+
issue.comments.comments.count.should == 0
|
157
|
+
issue.watchers.watchers.count.should == 1
|
158
|
+
end
|
159
|
+
|
160
|
+
it "creates a new issue thgrough load without reload" do
|
161
|
+
hash = {"fields" => {"project" => {"id" => "10000"},
|
162
|
+
"summary" => "this is a test of creating a scratch ticket",
|
163
|
+
"issuetype" => {"id" => "7"},
|
164
|
+
"assignee" => {"name" => "stanley.handschuh"},
|
165
|
+
"priority" => {"id" => "1"},
|
166
|
+
"labels" => ["new_label_p"],
|
167
|
+
"environment" => "example of environment",
|
168
|
+
"description" => "example of the description extending"
|
169
|
+
}}
|
170
|
+
issue = Jiralicious::Issue.new
|
171
|
+
issue.load(hash)
|
172
|
+
issue.save!
|
173
|
+
issue.jira_key.should == 'EX-2'
|
174
|
+
issue.comments.comments.count.should == 0
|
175
|
+
issue.watchers.watchers.count.should == 1
|
176
|
+
end
|
177
|
+
|
178
|
+
it "creates a new issue through new" do
|
179
|
+
hash = {"project" => {"id" => "10000"},
|
180
|
+
"summary" => "this is a test of creating a scratch ticket",
|
181
|
+
"issuetype" => {"id" => "7"},
|
182
|
+
"assignee" => {"name" => "stanley.handschuh"},
|
183
|
+
"priority" => {"id" => "1"},
|
184
|
+
"labels" => ["new_label_p"],
|
185
|
+
"environment" => "example of environment",
|
186
|
+
"description" => "example of the description extending"
|
187
|
+
}
|
188
|
+
issue = Jiralicious::Issue.new(hash)
|
189
|
+
issue.save!
|
190
|
+
issue.jira_key.should == 'EX-2'
|
191
|
+
issue.comments.comments.count.should == 0
|
192
|
+
issue.watchers.watchers.count.should == 1
|
193
|
+
end
|
142
194
|
|
143
195
|
it "updates a new issue" do
|
144
196
|
issue = Jiralicious::Issue.find("EX-3")
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jiralicious
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
5
|
-
prerelease:
|
4
|
+
version: 0.4.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Jason Stewart
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-05-10 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: crack
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,47 +27,36 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: httparty
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0.10'
|
38
|
-
- - <
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 0.12.0
|
41
34
|
type: :runtime
|
42
35
|
prerelease: false
|
43
36
|
version_requirements: !ruby/object:Gem::Requirement
|
44
|
-
none: false
|
45
37
|
requirements:
|
46
|
-
- -
|
38
|
+
- - '>='
|
47
39
|
- !ruby/object:Gem::Version
|
48
40
|
version: '0.10'
|
49
|
-
- - <
|
50
|
-
- !ruby/object:Gem::Version
|
51
|
-
version: 0.12.0
|
52
41
|
- !ruby/object:Gem::Dependency
|
53
42
|
name: hashie
|
54
43
|
requirement: !ruby/object:Gem::Requirement
|
55
|
-
none: false
|
56
44
|
requirements:
|
57
|
-
- -
|
45
|
+
- - '>='
|
58
46
|
- !ruby/object:Gem::Version
|
59
47
|
version: '1.1'
|
60
48
|
type: :runtime
|
61
49
|
prerelease: false
|
62
50
|
version_requirements: !ruby/object:Gem::Requirement
|
63
|
-
none: false
|
64
51
|
requirements:
|
65
|
-
- -
|
52
|
+
- - '>='
|
66
53
|
- !ruby/object:Gem::Version
|
67
54
|
version: '1.1'
|
68
55
|
- !ruby/object:Gem::Dependency
|
69
56
|
name: json
|
70
57
|
requirement: !ruby/object:Gem::Requirement
|
71
|
-
none: false
|
72
58
|
requirements:
|
73
|
-
- -
|
59
|
+
- - '>='
|
74
60
|
- !ruby/object:Gem::Version
|
75
61
|
version: '1.6'
|
76
62
|
- - <
|
@@ -79,18 +65,44 @@ dependencies:
|
|
79
65
|
type: :runtime
|
80
66
|
prerelease: false
|
81
67
|
version_requirements: !ruby/object:Gem::Requirement
|
82
|
-
none: false
|
83
68
|
requirements:
|
84
|
-
- -
|
69
|
+
- - '>='
|
85
70
|
- !ruby/object:Gem::Version
|
86
71
|
version: '1.6'
|
87
72
|
- - <
|
88
73
|
- !ruby/object:Gem::Version
|
89
74
|
version: 1.9.0
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: oauth
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - '>='
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
type: :runtime
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - '>='
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: nokogiri
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - '>='
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
type: :runtime
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - '>='
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
90
103
|
- !ruby/object:Gem::Dependency
|
91
104
|
name: rspec
|
92
105
|
requirement: !ruby/object:Gem::Requirement
|
93
|
-
none: false
|
94
106
|
requirements:
|
95
107
|
- - ~>
|
96
108
|
- !ruby/object:Gem::Version
|
@@ -98,7 +110,6 @@ dependencies:
|
|
98
110
|
type: :development
|
99
111
|
prerelease: false
|
100
112
|
version_requirements: !ruby/object:Gem::Requirement
|
101
|
-
none: false
|
102
113
|
requirements:
|
103
114
|
- - ~>
|
104
115
|
- !ruby/object:Gem::Version
|
@@ -106,23 +117,20 @@ dependencies:
|
|
106
117
|
- !ruby/object:Gem::Dependency
|
107
118
|
name: rake
|
108
119
|
requirement: !ruby/object:Gem::Requirement
|
109
|
-
none: false
|
110
120
|
requirements:
|
111
|
-
- -
|
121
|
+
- - '>='
|
112
122
|
- !ruby/object:Gem::Version
|
113
123
|
version: '0'
|
114
124
|
type: :development
|
115
125
|
prerelease: false
|
116
126
|
version_requirements: !ruby/object:Gem::Requirement
|
117
|
-
none: false
|
118
127
|
requirements:
|
119
|
-
- -
|
128
|
+
- - '>='
|
120
129
|
- !ruby/object:Gem::Version
|
121
130
|
version: '0'
|
122
131
|
- !ruby/object:Gem::Dependency
|
123
132
|
name: fakeweb
|
124
133
|
requirement: !ruby/object:Gem::Requirement
|
125
|
-
none: false
|
126
134
|
requirements:
|
127
135
|
- - ~>
|
128
136
|
- !ruby/object:Gem::Version
|
@@ -130,7 +138,6 @@ dependencies:
|
|
130
138
|
type: :development
|
131
139
|
prerelease: false
|
132
140
|
version_requirements: !ruby/object:Gem::Requirement
|
133
|
-
none: false
|
134
141
|
requirements:
|
135
142
|
- - ~>
|
136
143
|
- !ruby/object:Gem::Version
|
@@ -167,6 +174,7 @@ files:
|
|
167
174
|
- lib/jiralicious/issue/fields.rb
|
168
175
|
- lib/jiralicious/issue/transitions.rb
|
169
176
|
- lib/jiralicious/issue/watchers.rb
|
177
|
+
- lib/jiralicious/oauth_session.rb
|
170
178
|
- lib/jiralicious/parsers/field_parser.rb
|
171
179
|
- lib/jiralicious/project.rb
|
172
180
|
- lib/jiralicious/project/avatar.rb
|
@@ -220,27 +228,26 @@ files:
|
|
220
228
|
homepage: http://github.com/jstewart/jiralicious
|
221
229
|
licenses:
|
222
230
|
- MIT
|
231
|
+
metadata: {}
|
223
232
|
post_install_message:
|
224
233
|
rdoc_options: []
|
225
234
|
require_paths:
|
226
235
|
- lib
|
227
236
|
required_ruby_version: !ruby/object:Gem::Requirement
|
228
|
-
none: false
|
229
237
|
requirements:
|
230
|
-
- -
|
238
|
+
- - '>='
|
231
239
|
- !ruby/object:Gem::Version
|
232
240
|
version: '0'
|
233
241
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
234
|
-
none: false
|
235
242
|
requirements:
|
236
|
-
- -
|
243
|
+
- - '>='
|
237
244
|
- !ruby/object:Gem::Version
|
238
245
|
version: '0'
|
239
246
|
requirements: []
|
240
247
|
rubyforge_project:
|
241
|
-
rubygems_version:
|
248
|
+
rubygems_version: 2.0.3
|
242
249
|
signing_key:
|
243
|
-
specification_version:
|
250
|
+
specification_version: 4
|
244
251
|
summary: A Ruby library for interacting with JIRA's REST API
|
245
252
|
test_files:
|
246
253
|
- spec/avatar_spec.rb
|