ticketmaster-teambox 0.1.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.
@@ -0,0 +1,62 @@
1
+ {
2
+ "user_id": 111245,
3
+ "assigned_id": null,
4
+ "is_private": false,
5
+ "type": "Task",
6
+ "references": [
7
+ {
8
+ "type": "Project",
9
+ "permalink": "teambox-api-example-project",
10
+ "archived": false,
11
+ "owner_user_id": 111245,
12
+ "updated_at": "2010-08-28 14:20:35 +0000",
13
+ "organization_id": 14076,
14
+ "created_at": "2010-07-30 20:16:55 +0000",
15
+ "name": "Teambox Api Example Project",
16
+ "id": 23216
17
+ },
18
+ {
19
+ "type": "TaskList",
20
+ "user_id": 111245,
21
+ "position": 1,
22
+ "archived": false,
23
+ "project_id": 23216,
24
+ "updated_at": "2010-07-30 20:16:56 +0000",
25
+ "created_at": "2010-07-28 21:06:55 +0000",
26
+ "name": "Things to do with the API",
27
+ "id": 30232
28
+ },
29
+ {
30
+ "type": "User",
31
+ "first_name": "API",
32
+ "micro_avatar_url": "http://www.gravatar.com/avatar/db32dac52f3a034fa28a149f20bae5b4?size=24&default=identicon",
33
+ "biography": null,
34
+ "locale": "en",
35
+ "updated_at": "2010-10-25 09:58:45 +0000",
36
+ "time_zone": "Eastern Time (US & Canada)",
37
+ "last_name": "Man",
38
+ "avatar_url": "http://www.gravatar.com/avatar/db32dac52f3a034fa28a149f20bae5b4?size=48&default=identicon",
39
+ "created_at": "2010-07-30 20:16:55 +0000",
40
+ "username": "example_api_user",
41
+ "id": 111245,
42
+ "utc_offset": -18000
43
+ }
44
+ ],
45
+ "position": 1,
46
+ "task_list_id": 30232,
47
+ "status": 0,
48
+ "comments_count": 2,
49
+ "project_id": 23216,
50
+ "updated_at": "2010-08-29 20:16:56 +0000",
51
+ "recent_comment_ids": [
52
+
53
+ ],
54
+ "watchers": [
55
+ 111245
56
+ ],
57
+ "first_comment_id": null,
58
+ "name": "iPhone App",
59
+ "created_at": "2010-08-28 21:31:55 +0000",
60
+ "id": 85915
61
+ }
62
+
@@ -0,0 +1,62 @@
1
+ {
2
+ "user_id": 111245,
3
+ "assigned_id": null,
4
+ "is_private": false,
5
+ "type": "Task",
6
+ "references": [
7
+ {
8
+ "type": "Project",
9
+ "permalink": "teambox-api-example-project",
10
+ "archived": false,
11
+ "owner_user_id": 111245,
12
+ "updated_at": "2010-08-28 14:20:35 +0000",
13
+ "organization_id": 14076,
14
+ "created_at": "2010-07-30 20:16:55 +0000",
15
+ "name": "Teambox Api Example Project",
16
+ "id": 23216
17
+ },
18
+ {
19
+ "type": "TaskList",
20
+ "user_id": 111245,
21
+ "position": 1,
22
+ "archived": false,
23
+ "project_id": 23216,
24
+ "updated_at": "2010-07-30 20:16:56 +0000",
25
+ "created_at": "2010-07-28 21:06:55 +0000",
26
+ "name": "Things to do with the API",
27
+ "id": 30232
28
+ },
29
+ {
30
+ "type": "User",
31
+ "first_name": "API",
32
+ "micro_avatar_url": "http://www.gravatar.com/avatar/db32dac52f3a034fa28a149f20bae5b4?size=24&default=identicon",
33
+ "biography": null,
34
+ "locale": "en",
35
+ "updated_at": "2010-10-25 09:58:45 +0000",
36
+ "time_zone": "Eastern Time (US & Canada)",
37
+ "last_name": "Man",
38
+ "avatar_url": "http://www.gravatar.com/avatar/db32dac52f3a034fa28a149f20bae5b4?size=48&default=identicon",
39
+ "created_at": "2010-07-30 20:16:55 +0000",
40
+ "username": "example_api_user",
41
+ "id": 111245,
42
+ "utc_offset": -18000
43
+ }
44
+ ],
45
+ "position": 1,
46
+ "task_list_id": 30232,
47
+ "status": 0,
48
+ "comments_count": 0,
49
+ "project_id": 23216,
50
+ "updated_at": "2010-08-30 20:16:56 +0000",
51
+ "recent_comment_ids": [
52
+
53
+ ],
54
+ "watchers": [
55
+ 111245
56
+ ],
57
+ "first_comment_id": null,
58
+ "name": "Android App",
59
+ "created_at": "2010-08-30 21:31:55 +0000",
60
+ "id": 85916
61
+ }
62
+
@@ -0,0 +1,22 @@
1
+ {
2
+ "user_id": 111245,
3
+ "project_id": 23216,
4
+ "recent_comment_ids": [
5
+
6
+ ],
7
+ "first_comment_id": null,
8
+ "watchers": [
9
+ 111245
10
+ ],
11
+ "status": 0,
12
+ "position": 1,
13
+ "is_private": false,
14
+ "updated_at": "2010-07-30 20:16:56 +0000",
15
+ "assigned_id": null,
16
+ "created_at": "2010-07-28 21:31:55 +0000",
17
+ "name": "Mobile App",
18
+ "task_list_id": 30232,
19
+ "comments_count": 0,
20
+ "id": 85917
21
+ }
22
+
@@ -0,0 +1,74 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "Ticketmaster::Provider::Teambox::Project" do
4
+ before(:all) do
5
+ headers_get = {'Authorization' => 'OAuth 01234567890abcdef', 'Accept' => 'application/json'}
6
+ headers = {'Authorization' => 'OAuth 01234567890abcdef', 'Content-Type' => 'application/json'}
7
+ @project_id = 23216
8
+ ActiveResource::HttpMock.respond_to do |mock|
9
+ mock.get '/api/1/projects.json?count=0', headers_get, fixture_for('projects'), 200
10
+ mock.get '/api/1/projects/23216.json', headers_get, fixture_for('projects/23216'), 200
11
+ mock.post '/api/1/organizations/56789/projects.json?name=New%20Project&permalink=new-project&organization_id=56789', headers, '', 201
12
+ mock.put '/api/1/projects/23216.json?name=some%20new%20name&permalink=teambox-api-example-project&created_at=2010-07-30%2020:16:55%20+0000&updated_at=2010-08-28%2014:20:35%20+0000', headers, '', 200
13
+ end
14
+
15
+ #stubs = Faraday::Adapter::Test::Stubs.new do |stub|
16
+ # ACCESS_TOKEN = { "access_token" => "01234567890abcdef", "username" => "anymoto" }
17
+ # stub.post('/oauth/token') { [200, {}, ACCESS_TOKEN.to_json] }
18
+ #end
19
+
20
+ #new_method = Faraday::Connection.method(:new)
21
+ #Faraday::Connection.stub(:new) do |*args|
22
+ # connection = new_method.call(*args) do |builder|
23
+ # builder.adapter :test, stubs
24
+ # end
25
+ #end
26
+
27
+ @ticketmaster = TicketMaster.new(:teambox, {:username => "anymoto",
28
+ :password => "000000",
29
+ :client_id => 'abcdef000000',
30
+ :client_secret => 'ghijk11111'})
31
+ @klass = TicketMaster::Provider::Teambox::Project
32
+ end
33
+
34
+ it "should be able to load all projects" do
35
+ @ticketmaster.projects.should be_an_instance_of(Array)
36
+ @ticketmaster.projects.first.should be_an_instance_of(@klass)
37
+ end
38
+
39
+ it "should be able to load projects from an array of id's" do
40
+ @projects = @ticketmaster.projects([@project_id])
41
+ @projects.should be_an_instance_of(Array)
42
+ @projects.first.should be_an_instance_of(@klass)
43
+ @projects.first.id.should == @project_id
44
+ end
45
+
46
+ it "should be able to load all projects from attributes" do
47
+ @projects = @ticketmaster.projects(:id => 23216)
48
+ @projects.should be_an_instance_of(Array)
49
+ @projects.first.should be_an_instance_of(@klass)
50
+ @projects.first.id.should == 23216
51
+ end
52
+
53
+ it "should be able to find a project" do
54
+ @ticketmaster.project.should == @klass
55
+ @ticketmaster.project.find(@project_id).should be_an_instance_of(@klass)
56
+ end
57
+
58
+ it "should be able to find a project by identifier" do
59
+ @ticketmaster.project(@project_id).should be_an_instance_of(@klass)
60
+ @ticketmaster.project(@project_id).id.should == @project_id
61
+ end
62
+
63
+ it "should be able to create a new project" do
64
+ @project = @ticketmaster.project!(:name => 'New Project', :organization_id => '56789', :permalink => 'new-project').should be_an_instance_of(@klass)
65
+ end
66
+
67
+ it "should be able to update and save a project" do
68
+ @project = @ticketmaster.project(@project_id)
69
+ @project.update!(:name => 'some new name').should == true
70
+ end
71
+
72
+
73
+
74
+ end
@@ -0,0 +1 @@
1
+ --color
@@ -0,0 +1,10 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+ require 'rubygems'
4
+ require 'spec'
5
+ require 'ticketmaster'
6
+ require 'ticketmaster-teambox'
7
+
8
+ def fixture_for(name)
9
+ File.read(File.dirname(__FILE__) + '/fixtures/' + name + '.json')
10
+ end
@@ -0,0 +1,34 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "Ticketmaster::Provider::Teambox" do
4
+
5
+ before (:all) do
6
+ #stubs = Faraday::Adapter::Test::Stubs.new do |stub|
7
+ # ACCESS_TOKEN = { "access_token" => "01234567890abcdef", "username" => "anymoto" }
8
+ # stub.post('/oauth/token') { [200, {}, ACCESS_TOKEN.to_json] }
9
+ #end
10
+
11
+ #new_method = Faraday::Connection.method(:new)
12
+ #Faraday::Connection.stub(:new) do |*args|
13
+ # connection = new_method.call(*args) do |builder|
14
+ # builder.adapter :test, stubs
15
+ # end
16
+ #end
17
+
18
+ @ticketmaster = TicketMaster.new(:teambox, {:username => "anymoto",
19
+ :password => "000000",
20
+ :client_id => 'abcdef000000',
21
+ :client_secret => 'ghijk11111'})
22
+ end
23
+
24
+ it "should be able to instantiate a new instance" do
25
+ @ticketmaster.should be_an_instance_of(TicketMaster)
26
+ @ticketmaster.should be_a_kind_of(TicketMaster::Provider::Teambox)
27
+ end
28
+
29
+ it "should return true for a valid authentication" do
30
+ @ticketmaster.valid?.should be_true
31
+ end
32
+
33
+
34
+ end
@@ -0,0 +1,84 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "Ticketmaster::Provider::Teambox::Ticket" do
4
+ before(:all) do
5
+ headers_get = {'Authorization' => 'OAuth 01234567890abcdef', 'Accept' => 'application/json'}
6
+ headers = {'Authorization' => 'OAuth 01234567890abcdef', 'Content-Type' => 'application/json'}
7
+ @project_id = 23216
8
+ ActiveResource::HttpMock.respond_to do |mock|
9
+ mock.get '/api/1/projects.json', headers_get, fixture_for('projects'), 200
10
+ mock.get '/api/1/projects/23216.json', headers_get, fixture_for('projects/23216'), 200
11
+ mock.get '/api/1/projects/23216/tasks/85915.json', headers_get, fixture_for('tasks/85915'), 200
12
+ mock.get '/api/1/projects/23216/tasks.json?count=0', headers_get, fixture_for('tasks'), 200
13
+ mock.get '/api/1/projects/23216/tasks/85915.json', headers_get, fixture_for('tasks/85915'), 200
14
+ mock.put '/api/1/projects/23216/tasks/85915.json?name=New%20ticket%20name&updated_at=2010-08-29%2020:16:56%20+0000', headers, '', 200
15
+ mock.post '/api/1/projects/23216/task_lists/30232/tasks.json?name=Mobile%20App', headers, '', 200
16
+ end
17
+
18
+ #stubs = Faraday::Adapter::Test::Stubs.new do |stub|
19
+ #ACCESS_TOKEN = { "access_token" => "01234567890abcdef", "refresh_token" => "01234567890abcdef", "username" => "anymoto" }
20
+ # stub.post('/oauth/token') { [200, {}, ACCESS_TOKEN.to_json] }
21
+ #end
22
+
23
+ #new_method = Faraday::Connection.method(:new)
24
+ #Faraday::Connection.stub(:new) do |*args|
25
+ # connection = new_method.call(*args) do |builder|
26
+ # builder.adapter :test, stubs
27
+ # end
28
+ #end
29
+
30
+ @ticketmaster = TicketMaster.new(:teambox, {:username => "anymoto",
31
+ :password => "000000",
32
+ :client_id => 'abcdef000000',
33
+ :client_secret => 'ghijk11111'})
34
+ @project = @ticketmaster.project(@project_id)
35
+ @klass = TicketMaster::Provider::Teambox::Ticket
36
+ end
37
+
38
+ it "should be able to load all tickets" do
39
+ @project.tickets.should be_an_instance_of(Array)
40
+ @project.tickets.first.should be_an_instance_of(@klass)
41
+ end
42
+
43
+ it "should be able to load all tickets based on an array of id's" do
44
+ @tickets = @project.tickets([85915])
45
+ @tickets.should be_an_instance_of(Array)
46
+ @tickets.first.should be_an_instance_of(@klass)
47
+ @tickets.first.name.should == 'iPhone App'
48
+ end
49
+
50
+ it "should be able to load all tickets based on attributes" do
51
+ @tickets = @project.tickets(:id => 85915)
52
+ @tickets.should be_an_instance_of(Array)
53
+ @tickets.first.should be_an_instance_of(@klass)
54
+ @tickets.first.name.should == 'iPhone App'
55
+ end
56
+
57
+ it "should return the ticket class" do
58
+ @project.ticket.should == @klass
59
+ end
60
+
61
+ it "should be able to load a single ticket" do
62
+ @ticket = @project.ticket(85915)
63
+ @ticket.should be_an_instance_of(@klass)
64
+ @ticket.name.should == 'iPhone App'
65
+ end
66
+
67
+ it "shoule be able to load a single ticket based on attributes" do
68
+ @ticket = @project.ticket(:id => 85915)
69
+ @ticket.should be_an_instance_of(@klass)
70
+ @ticket.name.should == 'iPhone App'
71
+ end
72
+
73
+ it "should be able to update and save a ticket" do
74
+ @ticket = @project.ticket(85915)
75
+ @ticket.name = 'New ticket name'
76
+ @ticket.save.should == true
77
+ end
78
+
79
+ it "should be able to create a ticket" do
80
+ @ticket = @project.ticket!(:name => 'Mobile App', :task_list_id => 30232)
81
+ @ticket.should be_an_instance_of(@klass)
82
+ end
83
+
84
+ end
metadata ADDED
@@ -0,0 +1,222 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ticketmaster-teambox
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Hybridgroup
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-06-23 00:00:00 -05:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ prerelease: false
23
+ type: :runtime
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - "="
28
+ - !ruby/object:Gem::Version
29
+ hash: 7
30
+ segments:
31
+ - 0
32
+ - 5
33
+ - 6
34
+ version: 0.5.6
35
+ name: ticketmaster
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ prerelease: false
39
+ type: :runtime
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 3
46
+ segments:
47
+ - 0
48
+ version: "0"
49
+ name: oauth2
50
+ version_requirements: *id002
51
+ - !ruby/object:Gem::Dependency
52
+ prerelease: false
53
+ type: :development
54
+ requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ~>
58
+ - !ruby/object:Gem::Version
59
+ hash: 23
60
+ segments:
61
+ - 1
62
+ - 0
63
+ - 0
64
+ version: 1.0.0
65
+ name: bundler
66
+ version_requirements: *id003
67
+ - !ruby/object:Gem::Dependency
68
+ prerelease: false
69
+ type: :development
70
+ requirement: &id004 !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ hash: 1
76
+ segments:
77
+ - 1
78
+ - 5
79
+ - 1
80
+ version: 1.5.1
81
+ name: jeweler
82
+ version_requirements: *id004
83
+ - !ruby/object:Gem::Dependency
84
+ prerelease: false
85
+ type: :development
86
+ requirement: &id005 !ruby/object:Gem::Requirement
87
+ none: false
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ hash: 3
92
+ segments:
93
+ - 0
94
+ version: "0"
95
+ name: rcov
96
+ version_requirements: *id005
97
+ - !ruby/object:Gem::Dependency
98
+ prerelease: false
99
+ type: :development
100
+ requirement: &id006 !ruby/object:Gem::Requirement
101
+ none: false
102
+ requirements:
103
+ - - "="
104
+ - !ruby/object:Gem::Version
105
+ hash: 13
106
+ segments:
107
+ - 1
108
+ - 2
109
+ - 9
110
+ version: 1.2.9
111
+ name: rspec
112
+ version_requirements: *id006
113
+ - !ruby/object:Gem::Dependency
114
+ prerelease: false
115
+ type: :runtime
116
+ requirement: &id007 !ruby/object:Gem::Requirement
117
+ none: false
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ hash: 15
122
+ segments:
123
+ - 3
124
+ - 0
125
+ - 4
126
+ version: 3.0.4
127
+ name: activesupport
128
+ version_requirements: *id007
129
+ - !ruby/object:Gem::Dependency
130
+ prerelease: false
131
+ type: :runtime
132
+ requirement: &id008 !ruby/object:Gem::Requirement
133
+ none: false
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ hash: 15
138
+ segments:
139
+ - 3
140
+ - 0
141
+ - 4
142
+ version: 3.0.4
143
+ name: activeresource
144
+ version_requirements: *id008
145
+ description: Allows ticketmaster to interact with Teambox
146
+ email: ana@hybridgroup.com
147
+ executables: []
148
+
149
+ extensions: []
150
+
151
+ extra_rdoc_files:
152
+ - LICENSE.txt
153
+ - README.md
154
+ files:
155
+ - Gemfile
156
+ - Gemfile.lock
157
+ - LICENSE.txt
158
+ - README.md
159
+ - Rakefile
160
+ - VERSION
161
+ - lib/provider/comment.rb
162
+ - lib/provider/project.rb
163
+ - lib/provider/teambox.rb
164
+ - lib/provider/ticket.rb
165
+ - lib/teambox/teambox-api.rb
166
+ - lib/ticketmaster-teambox.rb
167
+ - spec/comments_spec.rb
168
+ - spec/fixtures/comments.json
169
+ - spec/fixtures/comments/create.json
170
+ - spec/fixtures/projects.json
171
+ - spec/fixtures/projects/23216.json
172
+ - spec/fixtures/projects/23217.json
173
+ - spec/fixtures/projects/create.json
174
+ - spec/fixtures/tasks.json
175
+ - spec/fixtures/tasks/85915.json
176
+ - spec/fixtures/tasks/85916.json
177
+ - spec/fixtures/tasks/create.json
178
+ - spec/projects_spec.rb
179
+ - spec/spec.opts
180
+ - spec/spec_helper.rb
181
+ - spec/ticketmaster-teambox_spec.rb
182
+ - spec/tickets_spec.rb
183
+ has_rdoc: true
184
+ homepage: http://ticketrb.com
185
+ licenses: []
186
+
187
+ post_install_message:
188
+ rdoc_options: []
189
+
190
+ require_paths:
191
+ - lib
192
+ required_ruby_version: !ruby/object:Gem::Requirement
193
+ none: false
194
+ requirements:
195
+ - - ">="
196
+ - !ruby/object:Gem::Version
197
+ hash: 3
198
+ segments:
199
+ - 0
200
+ version: "0"
201
+ required_rubygems_version: !ruby/object:Gem::Requirement
202
+ none: false
203
+ requirements:
204
+ - - ">="
205
+ - !ruby/object:Gem::Version
206
+ hash: 3
207
+ segments:
208
+ - 0
209
+ version: "0"
210
+ requirements: []
211
+
212
+ rubyforge_project:
213
+ rubygems_version: 1.6.2
214
+ signing_key:
215
+ specification_version: 3
216
+ summary: Ticketmaster Provider for Teambox
217
+ test_files:
218
+ - spec/comments_spec.rb
219
+ - spec/projects_spec.rb
220
+ - spec/spec_helper.rb
221
+ - spec/ticketmaster-teambox_spec.rb
222
+ - spec/tickets_spec.rb