ticketmaster-teambox 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ require File.dirname(__FILE__) + '/teambox/teambox-api'
2
+
3
+ %w{ teambox ticket project comment }.each do |f|
4
+ require File.dirname(__FILE__) + '/provider/' + f + '.rb';
5
+ end
@@ -0,0 +1,53 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "Ticketmaster::Provider::Teambox::Comment" do
4
+ before(:all) do
5
+ headers_get = {'Authorization' => 'OAuth 01234567890abcdef', 'Accept' => 'application/json'}
6
+ headers = {'Authorization' => 'OAuth 01234567890abcdef', 'Content-Type' => 'application/json'}
7
+ ActiveResource::HttpMock.respond_to do |mock|
8
+ mock.get '/api/1/projects/23216.json', headers_get, fixture_for('projects/23216'), 200
9
+ mock.get '/api/1/projects/23216/tasks.json?count=0', headers_get, fixture_for('tasks'), 200
10
+ mock.get '/api/1/projects/23216/tasks/85915.json', headers_get, fixture_for('tasks/85915'), 200
11
+ mock.get '/api/1/projects/23216/tasks/85915/comments.json?count=0', headers_get, fixture_for('comments'), 200
12
+ mock.post '/api/1/projects/23216/tasks/85915/comments.json?body=New%20comment%20created.', headers, fixture_for('comments/create'), 200
13
+ end
14
+ @project_id = 23216
15
+ @task_id = 85915
16
+
17
+ stubs = Faraday::Adapter::Test::Stubs.new do |stub|
18
+ ACCESS_TOKEN = { "access_token" => "01234567890abcdef", "username" => "anymoto" }
19
+ stub.post('/oauth/token') { [200, {}, ACCESS_TOKEN.to_json] }
20
+ end
21
+
22
+ new_method = Faraday::Connection.method(:new)
23
+ Faraday::Connection.stub(:new) do |*args|
24
+ connection = new_method.call(*args) do |builder|
25
+ builder.adapter :test, stubs
26
+ end
27
+ end
28
+
29
+ @ticketmaster = TicketMaster.new(:teambox, {:username => "anymoto",
30
+ :password => "000000",
31
+ :client_id => 'abcdef000000',
32
+ :client_secret => 'ghijk11111'})
33
+ @klass = TicketMaster::Provider::Teambox::Comment
34
+ @project = @ticketmaster.project(@project_id)
35
+ @ticket = @project.ticket(@task_id)
36
+ @ticket.project_id = @project.id
37
+ end
38
+
39
+ it "should be able to load all comments" do
40
+ @comments = @ticket.comments
41
+ @comments.should be_an_instance_of(Array)
42
+ @comments.first.should be_an_instance_of(@klass)
43
+ end
44
+
45
+ it "should return the class" do
46
+ @ticket.comment.should == @klass
47
+ end
48
+
49
+ it "should be able to create a comment" do
50
+ @comment = @ticket.comment!(:body => 'New comment created.')
51
+ @comment.should be_an_instance_of(@klass)
52
+ end
53
+ end
@@ -0,0 +1,79 @@
1
+ {
2
+ "type": "List",
3
+ "references": [
4
+ {
5
+ "type": "Project",
6
+ "permalink": "teambox-api-example-project",
7
+ "archived": false,
8
+ "owner_user_id": 111245,
9
+ "updated_at": "2010-08-28 14:20:35 +0000",
10
+ "organization_id": 14076,
11
+ "created_at": "2010-07-30 20:16:55 +0000",
12
+ "name": "Teambox Api Example Project",
13
+ "id": 23216
14
+ },
15
+ {
16
+ "type": "Task",
17
+ "is_private": false,
18
+ "user_id": 111245,
19
+ "comments_count": 1,
20
+ "project_id": 23216,
21
+ "recent_comment_ids": [
22
+ 646695
23
+ ],
24
+ "updated_at": "2010-08-30 20:16:57 +0000",
25
+ "first_comment_id": 646695,
26
+ "watchers": [
27
+ 111245
28
+ ],
29
+ "simple": false,
30
+ "created_at": "2010-08-28 22:21:55 +0000",
31
+ "name": "What to do with the API",
32
+ "id": 85915
33
+ },
34
+ {
35
+ "type": "Comment",
36
+ "user_id": 111245,
37
+ "target_type": "Task",
38
+ "target_id": 85915,
39
+ "project_id": 23216,
40
+ "updated_at": "2010-08-30 20:16:57 +0000",
41
+ "created_at": "2010-08-30 20:16:57 +0000",
42
+ "body_html": "<p>Anyone have any ideas?</p>\n",
43
+ "id": 646695,
44
+ "hours": null,
45
+ "body": "Anyone have any ideas?"
46
+ },
47
+ {
48
+ "type": "User",
49
+ "first_name": "API",
50
+ "micro_avatar_url": "http://www.gravatar.com/avatar/db32dac52f3a034fa28a149f20bae5b4?size=24&default=identicon",
51
+ "biography": null,
52
+ "locale": "en",
53
+ "updated_at": "2010-10-25 09:58:45 +0000",
54
+ "time_zone": "Eastern Time (US & Canada)",
55
+ "last_name": "Man",
56
+ "avatar_url": "http://www.gravatar.com/avatar/db32dac52f3a034fa28a149f20bae5b4?size=48&default=identicon",
57
+ "created_at": "2010-07-30 20:16:55 +0000",
58
+ "username": "example_api_user",
59
+ "id": 111245,
60
+ "utc_offset": -18000
61
+ }
62
+ ],
63
+ "objects": [
64
+ {
65
+ "type": "Comment",
66
+ "user_id": 111245,
67
+ "target_type": "Task",
68
+ "target_id": 85915,
69
+ "project_id": 23216,
70
+ "updated_at": "2010-08-30 20:16:57 +0000",
71
+ "created_at": "2010-08-30 20:16:57 +0000",
72
+ "body_html": "<p>Anyone have any ideas?</p>\n",
73
+ "id": 646695,
74
+ "hours": null,
75
+ "body": "Anyone have any ideas?"
76
+ }
77
+ ]
78
+ }
79
+
@@ -0,0 +1,13 @@
1
+ {
2
+ "user_id": 111245,
3
+ "target_type": "Task",
4
+ "target_id": 85915,
5
+ "project_id": 23216,
6
+ "updated_at": "2010-08-30 20:16:57 +0000",
7
+ "created_at": "2010-08-30 20:16:57 +0000",
8
+ "body_html": "<p>Anyone have any ideas?</p>\n",
9
+ "id": 646695,
10
+ "hours": null,
11
+ "body": "Anyone have any ideas?"
12
+ }
13
+
@@ -0,0 +1,69 @@
1
+ {
2
+ "type": "List",
3
+ "references": [
4
+ {
5
+ "type": "Organization",
6
+ "description": null,
7
+ "updated_at": "2010-08-28 14:20:34",
8
+ "domain": null,
9
+ "time_zone": "Eastern Time (US & Canada)",
10
+ "language": "en",
11
+ "logo_url": "/logos/original/missing.png",
12
+ "permalink": "user-example_api_user",
13
+ "created_at": "2010-08-28 14:20:34 +0000",
14
+ "name": "Projects from API Man",
15
+ "id": 14076
16
+ },
17
+ {
18
+ "type": "User",
19
+ "avatar_url": "http://www.gravatar.com/avatar/db32dac52f3a034fa28a149f20bae5b4?size=48&default=identicon",
20
+ "first_name": "API",
21
+ "micro_avatar_url": "http://www.gravatar.com/avatar/db32dac52f3a034fa28a149f20bae5b4?size=24&default=identicon",
22
+ "biography": null,
23
+ "locale": "en",
24
+ "updated_at": "2010-10-25 09:58:45 +0000",
25
+ "time_zone": "Eastern Time (US & Canada)",
26
+ "last_name": "Man",
27
+ "created_at": "2010-07-30 20:16:55 +0000",
28
+ "username": "example_api_user",
29
+ "id": 111245,
30
+ "utc_offset": -18000
31
+ }
32
+ ],
33
+ "objects": [
34
+ {
35
+ "type": "Project",
36
+ "organization_id": 14076,
37
+ "updated_at": "2010-08-28 14:20:35 +0000",
38
+ "owner_user_id": 111245,
39
+ "permalink": "teambox-api-example-project",
40
+ "created_at": "2010-07-30 20:16:55 +0000",
41
+ "name": "Teambox Api Example Project",
42
+ "archived": false,
43
+ "id": 23216
44
+ },
45
+ {
46
+ "type": "Project",
47
+ "organization_id": 14076,
48
+ "updated_at": "2010-08-30 16:00:19 +0000",
49
+ "owner_user_id": 111245,
50
+ "permalink": "teambox-api-second-project",
51
+ "created_at": "2010-08-30 16:00:19 +0000",
52
+ "name": "Teambox Api Second Project",
53
+ "archived": false,
54
+ "id": 23217
55
+ },
56
+ {
57
+ "type": "Project",
58
+ "organization_id": 14076,
59
+ "updated_at": "2010-09-01 11:54:00 +0000",
60
+ "owner_user_id": 111245,
61
+ "permalink": "teambox-api-third-project",
62
+ "created_at": "2010-09-01 11:54:00 +0000",
63
+ "name": "Teambox Api Third Project",
64
+ "archived": false,
65
+ "id": 23218
66
+ }
67
+ ]
68
+ }
69
+
@@ -0,0 +1,42 @@
1
+ {
2
+ "organization_id": 14076,
3
+ "type": "Project",
4
+ "references": [
5
+ {
6
+ "type": "Organization",
7
+ "description": null,
8
+ "updated_at": "2010-08-28 14:20:34",
9
+ "domain": null,
10
+ "time_zone": "Eastern Time (US & Canada)",
11
+ "language": "en",
12
+ "logo_url": "/logos/original/missing.png",
13
+ "permalink": "user-example_api_user",
14
+ "created_at": "2010-08-28 14:20:34 +0000",
15
+ "name": "Projects from API Man",
16
+ "id": 14076
17
+ },
18
+ {
19
+ "type": "User",
20
+ "avatar_url": "http://www.gravatar.com/avatar/db32dac52f3a034fa28a149f20bae5b4?size=48&default=identicon",
21
+ "first_name": "API",
22
+ "micro_avatar_url": "http://www.gravatar.com/avatar/db32dac52f3a034fa28a149f20bae5b4?size=24&default=identicon",
23
+ "biography": null,
24
+ "locale": "en",
25
+ "updated_at": "2010-10-25 09:58:45 +0000",
26
+ "time_zone": "Eastern Time (US & Canada)",
27
+ "last_name": "Man",
28
+ "created_at": "2010-07-30 20:16:55 +0000",
29
+ "username": "example_api_user",
30
+ "id": 111245,
31
+ "utc_offset": -18000
32
+ }
33
+ ],
34
+ "updated_at": "2010-08-28 14:20:35 +0000",
35
+ "permalink": "teambox-api-example-project",
36
+ "owner_user_id": 111245,
37
+ "name": "Teambox Api Example Project",
38
+ "created_at": "2010-07-30 20:16:55 +0000",
39
+ "id": 23216,
40
+ "archived": false
41
+ }
42
+
@@ -0,0 +1,42 @@
1
+ {
2
+ "organization_id": 14076,
3
+ "type": "Project",
4
+ "references": [
5
+ {
6
+ "type": "Organization",
7
+ "description": null,
8
+ "updated_at": "2010-08-28 14:20:34",
9
+ "domain": null,
10
+ "time_zone": "Eastern Time (US & Canada)",
11
+ "language": "en",
12
+ "logo_url": "/logos/original/missing.png",
13
+ "permalink": "user-example_api_user",
14
+ "created_at": "2010-08-28 14:20:34 +0000",
15
+ "name": "Projects from API Man",
16
+ "id": 14076
17
+ },
18
+ {
19
+ "type": "User",
20
+ "avatar_url": "http://www.gravatar.com/avatar/db32dac52f3a034fa28a149f20bae5b4?size=48&default=identicon",
21
+ "first_name": "API",
22
+ "micro_avatar_url": "http://www.gravatar.com/avatar/db32dac52f3a034fa28a149f20bae5b4?size=24&default=identicon",
23
+ "biography": null,
24
+ "locale": "en",
25
+ "updated_at": "2010-10-25 09:58:45 +0000",
26
+ "time_zone": "Eastern Time (US & Canada)",
27
+ "last_name": "Man",
28
+ "created_at": "2010-07-30 20:16:55 +0000",
29
+ "username": "example_api_user",
30
+ "id": 111245,
31
+ "utc_offset": -18000
32
+ }
33
+ ],
34
+ "updated_at": "2010-08-30 16:00:19 +0000",
35
+ "permalink": "teambox-api-second-project",
36
+ "owner_user_id": 111245,
37
+ "name": "Teambox Api Second Project",
38
+ "created_at": "2010-08-30 16:00:19 +0000",
39
+ "id": 23217,
40
+ "archived": false
41
+ }
42
+
@@ -0,0 +1,42 @@
1
+ {
2
+ "organization_id": 14076,
3
+ "type": "Project",
4
+ "references": [
5
+ {
6
+ "type": "Organization",
7
+ "description": null,
8
+ "updated_at": "2010-08-28 14:20:34",
9
+ "domain": null,
10
+ "time_zone": "Eastern Time (US & Canada)",
11
+ "language": "en",
12
+ "logo_url": "/logos/original/missing.png",
13
+ "permalink": "user-example_api_user",
14
+ "created_at": "2010-08-28 14:20:34 +0000",
15
+ "name": "Projects from API Man",
16
+ "id": 14076
17
+ },
18
+ {
19
+ "type": "User",
20
+ "avatar_url": "http://www.gravatar.com/avatar/db32dac52f3a034fa28a149f20bae5b4?size=48&default=identicon",
21
+ "first_name": "API",
22
+ "micro_avatar_url": "http://www.gravatar.com/avatar/db32dac52f3a034fa28a149f20bae5b4?size=24&default=identicon",
23
+ "biography": null,
24
+ "locale": "en",
25
+ "updated_at": "2010-10-25 09:58:45 +0000",
26
+ "time_zone": "Eastern Time (US & Canada)",
27
+ "last_name": "Man",
28
+ "created_at": "2010-07-30 20:16:55 +0000",
29
+ "username": "example_api_user",
30
+ "id": 111245,
31
+ "utc_offset": -18000
32
+ }
33
+ ],
34
+ "updated_at": "2010-09-01 11:54:00 +0000",
35
+ "permalink": "teambox-api-example-project",
36
+ "owner_user_id": 111245,
37
+ "name": "Teambox Api Third Project",
38
+ "created_at": "2010-09-01 11:54:00 +0000",
39
+ "id": 23218,
40
+ "archived": false
41
+ }
42
+
@@ -0,0 +1,113 @@
1
+ {
2
+ "type": "List",
3
+ "references": [
4
+ {
5
+ "type": "Project",
6
+ "permalink": "teambox-api-example-project",
7
+ "archived": false,
8
+ "owner_user_id": 111245,
9
+ "updated_at": "2010-08-28 14:20:35 +0000",
10
+ "organization_id": 14076,
11
+ "created_at": "2010-07-30 20:16:55 +0000",
12
+ "name": "Teambox Api Example Project",
13
+ "id": 23216
14
+ },
15
+ {
16
+ "type": "TaskList",
17
+ "user_id": 111245,
18
+ "position": 1,
19
+ "archived": false,
20
+ "project_id": 23216,
21
+ "updated_at": "2010-07-30 20:16:56 +0000",
22
+ "created_at": "2010-07-28 21:06:55 +0000",
23
+ "name": "Things to do with the API",
24
+ "id": 30232
25
+ },
26
+ {
27
+ "type": "User",
28
+ "first_name": "API",
29
+ "micro_avatar_url": "http://www.gravatar.com/avatar/db32dac52f3a034fa28a149f20bae5b4?size=24&default=identicon",
30
+ "biography": null,
31
+ "locale": "en",
32
+ "updated_at": "2010-10-25 09:58:45 +0000",
33
+ "time_zone": "Eastern Time (US & Canada)",
34
+ "last_name": "Man",
35
+ "avatar_url": "http://www.gravatar.com/avatar/db32dac52f3a034fa28a149f20bae5b4?size=48&default=identicon",
36
+ "created_at": "2010-07-30 20:16:55 +0000",
37
+ "username": "example_api_user",
38
+ "id": 111245,
39
+ "utc_offset": -18000
40
+ }
41
+ ],
42
+ "objects": [
43
+ {
44
+ "type": "Task",
45
+ "is_private": false,
46
+ "assigned_id": null,
47
+ "user_id": 111245,
48
+ "position": 1,
49
+ "status": 0,
50
+ "task_list_id": 30232,
51
+ "comments_count": 2,
52
+ "project_id": 23216,
53
+ "recent_comment_ids": [
54
+
55
+ ],
56
+ "updated_at": "2010-08-29 20:16:56 +0000",
57
+ "first_comment_id": null,
58
+ "watchers": [
59
+ 111245
60
+ ],
61
+ "created_at": "2010-08-28 21:31:55 +0000",
62
+ "name": "iPhone App",
63
+ "id": 85915
64
+ },
65
+ {
66
+ "type": "Task",
67
+ "is_private": false,
68
+ "assigned_id": null,
69
+ "user_id": 111245,
70
+ "position": 1,
71
+ "status": 0,
72
+ "task_list_id": 30232,
73
+ "comments_count": 0,
74
+ "project_id": 23216,
75
+ "recent_comment_ids": [
76
+
77
+ ],
78
+ "updated_at": "2010-08-30 20:16:56 +0000",
79
+ "first_comment_id": null,
80
+ "watchers": [
81
+ 111245
82
+ ],
83
+ "created_at": "2010-08-30 21:31:55 +0000",
84
+ "name": "Android App",
85
+ "id": 85916
86
+ },
87
+ {
88
+ "type": "Task",
89
+ "is_private": false,
90
+ "assigned_id": null,
91
+ "user_id": 111245,
92
+ "position": 1,
93
+ "status": 0,
94
+ "task_list_id": 30232,
95
+ "comments_count": 0,
96
+ "project_id": 23216,
97
+ "recent_comment_ids": [
98
+
99
+ ],
100
+ "updated_at": "2010-08-30 21:19:00 +0000",
101
+ "first_comment_id": null,
102
+ "watchers": [
103
+ 111245
104
+ ],
105
+ "created_at": "2010-08-30 21:10:45 +0000",
106
+ "name": "Fix e-mail notification",
107
+ "id": 85917
108
+ }
109
+
110
+
111
+ ]
112
+ }
113
+