ticketmaster-unfuddle 0.1.0 → 0.2.0
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.
- data/README.rdoc +17 -0
- data/Rakefile +16 -27
- data/VERSION +1 -1
- data/lib/provider/comment.rb +14 -0
- data/lib/provider/project.rb +19 -48
- data/lib/provider/ticket.rb +8 -51
- data/lib/provider/unfuddle.rb +30 -0
- data/lib/ticketmaster-unfuddle.rb +5 -2
- data/lib/unfuddle/unfuddle-api.rb +149 -0
- data/spec/comments_spec.rb +70 -0
- data/spec/fixtures/comments/0.xml +11 -0
- data/spec/fixtures/comments/2.xml +11 -0
- data/spec/fixtures/comments/3.xml +11 -0
- data/spec/fixtures/comments/create.xml +11 -0
- data/spec/fixtures/comments.xml +13 -0
- data/spec/fixtures/projects/33041.xml +30 -0
- data/spec/fixtures/projects/33042.xml +30 -0
- data/spec/fixtures/projects/create.xml +30 -0
- data/spec/fixtures/projects.xml +32 -0
- data/spec/fixtures/tickets/476814.xml +33 -0
- data/spec/fixtures/tickets/476816.xml +29 -0
- data/spec/fixtures/tickets/476834.xml +31 -0
- data/spec/fixtures/tickets/create.xml +31 -0
- data/spec/fixtures/tickets.xml +433 -0
- data/spec/projects_spec.rb +71 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +16 -0
- data/spec/ticketmaster-unfuddle_spec.rb +11 -0
- data/spec/tickets_spec.rb +70 -0
- metadata +45 -52
- data/test/helper.rb +0 -10
- data/test/test_ticketmaster-unfuddle.rb +0 -75
@@ -0,0 +1,71 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "Ticketmaster::Provider::Unfuddle::Project" do
|
4
|
+
before(:all) do
|
5
|
+
headers = {'Authorization' => 'Basic Zm9vOjAwMDAwMA==', 'Accept' => 'application/xml'}
|
6
|
+
headers_post_put = {'Authorization' => 'Basic Zm9vOjAwMDAwMA==', 'Content-Type' => 'application/xml'}
|
7
|
+
@project_id = 33041
|
8
|
+
ActiveResource::HttpMock.respond_to do |mock|
|
9
|
+
mock.get '/api/v1/projects.xml', headers, fixture_for('projects'), 200
|
10
|
+
mock.get '/api/v1/projects/33041.xml', headers, fixture_for('projects/33041'), 200
|
11
|
+
mock.get '/api/v1/projects/create.xml', headers, fixture_for('projects/create'), 200
|
12
|
+
mock.delete '/api/v1/projects/33041.xml', headers, '', 200
|
13
|
+
mock.put '/api/v1/projects/33041.xml', headers_post_put, '', 200
|
14
|
+
mock.post '/api/v1/projects.xml', headers_post_put, '', 201, 'Location' => '/projects/create.xml'
|
15
|
+
mock.get '/api/v1/projects/33041/tickets.xml', headers, fixture_for('tickets'), 200
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
before(:each) do
|
20
|
+
@ticketmaster = TicketMaster.new(:unfuddle, {:username => 'foo', :password => '000000', :account => 'ticketmaster'})
|
21
|
+
@klass = TicketMaster::Provider::Unfuddle::Project
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should be able to load all projects" do
|
25
|
+
@ticketmaster.projects.should be_an_instance_of(Array)
|
26
|
+
@ticketmaster.projects.first.should be_an_instance_of(@klass)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should be able to load projects from an array of ids" do
|
30
|
+
@projects = @ticketmaster.projects([@project_id])
|
31
|
+
@projects.should be_an_instance_of(Array)
|
32
|
+
@projects.first.should be_an_instance_of(@klass)
|
33
|
+
@projects.first.id.should == @project_id
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should be able to load all projects from attributes" do
|
37
|
+
@projects = @ticketmaster.projects(:id => @project_id)
|
38
|
+
@projects.should be_an_instance_of(Array)
|
39
|
+
@projects.first.should be_an_instance_of(@klass)
|
40
|
+
@projects.first.id.should == @project_id
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should be able to find a project" do
|
44
|
+
@ticketmaster.project.should == @klass
|
45
|
+
@ticketmaster.project.find(@project_id).should be_an_instance_of(@klass)
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should be able to find a project by id" do
|
49
|
+
@ticketmaster.project(@project_id).should be_an_instance_of(@klass)
|
50
|
+
@ticketmaster.project(@project_id).id.should == @project_id
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should be able to find a project by attributes" do
|
54
|
+
@ticketmaster.project(:id => @project_id).id.should == @project_id
|
55
|
+
@ticketmaster.project(:id => @project_id).should be_an_instance_of(@klass)
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should be able to update and save a project" do
|
59
|
+
@project = @ticketmaster.project(@project_id)
|
60
|
+
@project.save.should == nil
|
61
|
+
@project.update!(:short_name => 'some new name').should == true
|
62
|
+
@project.short_name = 'this is a change'
|
63
|
+
@project.save.should == true
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should be able to create a project" do
|
67
|
+
@project = @ticketmaster.project.create(:name => 'Project #1')
|
68
|
+
@project.should be_an_instance_of(@klass)
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
+
require 'rubygems'
|
4
|
+
require 'ticketmaster'
|
5
|
+
require 'ticketmaster-unfuddle'
|
6
|
+
require 'active_resource/http_mock'
|
7
|
+
require 'spec'
|
8
|
+
require 'spec/autorun'
|
9
|
+
|
10
|
+
Spec::Runner.configure do |config|
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
def fixture_for(name)
|
15
|
+
File.read(File.dirname(__FILE__) + '/fixtures/' + name + '.xml')
|
16
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "Ticketmaster::Provider::Unfuddle" do
|
4
|
+
|
5
|
+
it "should be able to instantiate a new instance" do
|
6
|
+
@ticketmaster = TicketMaster.new(:unfuddle, {:account => 'ticketmaster', :username => 'foo', :password => '000000'})
|
7
|
+
@ticketmaster.should be_an_instance_of(TicketMaster)
|
8
|
+
@ticketmaster.should be_a_kind_of(TicketMaster::Provider::Unfuddle)
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "Ticketmaster::Provider::Unfuddle::Ticket" do
|
4
|
+
before(:all) do
|
5
|
+
headers = {'Authorization' => 'Basic Zm9vOjAwMDAwMA==', 'Accept' => 'application/xml'}
|
6
|
+
headers_post_put = {'Authorization' => 'Basic Zm9vOjAwMDAwMA==', 'Content-Type' => 'application/xml'}
|
7
|
+
ActiveResource::HttpMock.respond_to do |mock|
|
8
|
+
mock.get '/api/v1/projects/33041.xml', headers, fixture_for('projects/33041'), 200
|
9
|
+
mock.get '/api/v1/projects/33041/tickets.xml', headers, fixture_for('tickets'), 200
|
10
|
+
mock.get '/api/v1/projects/33041/tickets/476816.xml', headers, fixture_for('tickets/476816'), 200
|
11
|
+
mock.put '/api/v1/projects/33041/tickets/476816.xml', headers_post_put, '', 200
|
12
|
+
mock.post '/api/v1/projects/33041/tickets.xml', headers_post_put, fixture_for('tickets/create'), 200
|
13
|
+
end
|
14
|
+
@project_id = 33041
|
15
|
+
end
|
16
|
+
|
17
|
+
before(:each) do
|
18
|
+
@ticketmaster = TicketMaster.new(:unfuddle, :account => 'ticketmaster', :username => 'foo', :password => '000000')
|
19
|
+
@project = @ticketmaster.project(@project_id)
|
20
|
+
@klass = TicketMaster::Provider::Unfuddle::Ticket
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should be able to load all tickets" do
|
24
|
+
@project.tickets.should be_an_instance_of(Array)
|
25
|
+
@project.tickets.first.should be_an_instance_of(@klass)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should be able to load all tickets based on an array of ids" do
|
29
|
+
@tickets = @project.tickets([476816])
|
30
|
+
@tickets.should be_an_instance_of(Array)
|
31
|
+
@tickets.first.should be_an_instance_of(@klass)
|
32
|
+
@tickets.first.id.should == 476816
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should be able to load all tickets based on attributes" do
|
36
|
+
@tickets = @project.tickets(:id => 476816)
|
37
|
+
@tickets.should be_an_instance_of(Array)
|
38
|
+
@tickets.first.should be_an_instance_of(@klass)
|
39
|
+
@tickets.first.id.should == 476816
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should return the ticket class" do
|
43
|
+
@project.ticket.should == @klass
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should be able to load a single ticket" do
|
47
|
+
@ticket = @project.ticket(476816)
|
48
|
+
@ticket.should be_an_instance_of(@klass)
|
49
|
+
@ticket.id.should == 476816
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should be able to load a single ticket based on attributes" do
|
53
|
+
@ticket = @project.ticket(:id => 476816)
|
54
|
+
@ticket.should be_an_instance_of(@klass)
|
55
|
+
@ticket.id.should == 476816
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should be able to update and save a ticket" do
|
59
|
+
@ticket = @project.ticket(476816)
|
60
|
+
@ticket.save.should == nil
|
61
|
+
@ticket.description = 'hello'
|
62
|
+
@ticket.save.should == true
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should be able to create a ticket" do
|
66
|
+
@ticket = @project.ticket!(:title => 'Ticket #12', :description => 'Body')
|
67
|
+
@ticket.should be_an_instance_of(@klass)
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
metadata
CHANGED
@@ -1,67 +1,38 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ticketmaster-unfuddle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 27
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
|
-
-
|
7
|
+
- 2
|
9
8
|
- 0
|
10
|
-
version: 0.
|
9
|
+
version: 0.2.0
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
|
-
-
|
12
|
+
- Luis Hurtado
|
14
13
|
autorequire:
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date: 2010-06
|
17
|
+
date: 2010-10-06 00:00:00 -05:00
|
19
18
|
default_executable:
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
|
-
name:
|
21
|
+
name: rspec
|
23
22
|
prerelease: false
|
24
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
24
|
requirements:
|
27
25
|
- - ">="
|
28
26
|
- !ruby/object:Gem::Version
|
29
|
-
hash: 3
|
30
27
|
segments:
|
31
|
-
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: ticketmaster
|
37
|
-
prerelease: false
|
38
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
|
-
requirements:
|
41
|
-
- - ">="
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
hash: 3
|
44
|
-
segments:
|
45
|
-
- 0
|
46
|
-
version: "0"
|
47
|
-
type: :runtime
|
48
|
-
version_requirements: *id002
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: shoulda
|
51
|
-
prerelease: false
|
52
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
-
none: false
|
54
|
-
requirements:
|
55
|
-
- - ">="
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
hash: 3
|
58
|
-
segments:
|
59
|
-
- 0
|
60
|
-
version: "0"
|
28
|
+
- 1
|
29
|
+
- 2
|
30
|
+
- 9
|
31
|
+
version: 1.2.9
|
61
32
|
type: :development
|
62
|
-
version_requirements: *
|
63
|
-
description:
|
64
|
-
email:
|
33
|
+
version_requirements: *id001
|
34
|
+
description: Unfuddle provider for ticketmaster implemented with ActiveResource
|
35
|
+
email: luis@hybridgroup.com
|
65
36
|
executables: []
|
66
37
|
|
67
38
|
extensions: []
|
@@ -69,20 +40,43 @@ extensions: []
|
|
69
40
|
extra_rdoc_files:
|
70
41
|
- LICENSE
|
71
42
|
- README.md
|
43
|
+
- README.rdoc
|
72
44
|
files:
|
73
45
|
- .document
|
74
46
|
- .gitignore
|
75
47
|
- LICENSE
|
76
48
|
- README.md
|
49
|
+
- README.rdoc
|
77
50
|
- Rakefile
|
78
51
|
- VERSION
|
52
|
+
- lib/provider/comment.rb
|
79
53
|
- lib/provider/project.rb
|
80
54
|
- lib/provider/ticket.rb
|
55
|
+
- lib/provider/unfuddle.rb
|
81
56
|
- lib/ticketmaster-unfuddle.rb
|
82
|
-
-
|
83
|
-
-
|
57
|
+
- lib/unfuddle/unfuddle-api.rb
|
58
|
+
- spec/comments_spec.rb
|
59
|
+
- spec/fixtures/comments.xml
|
60
|
+
- spec/fixtures/comments/0.xml
|
61
|
+
- spec/fixtures/comments/2.xml
|
62
|
+
- spec/fixtures/comments/3.xml
|
63
|
+
- spec/fixtures/comments/create.xml
|
64
|
+
- spec/fixtures/projects.xml
|
65
|
+
- spec/fixtures/projects/33041.xml
|
66
|
+
- spec/fixtures/projects/33042.xml
|
67
|
+
- spec/fixtures/projects/create.xml
|
68
|
+
- spec/fixtures/tickets.xml
|
69
|
+
- spec/fixtures/tickets/476814.xml
|
70
|
+
- spec/fixtures/tickets/476816.xml
|
71
|
+
- spec/fixtures/tickets/476834.xml
|
72
|
+
- spec/fixtures/tickets/create.xml
|
73
|
+
- spec/projects_spec.rb
|
74
|
+
- spec/spec.opts
|
75
|
+
- spec/spec_helper.rb
|
76
|
+
- spec/ticketmaster-unfuddle_spec.rb
|
77
|
+
- spec/tickets_spec.rb
|
84
78
|
has_rdoc: true
|
85
|
-
homepage: http://
|
79
|
+
homepage: http://github.com/hybridgroup/ticketmaster-unfuddle
|
86
80
|
licenses: []
|
87
81
|
|
88
82
|
post_install_message:
|
@@ -91,30 +85,29 @@ rdoc_options:
|
|
91
85
|
require_paths:
|
92
86
|
- lib
|
93
87
|
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
-
none: false
|
95
88
|
requirements:
|
96
89
|
- - ">="
|
97
90
|
- !ruby/object:Gem::Version
|
98
|
-
hash: 3
|
99
91
|
segments:
|
100
92
|
- 0
|
101
93
|
version: "0"
|
102
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
-
none: false
|
104
95
|
requirements:
|
105
96
|
- - ">="
|
106
97
|
- !ruby/object:Gem::Version
|
107
|
-
hash: 3
|
108
98
|
segments:
|
109
99
|
- 0
|
110
100
|
version: "0"
|
111
101
|
requirements: []
|
112
102
|
|
113
103
|
rubyforge_project:
|
114
|
-
rubygems_version: 1.3.
|
104
|
+
rubygems_version: 1.3.6
|
115
105
|
signing_key:
|
116
106
|
specification_version: 3
|
117
|
-
summary:
|
107
|
+
summary: The Unfuddle provider for ticketmaster.
|
118
108
|
test_files:
|
119
|
-
-
|
120
|
-
-
|
109
|
+
- spec/comments_spec.rb
|
110
|
+
- spec/projects_spec.rb
|
111
|
+
- spec/spec_helper.rb
|
112
|
+
- spec/ticketmaster-unfuddle_spec.rb
|
113
|
+
- spec/tickets_spec.rb
|
data/test/helper.rb
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
require 'ticketmaster'
|
3
|
-
|
4
|
-
class TestTicketmasterUnfuddle < Test::Unit::TestCase
|
5
|
-
context "Unfuddle" do
|
6
|
-
setup do
|
7
|
-
@unfuddle = TicketMaster.new(:unfuddle, {:username => "", :password => "", :subdomain => "ticketmaster"})
|
8
|
-
@project = @unfuddle.project.find.first
|
9
|
-
end
|
10
|
-
|
11
|
-
should "find testproject" do
|
12
|
-
project = @unfuddle.project.find(:name => "testproject")
|
13
|
-
|
14
|
-
assert_instance_of TicketMasterMod::Project, project
|
15
|
-
assert_equal "testproject", project.name
|
16
|
-
|
17
|
-
#method 2
|
18
|
-
project = @unfuddle.project.find("testproject")
|
19
|
-
|
20
|
-
assert_instance_of TicketMasterMod::Project, project
|
21
|
-
assert_equal "testproject", project.name
|
22
|
-
|
23
|
-
#method 3
|
24
|
-
project = @unfuddle.project["testproject"]
|
25
|
-
|
26
|
-
assert_instance_of TicketMasterMod::Project, project
|
27
|
-
assert_equal "testproject", project.name
|
28
|
-
end
|
29
|
-
|
30
|
-
context "project instance" do
|
31
|
-
should "find a project" do
|
32
|
-
assert_instance_of TicketMasterMod::Project, @project
|
33
|
-
end
|
34
|
-
|
35
|
-
should "find a bunch of tickets" do
|
36
|
-
@project.tickets
|
37
|
-
end
|
38
|
-
|
39
|
-
should "find new tickets" do
|
40
|
-
tickets = @project.tickets(:status => "new")
|
41
|
-
|
42
|
-
tickets.each do |ticket|
|
43
|
-
assert_equal "new", ticket.status
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
should "find ticket with id 1" do
|
48
|
-
ticket = @project.tickets(:id => 1)
|
49
|
-
|
50
|
-
assert_equal 1, ticket.id
|
51
|
-
end
|
52
|
-
|
53
|
-
should "create a ticket" do
|
54
|
-
assert @project.ticket.create(:priority => 3, :summary => "Test", :description => "Hello World from TicketMaster::Unfuddle").empty?
|
55
|
-
end
|
56
|
-
|
57
|
-
should "change ticket property" do
|
58
|
-
ticket = @project.tickets.last
|
59
|
-
ticket.description = "Edited description"
|
60
|
-
assert ticket.save.empty?
|
61
|
-
|
62
|
-
ticket = @project.tickets.last
|
63
|
-
assert_equal "Edited description", ticket.description
|
64
|
-
end
|
65
|
-
|
66
|
-
should "close the last ticket with a resolution" do
|
67
|
-
ticket = @project.tickets.last
|
68
|
-
assert ticket.close(:resolution => "fixed", :description => "Fixed issue").empty?
|
69
|
-
|
70
|
-
ticket = @project.tickets.last
|
71
|
-
assert_equal "fixed", ticket.resolution
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|