ticketmaster-redmine 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/provider/project.rb +8 -11
- data/lib/provider/ticket.rb +27 -14
- data/spec/tickets_spec.rb +1 -7
- data/ticketmaster-redmine.gemspec +2 -2
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.6
|
data/lib/provider/project.rb
CHANGED
@@ -27,17 +27,14 @@ module TicketMaster::Provider
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def tickets(*options)
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
end
|
39
|
-
rescue
|
40
|
-
[]
|
30
|
+
Ticket.find(self.id, options)
|
31
|
+
end
|
32
|
+
|
33
|
+
def ticket(*options)
|
34
|
+
unless options.empty?
|
35
|
+
Ticket.find(self.id, options)
|
36
|
+
else
|
37
|
+
TicketMaster::Provider::Redmine::Ticket
|
41
38
|
end
|
42
39
|
end
|
43
40
|
|
data/lib/provider/ticket.rb
CHANGED
@@ -40,24 +40,37 @@ module TicketMaster::Provider
|
|
40
40
|
self[:author].name
|
41
41
|
end
|
42
42
|
|
43
|
-
|
44
|
-
def self.find_by_id(project_id, ticket_id)
|
45
|
-
self.new API.find(ticket_id)
|
46
|
-
end
|
47
|
-
|
48
|
-
def self.find_by_attributes(project_id, attributes = {})
|
49
|
-
issues = API.find(:all, build_attributes(project_id, attributes))
|
50
|
-
issues.collect { |issue| self.new issue }
|
51
|
-
end
|
52
|
-
|
53
|
-
def self.build_attributes(repo, options)
|
54
|
-
hash = {:repo => repo}.merge!(options)
|
55
|
-
end
|
56
|
-
|
57
43
|
def id
|
58
44
|
self[:id].to_i
|
59
45
|
end
|
60
46
|
|
47
|
+
def self.find(project_id, *options)
|
48
|
+
if options.first.is_a? Hash
|
49
|
+
options[0].merge!(:params => {:project_id => project_id})
|
50
|
+
super(*options)
|
51
|
+
elsif options.empty?
|
52
|
+
issues = RedmineAPI::Issue.find(:all, :params => {:project_id => project_id}).collect { |issue| TicketMaster::Provider::Redmine::Ticket.new issue }
|
53
|
+
elsif options[0].first.is_a? Fixnum
|
54
|
+
self.find_by_id(project_id, options[0].first)
|
55
|
+
else
|
56
|
+
super(*options)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.find_by_id(project_id, ticket_id)
|
61
|
+
self.new API.find(:first, :id => ticket_id)
|
62
|
+
end
|
63
|
+
|
64
|
+
def self.find_by_attributes(project_id, attributes = {})
|
65
|
+
issues = API.find(:all, build_attributes(project_id, attributes))
|
66
|
+
issues.collect { |issue| self.new issue }
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.build_attributes(repo, options)
|
70
|
+
hash = {:repo => repo}.merge!(options)
|
71
|
+
end
|
72
|
+
|
73
|
+
|
61
74
|
def self.create(*options)
|
62
75
|
issue = API.new(options.first.merge!(:status => 'New', :priority => 'Normal'))
|
63
76
|
ticket = self.new issue
|
data/spec/tickets_spec.rb
CHANGED
@@ -11,7 +11,7 @@ describe "Ticketmaster::Provider::Redmine::Ticket" do
|
|
11
11
|
mock.get '/issues.xml?project_id=1', headers, fixture_for('issues'), 200
|
12
12
|
mock.get '/issues.xml', headers, fixture_for('issues'), 200
|
13
13
|
mock.get '/issues/1.xml', headers, fixture_for('issues/1'), 200
|
14
|
-
mock.put '/issues/
|
14
|
+
mock.put '/issues/1.xml', headers_post_put, '', 200
|
15
15
|
mock.post '/issues.xml', headers_post_put, '', 200
|
16
16
|
end
|
17
17
|
end
|
@@ -51,12 +51,6 @@ describe "Ticketmaster::Provider::Redmine::Ticket" do
|
|
51
51
|
@ticket.title.should == 'test-issue'
|
52
52
|
end
|
53
53
|
|
54
|
-
it "shoule be able to load a single ticket based on attributes" do
|
55
|
-
@ticket = @project.ticket(:id => 1)
|
56
|
-
@ticket.should be_an_instance_of(@klass)
|
57
|
-
@ticket.title.should == 'test-issue'
|
58
|
-
end
|
59
|
-
|
60
54
|
it "should be able to update and save a ticket" do
|
61
55
|
@ticket = @project.ticket(1)
|
62
56
|
@ticket.description = 'hello'
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{ticketmaster-redmine}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Rafael George"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-08-03}
|
13
13
|
s.description = %q{Allows ticketmaster to interact with Your System.}
|
14
14
|
s.email = %q{rafael@hybridgroup.com}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ticketmaster-redmine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 6
|
10
|
+
version: 0.2.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Rafael George
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-08-03 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|