vimeo 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/README.markdown +312 -0
- data/Rakefile +1 -1
- data/VERSION.yml +2 -1
- data/init.rb +2 -0
- data/lib/vimeo.rb +1 -0
- data/lib/vimeo/advanced.rb +0 -1
- data/lib/vimeo/advanced/album.rb +8 -10
- data/lib/vimeo/advanced/base.rb +56 -46
- data/lib/vimeo/advanced/channel.rb +6 -9
- data/lib/vimeo/advanced/contact.rb +2 -3
- data/lib/vimeo/advanced/group.rb +5 -11
- data/lib/vimeo/advanced/person.rb +5 -6
- data/lib/vimeo/advanced/test.rb +7 -24
- data/lib/vimeo/advanced/upload.rb +4 -9
- data/lib/vimeo/advanced/video.rb +14 -15
- data/lib/vimeo/advanced/video_embed.rb +1 -2
- data/test/fixtures/advanced/auth/check_access_token.json +9 -0
- data/test/fixtures/advanced/auth/request_token.txt +1 -0
- data/test/fixtures/advanced/channel/get_all.json +17 -55
- data/test/fixtures/advanced/group/get_all.json +5 -29
- data/test/fixtures/advanced/group/get_info.json +1 -2
- data/test/fixtures/advanced/group_events/get_month.json +3 -8
- data/test/fixtures/advanced/group_events/get_past.json +3 -8
- data/test/fixtures/advanced/group_events/get_upcoming.json +3 -8
- data/test/fixtures/advanced/group_forums/get_topic_comments.json +1 -3
- data/test/fixtures/advanced/person/get_info.json +1 -2
- data/test/fixtures/advanced/video/get_by_tag.json +1 -3
- data/test/fixtures/advanced/video/get_subscriptions.json +3 -7
- data/test/fixtures/advanced/video/search.json +1 -2
- data/test/test_helper.rb +17 -6
- data/test/vimeo/advanced/album_test.rb +54 -67
- data/test/vimeo/advanced/auth_test.rb +17 -25
- data/test/vimeo/advanced/base_test.rb +7 -9
- data/test/vimeo/advanced/channels_test.rb +5 -5
- data/test/vimeo/advanced/contacts_test.rb +1 -1
- data/test/vimeo/advanced/group_events_test.rb +1 -1
- data/test/vimeo/advanced/group_forums_test.rb +1 -1
- data/test/vimeo/advanced/groups_test.rb +4 -4
- data/test/vimeo/advanced/person_test.rb +9 -8
- data/test/vimeo/advanced/test_test.rb +3 -3
- data/test/vimeo/advanced/upload_test.rb +6 -6
- data/test/vimeo/advanced/videos_embed_test.rb +6 -5
- data/test/vimeo/advanced/videos_test.rb +15 -15
- data/vimeo.gemspec +13 -11
- metadata +10 -9
- data/README.rdoc +0 -322
- data/lib/vimeo/advanced/auth.rb +0 -22
@@ -316,12 +316,7 @@
|
|
316
316
|
"id":"24036",
|
317
317
|
"is_featured":"0",
|
318
318
|
"name":"Ideas and inspiration",
|
319
|
-
"description":"All men dream,
|
320
|
-
but not all equally. Those who dream by night,
|
321
|
-
in the dusty recesss of their minds,
|
322
|
-
wake to find it was all vanity. But the dreamers of he day are dangerous,
|
323
|
-
for they act their dreams with open eyes,
|
324
|
-
and make things happen.\n\nQuote- T.E. Lawrence",
|
319
|
+
"description":"All men dream,\n but not all equally. Those who dream by night,\n in the dusty recesss of their minds,\n wake to find it was all vanity. But the dreamers of he day are dangerous,\n for they act their dreams with open eyes,\n and make things happen.\n\nQuote- T.E. Lawrence",
|
325
320
|
"created_on":"2009-09-24 16:44:21",
|
326
321
|
"modified_on":"2009-09-24 17:35:41",
|
327
322
|
"total_videos":"1",
|
@@ -563,9 +558,7 @@
|
|
563
558
|
"id":"24032",
|
564
559
|
"is_featured":"0",
|
565
560
|
"name":"Digital Video in the Classroom - EME 5623",
|
566
|
-
"description":"EME 5623 - Digital Video in the Classroom is a course in the Learning Technologies Program in the Collge of Education at Florida International University,
|
567
|
-
Miami,
|
568
|
-
FL 33199.",
|
561
|
+
"description":"EME 5623 - Digital Video in the Classroom is a course in the Learning Technologies Program in the Collge of Education at Florida International University,\n Miami,\n FL 33199.",
|
569
562
|
"created_on":"2009-09-24 16:06:33",
|
570
563
|
"modified_on":"2009-09-24 16:31:07",
|
571
564
|
"total_videos":"2",
|
@@ -810,11 +803,7 @@
|
|
810
803
|
"id":"24027",
|
811
804
|
"is_featured":"0",
|
812
805
|
"name":"Personal Finance",
|
813
|
-
"description":"Help with personal finance needs and resources like loans,
|
814
|
-
insurance,
|
815
|
-
debt,
|
816
|
-
credit,
|
817
|
-
and more.",
|
806
|
+
"description":"Help with personal finance needs and resources like loans,\n insurance,\n debt,\n credit,\n and more.",
|
818
807
|
"created_on":"2009-09-24 15:19:36",
|
819
808
|
"modified_on":"2009-09-24 15:43:50",
|
820
809
|
"total_videos":"2",
|
@@ -995,8 +984,7 @@
|
|
995
984
|
"id":"24023",
|
996
985
|
"is_featured":"0",
|
997
986
|
"name":"Dirty Tats:Interview",
|
998
|
-
"description":"An amalgamation of New Orleanians showed up to get their Free Acadiana self-reliance tatoo,
|
999
|
-
wanna know why?",
|
987
|
+
"description":"An amalgamation of New Orleanians showed up to get their Free Acadiana self-reliance tatoo,\n wanna know why?",
|
1000
988
|
"created_on":"2009-09-24 14:23:32",
|
1001
989
|
"modified_on":"2009-09-24 14:38:52",
|
1002
990
|
"total_videos":"8",
|
@@ -1057,19 +1045,7 @@
|
|
1057
1045
|
"id":"24022",
|
1058
1046
|
"is_featured":"0",
|
1059
1047
|
"name":"Coches y Motos de Lujo",
|
1060
|
-
"description":"Coches y motos de lujo: el mundo del motor,
|
1061
|
-
pasi\u00f3n por la formula 1,
|
1062
|
-
F1,
|
1063
|
-
nuevos coches,
|
1064
|
-
marcas y modelos,
|
1065
|
-
autom\u00f3viles y prototipos,
|
1066
|
-
coche y moto de lujo y deportivos. Todas las novedades de Ferrari,
|
1067
|
-
Lamborghini,
|
1068
|
-
BMW,
|
1069
|
-
Aston Martin,
|
1070
|
-
Lotus,
|
1071
|
-
Jaguar,
|
1072
|
-
Bentley... Sube tus videos y haza m\u00e1s grande esta comunidad de amantes de los coches y motos de lujo y del mundo del motor.\nParticipa en nuestro blog: www.cochesymotosdelujo.com",
|
1048
|
+
"description":"Coches y motos de lujo: el mundo del motor,\n pasi\u00f3n por la formula 1,\n F1,\n nuevos coches,\n marcas y modelos,\n autom\u00f3viles y prototipos,\n coche y moto de lujo y deportivos. Todas las novedades de Ferrari,\n Lamborghini,\n BMW,\n Aston Martin,\n Lotus,\n Jaguar,\n Bentley... Sube tus videos y haza m\u00e1s grande esta comunidad de amantes de los coches y motos de lujo y del mundo del motor.\nParticipa en nuestro blog: www.cochesymotosdelujo.com",
|
1073
1049
|
"created_on":"2009-09-24 14:12:00",
|
1074
1050
|
"modified_on":"2009-09-24 14:40:12",
|
1075
1051
|
"total_videos":"1",
|
@@ -10,8 +10,7 @@
|
|
10
10
|
"id":"20067",
|
11
11
|
"is_featured":"1",
|
12
12
|
"name":"Vimeo World Tour '09",
|
13
|
-
"description":"We're coming to Europe! For 11 days,
|
14
|
-
Karen and I will be gallivanting across the European lands to meet and greet all you fine Vimeo members and hold Vimeo Offline parties. This Group will be a place for everyone to share videos of the events and the video blog of the trip that Karen and I will be shooting.\n\nVimeo Offline: Europe\nBerlin - August 19\nParis - August 22\nLondon - August 25",
|
13
|
+
"description":"We're coming to Europe! For 11 days,\n Karen and I will be gallivanting across the European lands to meet and greet all you fine Vimeo members and hold Vimeo Offline parties. This Group will be a place for everyone to share videos of the events and the video blog of the trip that Karen and I will be shooting.\n\nVimeo Offline: Europe\nBerlin - August 19\nParis - August 22\nLondon - August 25",
|
15
14
|
"created_on":"2009-07-20 18:13:20",
|
16
15
|
"modified_on":"2009-09-23 15:55:42",
|
17
16
|
"total_videos":"10",
|
@@ -9,10 +9,7 @@
|
|
9
9
|
"event":[
|
10
10
|
{
|
11
11
|
"added_on":"2009-07-20 18:22:20",
|
12
|
-
"details":"The Lock Tavern - 35 Chalk Farm Road,
|
13
|
-
NW1 - 8PM Screening followed by A\/V insanity by Eclectic Method. Come one,
|
14
|
-
come all,
|
15
|
-
and bring your friends!",
|
12
|
+
"details":"The Lock Tavern - 35 Chalk Farm Road,\n NW1 - 8PM Screening followed by A\/V insanity by Eclectic Method. Come one,\n come all,\n and bring your friends!",
|
16
13
|
"event_start":"2009-08-25 20:00:00",
|
17
14
|
"external_url":"http:\/\/www.lock-tavern.co.uk\/index.php",
|
18
15
|
"id":"1575",
|
@@ -55,8 +52,7 @@
|
|
55
52
|
},
|
56
53
|
{
|
57
54
|
"added_on":"2009-07-20 18:21:56",
|
58
|
-
"details":"Vimeo Offline: Paris Dune 18,
|
59
|
-
AV. CLAUDE VELLEFAUX 75010 PARIS - The event will begin at 8pm with a screening of videos by Vimeo members followed by dance party and VJ performances by Charlie Mars - Vimeo.com\/charlimars ",
|
55
|
+
"details":"Vimeo Offline: Paris Dune 18,\n AV. CLAUDE VELLEFAUX 75010 PARIS - The event will begin at 8pm with a screening of videos by Vimeo members followed by dance party and VJ performances by Charlie Mars - Vimeo.com\/charlimars ",
|
60
56
|
"event_start":"2009-08-22 20:00:00",
|
61
57
|
"external_url":"http:\/\/www.e-dune.fr\/blog\/index.php\/General",
|
62
58
|
"id":"1574",
|
@@ -99,8 +95,7 @@
|
|
99
95
|
},
|
100
96
|
{
|
101
97
|
"added_on":"2009-07-20 18:21:03",
|
102
|
-
"details":"Venue: Stattbad Gallery - Gerichtstr 65 13347 Berlin,
|
103
|
-
Germany +49 30 86383155 - 9pm screening followed by a kick ass dance party with VJ performances by Raquel Meyers (www.raquelmeyers.com)",
|
98
|
+
"details":"Venue: Stattbad Gallery - Gerichtstr 65 13347 Berlin,\n Germany +49 30 86383155 - 9pm screening followed by a kick ass dance party with VJ performances by Raquel Meyers (www.raquelmeyers.com)",
|
104
99
|
"event_start":"2009-08-19 21:00:00",
|
105
100
|
"external_url":"http:\/\/www.urbanaffairs.de\/stattbad.html",
|
106
101
|
"id":"1573",
|
@@ -9,10 +9,7 @@
|
|
9
9
|
"event":[
|
10
10
|
{
|
11
11
|
"added_on":"2009-07-20 18:22:20",
|
12
|
-
"details":"The Lock Tavern - 35 Chalk Farm Road,
|
13
|
-
NW1 - 8PM Screening followed by A\/V insanity by Eclectic Method. Come one,
|
14
|
-
come all,
|
15
|
-
and bring your friends!",
|
12
|
+
"details":"The Lock Tavern - 35 Chalk Farm Road,\n NW1 - 8PM Screening followed by A\/V insanity by Eclectic Method. Come one,\n come all,\n and bring your friends!",
|
16
13
|
"event_start":"2009-08-25 20:00:00",
|
17
14
|
"external_url":"http:\/\/www.lock-tavern.co.uk\/index.php",
|
18
15
|
"id":"1575",
|
@@ -55,8 +52,7 @@
|
|
55
52
|
},
|
56
53
|
{
|
57
54
|
"added_on":"2009-07-20 18:21:56",
|
58
|
-
"details":"Vimeo Offline: Paris Dune 18,
|
59
|
-
AV. CLAUDE VELLEFAUX 75010 PARIS - The event will begin at 8pm with a screening of videos by Vimeo members followed by dance party and VJ performances by Charlie Mars - Vimeo.com\/charlimars ",
|
55
|
+
"details":"Vimeo Offline: Paris Dune 18,\n AV. CLAUDE VELLEFAUX 75010 PARIS - The event will begin at 8pm with a screening of videos by Vimeo members followed by dance party and VJ performances by Charlie Mars - Vimeo.com\/charlimars ",
|
60
56
|
"event_start":"2009-08-22 20:00:00",
|
61
57
|
"external_url":"http:\/\/www.e-dune.fr\/blog\/index.php\/General",
|
62
58
|
"id":"1574",
|
@@ -99,8 +95,7 @@
|
|
99
95
|
},
|
100
96
|
{
|
101
97
|
"added_on":"2009-07-20 18:21:03",
|
102
|
-
"details":"Venue: Stattbad Gallery - Gerichtstr 65 13347 Berlin,
|
103
|
-
Germany +49 30 86383155 - 9pm screening followed by a kick ass dance party with VJ performances by Raquel Meyers (www.raquelmeyers.com)",
|
98
|
+
"details":"Venue: Stattbad Gallery - Gerichtstr 65 13347 Berlin,\n Germany +49 30 86383155 - 9pm screening followed by a kick ass dance party with VJ performances by Raquel Meyers (www.raquelmeyers.com)",
|
104
99
|
"event_start":"2009-08-19 21:00:00",
|
105
100
|
"external_url":"http:\/\/www.urbanaffairs.de\/stattbad.html",
|
106
101
|
"id":"1573",
|
@@ -9,10 +9,7 @@
|
|
9
9
|
"event":[
|
10
10
|
{
|
11
11
|
"added_on":"2009-07-20 18:22:20",
|
12
|
-
"details":"The Lock Tavern - 35 Chalk Farm Road,
|
13
|
-
NW1 - 8PM Screening followed by A\/V insanity by Eclectic Method. Come one,
|
14
|
-
come all,
|
15
|
-
and bring your friends!",
|
12
|
+
"details":"The Lock Tavern - 35 Chalk Farm Road,\n NW1 - 8PM Screening followed by A\/V insanity by Eclectic Method. Come one,\n come all,\n and bring your friends!",
|
16
13
|
"event_start":"2009-08-25 20:00:00",
|
17
14
|
"external_url":"http:\/\/www.lock-tavern.co.uk\/index.php",
|
18
15
|
"id":"1575",
|
@@ -55,8 +52,7 @@
|
|
55
52
|
},
|
56
53
|
{
|
57
54
|
"added_on":"2009-07-20 18:21:56",
|
58
|
-
"details":"Vimeo Offline: Paris Dune 18,
|
59
|
-
AV. CLAUDE VELLEFAUX 75010 PARIS - The event will begin at 8pm with a screening of videos by Vimeo members followed by dance party and VJ performances by Charlie Mars - Vimeo.com\/charlimars ",
|
55
|
+
"details":"Vimeo Offline: Paris Dune 18,\n AV. CLAUDE VELLEFAUX 75010 PARIS - The event will begin at 8pm with a screening of videos by Vimeo members followed by dance party and VJ performances by Charlie Mars - Vimeo.com\/charlimars ",
|
60
56
|
"event_start":"2009-08-22 20:00:00",
|
61
57
|
"external_url":"http:\/\/www.e-dune.fr\/blog\/index.php\/General",
|
62
58
|
"id":"1574",
|
@@ -99,8 +95,7 @@
|
|
99
95
|
},
|
100
96
|
{
|
101
97
|
"added_on":"2009-07-20 18:21:03",
|
102
|
-
"details":"Venue: Stattbad Gallery - Gerichtstr 65 13347 Berlin,
|
103
|
-
Germany +49 30 86383155 - 9pm screening followed by a kick ass dance party with VJ performances by Raquel Meyers (www.raquelmeyers.com)",
|
98
|
+
"details":"Venue: Stattbad Gallery - Gerichtstr 65 13347 Berlin,\n Germany +49 30 86383155 - 9pm screening followed by a kick ass dance party with VJ performances by Raquel Meyers (www.raquelmeyers.com)",
|
104
99
|
"event_start":"2009-08-19 21:00:00",
|
105
100
|
"external_url":"http:\/\/www.urbanaffairs.de\/stattbad.html",
|
106
101
|
"id":"1573",
|
@@ -181,9 +181,7 @@
|
|
181
181
|
"permalink":"http:\/\/vimeo.com\/groups\/worldtour\/forumthread:7953#comment_1908418",
|
182
182
|
"reply_to_comment_id":"1908418",
|
183
183
|
"type":"group_forum_topic",
|
184
|
-
"text":"Also,
|
185
|
-
I only just noticed,
|
186
|
-
my video is in the London album?!\nhttp:\/\/vimeo.com\/album\/117909\nDid you show it? I totally missed it!\nmust have been when I went to the loo...\n:\/",
|
184
|
+
"text":"Also,\n I only just noticed,\n my video is in the London album?!\nhttp:\/\/vimeo.com\/album\/117909\nDid you show it? I totally missed it!\nmust have been when I went to the loo...\n:\/",
|
187
185
|
"author":{
|
188
186
|
"display_name":"Andy Galletly",
|
189
187
|
"id":"126630",
|
@@ -220,9 +220,7 @@
|
|
220
220
|
"is_hd":"0",
|
221
221
|
"owner":"1425268",
|
222
222
|
"privacy":"anybody",
|
223
|
-
"title":"Winne,
|
224
|
-
Lotto,
|
225
|
-
Crimson e.a. @ Vitamine E (Radioshow)",
|
223
|
+
"title":"Winne,\n Lotto,\n Crimson e.a. @ Vitamine E (Radioshow)",
|
226
224
|
"upload_date":"2009-04-10 07:33:04"
|
227
225
|
},
|
228
226
|
{
|
@@ -22,9 +22,7 @@
|
|
22
22
|
"is_hd":"1",
|
23
23
|
"owner":"583797",
|
24
24
|
"privacy":"anybody",
|
25
|
-
"title":"[
|
26
|
-
critics
|
27
|
-
] - Webisode 3",
|
25
|
+
"title":"[\n critics \n ] - Webisode 3",
|
28
26
|
"upload_date":"2009-09-22 11:36:40"
|
29
27
|
},
|
30
28
|
{
|
@@ -96,8 +94,7 @@
|
|
96
94
|
"is_hd":"1",
|
97
95
|
"owner":"405808",
|
98
96
|
"privacy":"anybody",
|
99
|
-
"title":"Suddenly,
|
100
|
-
last summer",
|
97
|
+
"title":"Suddenly,\nlast summer",
|
101
98
|
"upload_date":"2009-09-16 00:52:58"
|
102
99
|
},
|
103
100
|
{
|
@@ -187,8 +184,7 @@
|
|
187
184
|
"is_hd":"1",
|
188
185
|
"owner":"2288067",
|
189
186
|
"privacy":"anybody",
|
190
|
-
"title":"Bottled Water,
|
191
|
-
photographs by James Worrell",
|
187
|
+
"title":"Bottled Water,\n photographs by James Worrell",
|
192
188
|
"upload_date":"2009-09-11 11:23:49"
|
193
189
|
},
|
194
190
|
{
|
data/test/test_helper.rb
CHANGED
@@ -27,12 +27,16 @@ def fixture_file(filename)
|
|
27
27
|
File.read(file_path)
|
28
28
|
end
|
29
29
|
|
30
|
-
def
|
31
|
-
"http://vimeo.com
|
30
|
+
def vimeo_base_url(url = "/")
|
31
|
+
"http://vimeo.com#{url}"
|
32
32
|
end
|
33
33
|
|
34
|
-
def
|
35
|
-
"
|
34
|
+
def vimeo_url(url = "")
|
35
|
+
vimeo_base_url("/api/v2#{url}")
|
36
|
+
end
|
37
|
+
|
38
|
+
def advanced_vimeo_url(url = "")
|
39
|
+
vimeo_base_url("/api/rest/v2#{url}")
|
36
40
|
end
|
37
41
|
|
38
42
|
def stub_get(url, filename, status=nil)
|
@@ -41,10 +45,17 @@ def stub_get(url, filename, status=nil)
|
|
41
45
|
# of using FakeWeb?
|
42
46
|
options = { :body => fixture_file(filename), :content_type => 'application/json' }
|
43
47
|
options.merge!({:status => status}) unless status.nil?
|
44
|
-
|
45
48
|
FakeWeb.register_uri(:get, vimeo_url(url), options)
|
46
49
|
end
|
47
50
|
|
48
51
|
def stub_post(url, filename)
|
49
|
-
FakeWeb.register_uri(:post, advanced_vimeo_url
|
52
|
+
FakeWeb.register_uri(:post, advanced_vimeo_url, :body => fixture_file(filename), :content_type => 'application/json')
|
53
|
+
end
|
54
|
+
|
55
|
+
def stub_custom_get(url, filename)
|
56
|
+
FakeWeb.register_uri(:get, vimeo_base_url(url), :body => fixture_file(filename), :content_type => 'application/json')
|
57
|
+
end
|
58
|
+
|
59
|
+
def stub_custom_post(url, filename)
|
60
|
+
FakeWeb.register_uri(:post, vimeo_base_url(url), :body => fixture_file(filename), :content_type => 'application/json')
|
50
61
|
end
|
@@ -5,84 +5,71 @@ class AlbumTest < Test::Unit::TestCase
|
|
5
5
|
context "vimeo advanced album" do
|
6
6
|
|
7
7
|
setup do
|
8
|
-
@album = Vimeo::Advanced::Album.new("12345", "secret")
|
8
|
+
@album = Vimeo::Advanced::Album.new("12345", "secret", :token => "token", :secret => "secret")
|
9
9
|
end
|
10
10
|
|
11
|
-
|
11
|
+
should "be able to add a video to an album" do
|
12
|
+
stub_custom_post("?oauth_nonce=3MFt5up5QljUQKJS8u9bOPzX9DXn3Xll1vdLLV2bwo&oauth_signature_method=HMAC-SHA1&oauth_token=token&oauth_timestamp=1261345197&oauth_consumer_key=12345&oauth_version=1.0&oauth_signature=SgRuPWsG%2BSHGOdw6HVbfHtqSXsY%3D", "advanced/album/add_video.json")
|
13
|
+
response = @album.add_video("album_id", "video_id")
|
12
14
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
end
|
15
|
+
assert_equal "ok", response["stat"]
|
16
|
+
end
|
17
|
+
|
18
|
+
should "be able to create an album" do
|
19
|
+
stub_post("?oauth_nonce=UkAfw5mrHZ2RiYl85vBxd9dGlpdOB1HiMs7ZXa7YGE&oauth_signature_method=HMAC-SHA1&oauth_token=token&oauth_timestamp=1261345197&oauth_consumer_key=12345&oauth_version=1.0&oauth_signature=ZTGMAKrk4voVelv9Hzu2XzwlKbo%3D", "advanced/album/create.json")
|
20
|
+
response = @album.create("title", "video_id")
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
end
|
22
|
+
assert_equal "129683", response["album"]["id"]
|
23
|
+
end
|
24
|
+
|
25
|
+
should "be able to delete an album" do
|
26
|
+
stub_post("?oauth_nonce=zyARBYynTJnBn9HiiKTQAGRVuDymj5kUkH72JPE9IBE&oauth_signature_method=HMAC-SHA1&oauth_token=token&oauth_timestamp=1261345197&oauth_consumer_key=12345&oauth_version=1.0&oauth_signature=14SAeavDzDfbO6XY%2Bd4a05kJGGs%3D", "advanced/album/delete.json")
|
27
|
+
response = @album.delete("album_id")
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
end
|
29
|
+
assert_equal "ok", response["stat"]
|
30
|
+
end
|
31
|
+
|
32
|
+
should "be able to get a list of a user's albums" do
|
33
|
+
stub_post("?oauth_nonce=4wZJ82yZnNtdnu4ccKaxBpAnyDLvf9xfiH4RrgRgK8o&oauth_signature_method=HMAC-SHA1&oauth_token=token&oauth_timestamp=1261345197&oauth_consumer_key=12345&oauth_version=1.0&oauth_signature=KDczd%2F%2BEjPW64v0r6IbYL%2BJYcYs%3D", "advanced/album/get_all.json")
|
34
|
+
response = @album.get_all("user_id")
|
36
35
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
end
|
36
|
+
assert_equal "3", response["albums"]["total"]
|
37
|
+
end
|
38
|
+
|
39
|
+
should "be able to list the videos in an album" do
|
40
|
+
stub_post("?oauth_nonce=yCIHyp8VXtFtxVzuKwMbHMwV7Z2eqKxDEeRTgOkwc&oauth_signature_method=HMAC-SHA1&oauth_token=token&oauth_timestamp=1261345197&oauth_consumer_key=12345&oauth_version=1.0&oauth_signature=TwPJGzgvrYB4vOzyUKJueNTLMcI%3D", "advanced/album/get_videos.json")
|
41
|
+
response = @album.get_videos("album_id")
|
44
42
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
end
|
43
|
+
assert_equal "2", response["videos"]["total"]
|
44
|
+
end
|
45
|
+
|
46
|
+
should "be able to remove a video from an album" do
|
47
|
+
stub_post("?oauth_nonce=fKXbUdxBFZoynegg9zzE0DS0AzhaHcNcOclSEo0&oauth_signature_method=HMAC-SHA1&oauth_token=token&oauth_timestamp=1261345197&oauth_consumer_key=12345&oauth_version=1.0&oauth_signature=tztcS72SjTJxyioP3JN7KgQVUSI%3D", "advanced/album/remove_video.json")
|
48
|
+
response = @album.remove_video("album_id", "video_id")
|
52
49
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
end
|
50
|
+
assert_equal "ok", response["stat"]
|
51
|
+
end
|
52
|
+
|
53
|
+
should "be able to set the description of an album" do
|
54
|
+
stub_post("?oauth_nonce=45zc84rri7doHXSDHtk5w3nDpfVU8EIj3do8z23tld8&oauth_signature_method=HMAC-SHA1&oauth_token=token&oauth_timestamp=1261345197&oauth_consumer_key=12345&oauth_version=1.0&oauth_signature=xTB0pnxTlZsr1P42cpfFZ50EnkA%3D", "advanced/album/set_description.json")
|
55
|
+
response = @album.set_description("album_id", "description")
|
60
56
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
end
|
57
|
+
assert_equal "ok", response["stat"]
|
58
|
+
end
|
59
|
+
|
60
|
+
should "be able to set the password of an album" do
|
61
|
+
stub_post("?oauth_nonce=ctucSZ9WBeP6lkmcmjT8tEmvQu5AJS7K5OZReGSzMk&oauth_signature_method=HMAC-SHA1&oauth_token=token&oauth_timestamp=1261345197&oauth_consumer_key=12345&oauth_version=1.0&oauth_signature=7YcUkFMRryJAYRZGpBj47JFoFsQ%3D", "advanced/album/set_password.json")
|
62
|
+
response = @album.set_password("album_id", "password")
|
68
63
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
end
|
64
|
+
assert_equal "ok", response["stat"]
|
65
|
+
end
|
66
|
+
|
67
|
+
should "be able to set the title of an album" do
|
68
|
+
stub_post("?oauth_nonce=nqVTjX53HqEvBR43v2qloK90TBJHbU7N7SdlisWHNGk&oauth_signature_method=HMAC-SHA1&oauth_token=token&oauth_timestamp=1261345197&oauth_consumer_key=12345&oauth_version=1.0&oauth_signature=CpnakG4IBSfugNsi%2FUeVSN9zGu0%3D", "advanced/album/set_title.json")
|
69
|
+
response = @album.set_title("album_id", "title")
|
76
70
|
|
77
|
-
|
78
|
-
|
79
|
-
stub_post("?album_id=album_id&api_key=12345&auth_token=token&api_sig=b4e72980c9c6aacabdd341cb0bf535ba&format=json&title=title&method=vimeo.albums.setTitle", "advanced/album/set_title.json")
|
80
|
-
response = @album.set_title("token", "album_id", "title")
|
81
|
-
|
82
|
-
assert_equal "ok", response["stat"]
|
83
|
-
end
|
71
|
+
assert_equal "ok", response["stat"]
|
72
|
+
end
|
84
73
|
|
85
|
-
# end
|
86
|
-
|
87
74
|
end
|
88
75
|
end
|
@@ -2,35 +2,27 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
class AuthTest < Test::Unit::TestCase
|
4
4
|
|
5
|
-
|
5
|
+
TOKEN = "12345"
|
6
|
+
SECRET = "secret"
|
7
|
+
|
8
|
+
context "vimeo advanced" do
|
6
9
|
|
7
10
|
setup do
|
8
|
-
@auth = Vimeo::Advanced::
|
11
|
+
@auth = Vimeo::Advanced::Base.new(TOKEN, SECRET)
|
9
12
|
end
|
10
13
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
assert_equal "frob", frob["frob"]
|
25
|
-
end
|
26
|
-
|
27
|
-
should "get an auth token" do
|
28
|
-
stub_post("?format=json&frob=frob&api_key=12345&method=vimeo.auth.getToken&api_sig=4f60bcf463619418baa3d97ba900f083", "advanced/auth/get_token.json")
|
29
|
-
auth = @auth.get_token("frob")
|
30
|
-
|
31
|
-
assert_equal "token", auth["auth"]["token"]
|
32
|
-
end
|
33
|
-
|
14
|
+
should "recieve a valid OAuth url" do
|
15
|
+
stub_custom_post("/oauth/request_token", "advanced/auth/request_token.txt")
|
16
|
+
token = @auth.request_token
|
17
|
+
assert_equal true, token.callback_confirmed?
|
18
|
+
assert_equal "http://vimeo.com/oauth/authorize?oauth_token=#{TOKEN}", token.authorize_url
|
19
|
+
end
|
20
|
+
|
21
|
+
should "receive the user's credentials after checking the OAuth token" do
|
22
|
+
stub_post("", "advanced/auth/check_access_token.json")
|
23
|
+
auth = @auth.check_access_token
|
24
|
+
assert_equal "token", auth["token"]
|
25
|
+
assert_equal "write", auth["permission"]
|
34
26
|
end
|
35
27
|
|
36
28
|
end
|