vimeo 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. data/.gitignore +3 -0
  2. data/CHANGELOG.rdoc +24 -0
  3. data/LICENSE +20 -0
  4. data/README.rdoc +322 -0
  5. data/Rakefile +68 -0
  6. data/VERSION.yml +4 -0
  7. data/lib/vimeo/advanced/album.rb +57 -0
  8. data/lib/vimeo/advanced/auth.rb +22 -0
  9. data/lib/vimeo/advanced/base.rb +105 -0
  10. data/lib/vimeo/advanced/channel.rb +58 -0
  11. data/lib/vimeo/advanced/contact.rb +31 -0
  12. data/lib/vimeo/advanced/group.rb +68 -0
  13. data/lib/vimeo/advanced/group_events.rb +25 -0
  14. data/lib/vimeo/advanced/group_forums.rb +19 -0
  15. data/lib/vimeo/advanced/person.rb +48 -0
  16. data/lib/vimeo/advanced/test.rb +36 -0
  17. data/lib/vimeo/advanced/upload.rb +62 -0
  18. data/lib/vimeo/advanced/video.rb +131 -0
  19. data/lib/vimeo/advanced/video_embed.rb +19 -0
  20. data/lib/vimeo/advanced.rb +20 -0
  21. data/lib/vimeo/simple/activity.rb +42 -0
  22. data/lib/vimeo/simple/album.rb +21 -0
  23. data/lib/vimeo/simple/base.rb +10 -0
  24. data/lib/vimeo/simple/channel.rb +21 -0
  25. data/lib/vimeo/simple/group.rb +28 -0
  26. data/lib/vimeo/simple/user.rb +84 -0
  27. data/lib/vimeo/simple/video.rb +14 -0
  28. data/lib/vimeo/simple.rb +14 -0
  29. data/lib/vimeo.rb +10 -0
  30. data/test/fixtures/advanced/album/add_video.json +4 -0
  31. data/test/fixtures/advanced/album/create.json +7 -0
  32. data/test/fixtures/advanced/album/delete.json +4 -0
  33. data/test/fixtures/advanced/album/get_all.json +111 -0
  34. data/test/fixtures/advanced/album/get_videos.json +30 -0
  35. data/test/fixtures/advanced/album/remove_video.json +4 -0
  36. data/test/fixtures/advanced/album/set_description.json +4 -0
  37. data/test/fixtures/advanced/album/set_password.json +4 -0
  38. data/test/fixtures/advanced/album/set_title.json +4 -0
  39. data/test/fixtures/advanced/auth/check_token.json +13 -0
  40. data/test/fixtures/advanced/auth/get_frob.json +5 -0
  41. data/test/fixtures/advanced/auth/get_token.json +13 -0
  42. data/test/fixtures/advanced/channel/add_video.json +4 -0
  43. data/test/fixtures/advanced/channel/get_all.json +1395 -0
  44. data/test/fixtures/advanced/channel/get_info.json +55 -0
  45. data/test/fixtures/advanced/channel/get_moderators.json +45 -0
  46. data/test/fixtures/advanced/channel/get_subscribers.json +44 -0
  47. data/test/fixtures/advanced/channel/get_videos.json +19 -0
  48. data/test/fixtures/advanced/channel/remove_video.json +4 -0
  49. data/test/fixtures/advanced/channel/subscribe.json +4 -0
  50. data/test/fixtures/advanced/channel/unsubscribe.json +4 -0
  51. data/test/fixtures/advanced/contact/get_all.json +117 -0
  52. data/test/fixtures/advanced/contact/get_mutual.json +80 -0
  53. data/test/fixtures/advanced/contact/get_online.json +47 -0
  54. data/test/fixtures/advanced/contact/get_who_added.json +117 -0
  55. data/test/fixtures/advanced/group/add_video.json +4 -0
  56. data/test/fixtures/advanced/group/get_all.json +1556 -0
  57. data/test/fixtures/advanced/group/get_files.json +255 -0
  58. data/test/fixtures/advanced/group/get_info.json +73 -0
  59. data/test/fixtures/advanced/group/get_members.json +862 -0
  60. data/test/fixtures/advanced/group/get_moderators.json +44 -0
  61. data/test/fixtures/advanced/group/get_video_comments.json +96 -0
  62. data/test/fixtures/advanced/group/get_videos.json +102 -0
  63. data/test/fixtures/advanced/group/join.json +4 -0
  64. data/test/fixtures/advanced/group/leave.json +4 -0
  65. data/test/fixtures/advanced/group_events/get_month.json +146 -0
  66. data/test/fixtures/advanced/group_events/get_past.json +146 -0
  67. data/test/fixtures/advanced/group_events/get_upcoming.json +146 -0
  68. data/test/fixtures/advanced/group_forums/get_topic_comments.json +224 -0
  69. data/test/fixtures/advanced/group_forums/get_topics.json +504 -0
  70. data/test/fixtures/advanced/person/add_contact.json +4 -0
  71. data/test/fixtures/advanced/person/add_subscription.json +4 -0
  72. data/test/fixtures/advanced/person/find_by_email.json +9 -0
  73. data/test/fixtures/advanced/person/get_hd_embeds.json +8 -0
  74. data/test/fixtures/advanced/person/get_info.json +21 -0
  75. data/test/fixtures/advanced/person/get_portrait_urls.json +28 -0
  76. data/test/fixtures/advanced/person/remove_contact.json +4 -0
  77. data/test/fixtures/advanced/person/remove_subscription.json +4 -0
  78. data/test/fixtures/advanced/test/echo.json +8 -0
  79. data/test/fixtures/advanced/test/login.json +8 -0
  80. data/test/fixtures/advanced/test/null.json +4 -0
  81. data/test/fixtures/advanced/upload/confirm.json +9 -0
  82. data/test/fixtures/advanced/upload/get_quota.json +16 -0
  83. data/test/fixtures/advanced/upload/get_ticket.json +8 -0
  84. data/test/fixtures/advanced/upload/manifest_to_upload.json +6 -0
  85. data/test/fixtures/advanced/upload/sample_iTunes.mov +0 -0
  86. data/test/fixtures/advanced/upload/verify_manifest.json +11 -0
  87. data/test/fixtures/advanced/video/add_cast.json +4 -0
  88. data/test/fixtures/advanced/video/add_comment.json +7 -0
  89. data/test/fixtures/advanced/video/add_photos.json +4 -0
  90. data/test/fixtures/advanced/video/add_tags.json +4 -0
  91. data/test/fixtures/advanced/video/clear_tags.json +4 -0
  92. data/test/fixtures/advanced/video/delete.json +4 -0
  93. data/test/fixtures/advanced/video/delete_comment.json +4 -0
  94. data/test/fixtures/advanced/video/edit_comment.json +4 -0
  95. data/test/fixtures/advanced/video/get_all.json +30 -0
  96. data/test/fixtures/advanced/video/get_appears_in.json +10 -0
  97. data/test/fixtures/advanced/video/get_by_tag.json +239 -0
  98. data/test/fixtures/advanced/video/get_cast.json +42 -0
  99. data/test/fixtures/advanced/video/get_comments_list.json +52 -0
  100. data/test/fixtures/advanced/video/get_contacts_liked.json +48 -0
  101. data/test/fixtures/advanced/video/get_contacts_uploaded.json +237 -0
  102. data/test/fixtures/advanced/video/get_info.json +246 -0
  103. data/test/fixtures/advanced/video/get_likes.json +32 -0
  104. data/test/fixtures/advanced/video/get_subscriptions.json +241 -0
  105. data/test/fixtures/advanced/video/get_thumbnail_urls.json +28 -0
  106. data/test/fixtures/advanced/video/get_uploaded.json +30 -0
  107. data/test/fixtures/advanced/video/remove_cast.json +4 -0
  108. data/test/fixtures/advanced/video/remove_tag.json +4 -0
  109. data/test/fixtures/advanced/video/search.json +238 -0
  110. data/test/fixtures/advanced/video/set_description.json +4 -0
  111. data/test/fixtures/advanced/video/set_like.json +4 -0
  112. data/test/fixtures/advanced/video/set_privacy.json +4 -0
  113. data/test/fixtures/advanced/video/set_title.json +4 -0
  114. data/test/fixtures/advanced/video_embed/get_presets.json +8 -0
  115. data/test/fixtures/advanced/video_embed/set_preset.json +4 -0
  116. data/test/fixtures/simple/activity/contacts_did.json +1 -0
  117. data/test/fixtures/simple/activity/everyone_did.json +1 -0
  118. data/test/fixtures/simple/activity/happened_to_contacts.json +1 -0
  119. data/test/fixtures/simple/activity/happened_to_user.json +1 -0
  120. data/test/fixtures/simple/activity/user_did.json +1 -0
  121. data/test/fixtures/simple/album/info.json +1 -0
  122. data/test/fixtures/simple/album/videos.json +1 -0
  123. data/test/fixtures/simple/channel/info.json +1 -0
  124. data/test/fixtures/simple/channel/videos.json +1 -0
  125. data/test/fixtures/simple/group/info.json +1 -0
  126. data/test/fixtures/simple/group/users.json +1 -0
  127. data/test/fixtures/simple/group/videos.json +1 -0
  128. data/test/fixtures/simple/user/albums.json +1 -0
  129. data/test/fixtures/simple/user/all_videos.json +1 -0
  130. data/test/fixtures/simple/user/appears_in.json +1 -0
  131. data/test/fixtures/simple/user/channels.json +1 -0
  132. data/test/fixtures/simple/user/contacts_like.json +1 -0
  133. data/test/fixtures/simple/user/contacts_videos.json +1 -0
  134. data/test/fixtures/simple/user/groups.json +1 -0
  135. data/test/fixtures/simple/user/info.json +1 -0
  136. data/test/fixtures/simple/user/likes.json +1 -0
  137. data/test/fixtures/simple/user/subscriptions.json +1 -0
  138. data/test/fixtures/simple/user/videos.json +1 -0
  139. data/test/fixtures/simple/video/info.json +1 -0
  140. data/test/test_helper.rb +50 -0
  141. data/test/vimeo/advanced/album_test.rb +88 -0
  142. data/test/vimeo/advanced/auth_test.rb +37 -0
  143. data/test/vimeo/advanced/base_test.rb +24 -0
  144. data/test/vimeo/advanced/channels_test.rb +79 -0
  145. data/test/vimeo/advanced/contacts_test.rb +40 -0
  146. data/test/vimeo/advanced/group_events_test.rb +33 -0
  147. data/test/vimeo/advanced/group_forums_test.rb +26 -0
  148. data/test/vimeo/advanced/groups_test.rb +82 -0
  149. data/test/vimeo/advanced/person_test.rb +68 -0
  150. data/test/vimeo/advanced/test_test.rb +33 -0
  151. data/test/vimeo/advanced/upload_test.rb +50 -0
  152. data/test/vimeo/advanced/videos_embed_test.rb +26 -0
  153. data/test/vimeo/advanced/videos_test.rb +203 -0
  154. data/test/vimeo/advanced_test.rb +0 -0
  155. data/test/vimeo/simple/activity_test.rb +60 -0
  156. data/test/vimeo/simple/album_test.rb +31 -0
  157. data/test/vimeo/simple/channel_test.rb +31 -0
  158. data/test/vimeo/simple/group_test.rb +41 -0
  159. data/test/vimeo/simple/user_test.rb +112 -0
  160. data/test/vimeo/simple/video_test.rb +22 -0
  161. data/test/vimeo/simple_test.rb +0 -0
  162. data/test/vimeo_test.rb +0 -0
  163. data/vimeo.gemspec +244 -0
  164. metadata +303 -0
@@ -0,0 +1,40 @@
1
+ require 'test_helper'
2
+
3
+ class ContactTest < Test::Unit::TestCase
4
+
5
+ context "vimeo advanced channel" do
6
+
7
+ setup do
8
+ @contact = Vimeo::Advanced::Contact.new("12345", "secret")
9
+ end
10
+
11
+ should "be able to get a list of contacts for a specified user" do
12
+ stub_post("?api_key=12345&api_sig=09ce758b4a0c53840fe5bcb2676219da&format=json&user_id=matthooks&method=vimeo.contacts.getAll", "advanced/contact/get_all.json")
13
+ response = @contact.get_all("matthooks")
14
+
15
+ assert_equal "3", response["contacts"]["total"]
16
+ end
17
+
18
+ should "be able to get a list of mutual contacts for a specified user" do
19
+ stub_post("?api_key=12345&api_sig=6efaa075604a7274d396f9e108eb7589&format=json&user_id=matthooks&method=vimeo.contacts.getMutual", "advanced/contact/get_mutual.json")
20
+ response = @contact.get_mutual("matthooks")
21
+
22
+ assert_equal "2", response["contacts"]["total"]
23
+ end
24
+
25
+ should "be able to get a list of the user's contacts who are currently online" do
26
+ stub_post("?api_key=12345&api_sig=2218151ed4ed65cbf35c48bd041b663c&format=json&method=vimeo.contacts.getOnline", "advanced/contact/get_online.json")
27
+ response = @contact.get_online
28
+
29
+ assert_equal "1", response["contacts"]["total"]
30
+ end
31
+
32
+ should "be able to get a list of the users who have added a specific user as a contact" do
33
+ stub_post("?api_key=12345&api_sig=ecb3d220d66c3d0b9e357c59e2ae622f&format=json&user_id=matthooks&method=vimeo.contacts.getWhoAdded", "advanced/contact/get_who_added.json")
34
+ response = @contact.get_who_added("matthooks")
35
+
36
+ assert_equal "3", response["contacts"]["total"]
37
+ end
38
+
39
+ end
40
+ end
@@ -0,0 +1,33 @@
1
+ require 'test_helper'
2
+
3
+ class GroupEventsTest < Test::Unit::TestCase
4
+
5
+ context "vimeo advanced group events" do
6
+
7
+ setup do
8
+ @group_events = Vimeo::Advanced::GroupEvents.new("12345", "secret")
9
+ end
10
+
11
+ should "be able to get a list of events by month" do
12
+ stub_post("?api_key=12345&group_id=worldtour&format=json&method=vimeo.groups.events.getMonth&api_sig=8d02a348670d7e72ec1c2bd5bee76b10", "advanced/group_events/get_month.json")
13
+ response = @group_events.get_month("worldtour")
14
+
15
+ assert_equal "3", response["events"]["total"]
16
+ end
17
+
18
+ should "be able to get a list of events past" do
19
+ stub_post("?api_key=12345&group_id=worldtour&format=json&method=vimeo.groups.events.getPast&api_sig=51807614d2ffda7e04d13a015b2757d4", "advanced/group_events/get_past.json")
20
+ response = @group_events.get_past("worldtour")
21
+
22
+ assert_equal "3", response["events"]["total"]
23
+ end
24
+
25
+ should "be able to get a list of events upcoming" do
26
+ stub_post("?api_key=12345&group_id=worldtour&format=json&method=vimeo.groups.events.getUpcoming&api_sig=17035db6a6f58e6c1370ee876bf71c70", "advanced/group_events/get_upcoming.json")
27
+ response = @group_events.get_upcoming("worldtour")
28
+
29
+ assert_equal "3", response["events"]["total"]
30
+ end
31
+
32
+ end
33
+ end
@@ -0,0 +1,26 @@
1
+ require 'test_helper'
2
+
3
+ class GroupForumsTest < Test::Unit::TestCase
4
+
5
+ context "vimeo advanced group events" do
6
+
7
+ setup do
8
+ @group_forums = Vimeo::Advanced::GroupForums.new("12345", "secret")
9
+ end
10
+
11
+ should "be able to get a list comments for a group forum topic" do
12
+ stub_post("?api_key=12345&topic_id=topic_id&group_id=group_id&format=json&method=vimeo.groups.forums.getTopicComments&api_sig=920d90a99e5af12339865b07314e2f49", "advanced/group_forums/get_topic_comments.json")
13
+ response = @group_forums.get_topic_comments("group_id", "topic_id")
14
+
15
+ assert_equal "5", response["comments"]["total"]
16
+ end
17
+
18
+ should "be able to get a list of group forum topics" do
19
+ stub_post("?api_key=12345&group_id=group_id&format=json&method=vimeo.groups.forums.getTopics&api_sig=23ac4e1deac83f0ef175a8f4fdaf32a2", "advanced/group_forums/get_topics.json")
20
+ response = @group_forums.get_topics("group_id")
21
+
22
+ assert_equal "12", response["topics"]["total"]
23
+ end
24
+
25
+ end
26
+ end
@@ -0,0 +1,82 @@
1
+ require 'test_helper'
2
+
3
+ class GroupTest < Test::Unit::TestCase
4
+
5
+ context "vimeo advanced group" do
6
+
7
+ setup do
8
+ @group = Vimeo::Advanced::Group.new("12345", "secret")
9
+ end
10
+
11
+ should "be able to add a video to a group" do
12
+ stub_post("?video_id=video_id&api_key=12345&auth_token=token&format=json&api_sig=e37ae534be5b03cdc1cb9ed28ed99317&method=vimeo.groups.addVideo&group_id=group_id", "advanced/group/add_video.json")
13
+ response = @group.add_video("token", "group_id", "video_id")
14
+
15
+ assert_equal "ok", response["stat"]
16
+ end
17
+
18
+ should "be able to get all public groups" do
19
+ stub_post("?api_key=12345&api_sig=d3b21ed184e1924c31b2db6e7253adb0&format=json&method=vimeo.groups.getAll", "advanced/group/get_all.json")
20
+ response = @group.get_all
21
+
22
+ assert_equal "20619", response["groups"]["total"]
23
+ end
24
+
25
+ should "be able to get all files for a group" do
26
+ stub_post("?api_key=12345&api_sig=a6fe673f65e0f4549c095e115e7cf853&format=json&group_id=group_id&method=vimeo.groups.getFiles", "advanced/group/get_files.json")
27
+ response = @group.get_files("group_id")
28
+
29
+ assert_equal "6", response["files"]["total"]
30
+ end
31
+
32
+ should "be able to get information about a group" do
33
+ stub_post("?api_key=12345&api_sig=ae2c232bc3543549a9f036bc1ad61724&format=json&group_id=group_id&method=vimeo.groups.getInfo", "advanced/group/get_info.json")
34
+ response = @group.get_info("group_id")
35
+
36
+ assert_equal "1", response["groups"]["total"]
37
+ end
38
+
39
+ should "be able to get the members of a group" do
40
+ stub_post("?api_key=12345&api_sig=c0b30f51a88dcc1ad951019c23cd114f&format=json&group_id=group_id&method=vimeo.groups.getMembers", "advanced/group/get_members.json")
41
+ response = @group.get_members("group_id")
42
+
43
+ assert_equal "418", response["members"]["total"]
44
+ end
45
+
46
+ should "be able to get the moderators of a group" do
47
+ stub_post("?api_key=12345&api_sig=21798438b1718d7f51ea2b40c72f5f69&format=json&group_id=group_id&method=vimeo.groups.getModerators", "advanced/group/get_moderators.json")
48
+ response = @group.get_moderators("group_id")
49
+
50
+ assert_equal "1", response["moderators"]["total"]
51
+ end
52
+
53
+ should "be able to get the video comments of a group's video" do
54
+ stub_post("?api_key=12345&api_sig=502274981e673cc19a9fb2561a13d572&format=json&group_id=group_id&method=vimeo.groups.getVideoComments&video_id=video_id", "advanced/group/get_video_comments.json")
55
+ response = @group.get_video_comments("group_id", "video_id")
56
+
57
+ assert_equal "2", response["comments"]["total"]
58
+ end
59
+
60
+ should "be able to get a list of a group's videos" do
61
+ stub_post("?api_key=12345&api_sig=4927ef1c0a49069020d6ae6ce8c98683&format=json&group_id=group_id&method=vimeo.groups.getVideos", "advanced/group/get_videos.json")
62
+ response = @group.get_videos("group_id")
63
+
64
+ assert_equal "10", response["videos"]["total"]
65
+ end
66
+
67
+ should "be able to join a group" do
68
+ stub_post("?api_key=12345&auth_token=token&format=json&api_sig=99114c85438cb286adbfba05a1b921ed&method=vimeo.groups.join&group_id=group_id", "advanced/group/join.json")
69
+ response = @group.join("token", "group_id")
70
+
71
+ assert_equal "ok", response["stat"]
72
+ end
73
+
74
+ should "be able to leave a group" do
75
+ stub_post("?api_key=12345&auth_token=token&format=json&api_sig=a465333190c89f9eedc06a148db018be&method=vimeo.groups.leave&group_id=group_id", "advanced/group/leave.json")
76
+ response = @group.leave("token", "group_id")
77
+
78
+ assert_equal "ok", response["stat"]
79
+ end
80
+
81
+ end
82
+ end
@@ -0,0 +1,68 @@
1
+ require 'test_helper'
2
+
3
+ class PersonTest < Test::Unit::TestCase
4
+
5
+ context "vimeo advanced person" do
6
+
7
+ setup do
8
+ @person = Vimeo::Advanced::Person.new("12345", "secret")
9
+ end
10
+
11
+ should "be able to add a contact" do
12
+ stub_post("?api_key=12345&auth_token=token&format=json&api_sig=da78079bb036f66f6ccca31014650371&method=vimeo.people.addContact&user_id=user_id", "advanced/person/add_contact.json")
13
+ response = @person.add_contact("token", "user_id")
14
+
15
+ assert_equal "ok", response["stat"]
16
+ end
17
+
18
+ should "be able to get add a subscription" do
19
+ stub_post("?api_key=12345&types=likes&auth_token=token&format=json&api_sig=f02dae35e4eb7a7e2ca0ad9c026ad311&method=vimeo.people.addSubscription&user_id=user_id", "advanced/person/add_subscription.json")
20
+ response = @person.add_subscription("token", "user_id", "likes")
21
+
22
+ assert_equal "ok", response["stat"]
23
+ end
24
+
25
+ should "be able to find a user by email" do
26
+ stub_post("?api_key=12345&format=json&api_sig=1b772e7074bffdff17fa94a310e6b496&method=vimeo.people.findByEmail&user_id=email", "advanced/person/find_by_email.json")
27
+ response = @person.find_by_email("email")
28
+
29
+ assert_equal "matthooks", response["user"]["username"]
30
+ end
31
+
32
+ should "be able to get the remaining number of hd embeds" do
33
+ stub_post("?api_key=12345&auth_token=token&format=json&api_sig=3ac165886cbfc8dbf0f5a1cbc49c2943&method=vimeo.people.getHDEmbeds", "advanced/person/get_hd_embeds.json")
34
+ response = @person.get_hd_embeds("token")
35
+
36
+ assert_equal "fail", response["stat"]
37
+ end
38
+
39
+ should "be able to get a user's info" do
40
+ stub_post("?api_key=12345&format=json&api_sig=c9e114639756433a11867c754819065f&method=vimeo.people.getInfo&user_id=matthooks", "advanced/person/get_info.json")
41
+ response = @person.get_info("matthooks")
42
+
43
+ assert_equal "matthooks", response["person"]["username"]
44
+ end
45
+
46
+ should "be able to get a user's portrait urls" do
47
+ stub_post("?api_key=12345&format=json&api_sig=6f70c7ca870c127c07d6fcbdd96b2d74&method=vimeo.people.getPortraitUrls&user_id=matthooks", "advanced/person/get_portrait_urls.json")
48
+ response = @person.get_portrait_urls("matthooks")
49
+
50
+ assert_equal "ok", response["stat"]
51
+ end
52
+
53
+ should "be able to get remove a user from your contacts" do
54
+ stub_post("?api_key=12345&auth_token=token&format=json&api_sig=0d21943588aae94c65575f4a49e05b63&method=vimeo.people.removeContact&user_id=user_id", "advanced/person/remove_contact.json")
55
+ response = @person.remove_contact("token", "user_id")
56
+
57
+ assert_equal "ok", response["stat"]
58
+ end
59
+
60
+ should "be able to remove you from a subscription" do
61
+ stub_post("?api_key=12345&types=likes&auth_token=token&format=json&api_sig=8f63f6fc9988250db4ff4d92bbb2b9c1&method=vimeo.people.removeSubscription&user_id=user_id", "advanced/person/remove_subscription.json")
62
+ response = @person.remove_subscription("token", "user_id", "likes")
63
+
64
+ assert_equal "ok", response["stat"]
65
+ end
66
+
67
+ end
68
+ end
@@ -0,0 +1,33 @@
1
+ require 'test_helper'
2
+
3
+ class TestTest < Test::Unit::TestCase
4
+
5
+ context "vimeo advanced test" do
6
+
7
+ setup do
8
+ @test = Vimeo::Advanced::Test.new("12345", "secret")
9
+ end
10
+
11
+ should "be able to get an echo" do
12
+ stub_post("?api_key=12345&format=json&api_sig=6f913caf4fd018a0dd48400f6ac07439&method=vimeo.test.echo", "advanced/test/echo.json")
13
+ response = @test.echo
14
+
15
+ assert_equal "ok", response["stat"]
16
+ end
17
+
18
+ should "be able to test if a user is logged in" do
19
+ stub_post("?api_key=12345&auth_token=token&format=json&api_sig=9753d04b7b5b3c47101aace3f314ed84&method=vimeo.test.login", "advanced/test/login.json")
20
+ response = @test.login("token")
21
+
22
+ assert_equal "matthooks", response["user"]["username"]
23
+ end
24
+
25
+ should "be able to ping the Vimeo advanced API" do
26
+ stub_post("?api_key=12345&auth_token=token&format=json&api_sig=5f45b34d1e7078636f5386b8db7408ee&method=vimeo.test.null", "advanced/test/null.json")
27
+ response = @test.null("token")
28
+
29
+ assert_equal "ok", response["stat"]
30
+ end
31
+
32
+ end
33
+ end
@@ -0,0 +1,50 @@
1
+ require 'test_helper'
2
+
3
+ class UploadTest < Test::Unit::TestCase
4
+
5
+ context "vimeo advanced upload" do
6
+
7
+ setup do
8
+ @upload = Vimeo::Advanced::Upload.new("12345", "secret")
9
+ end
10
+
11
+ should "be able confirm an upload" do
12
+ stub_post("?api_key=12345&ticket_id=ticket_id&format=json&auth_token=token&api_sig=576b41966709651aead8754b3c5d370d&method=vimeo.videos.upload.confirm", "advanced/upload/confirm.json")
13
+ response = @upload.confirm("token", "ticket_id", "json_manifest")
14
+
15
+ assert_equal "ticket_id", response["ticket"]["id"]
16
+ end
17
+
18
+ should "be able to get a user's quota" do
19
+ stub_post("?api_key=12345&auth_token=token&format=json&api_sig=4eb2da55156fca5ab81bfe1a67a016ec&method=vimeo.videos.upload.getQuota", "advanced/upload/get_quota.json")
20
+ response = @upload.get_quota("token")
21
+
22
+ assert_equal "888046", response["user"]["id"]
23
+ end
24
+
25
+ should "be able to get an upload ticket" do
26
+ stub_post("?api_key=12345&auth_token=token&format=json&api_sig=0eabe7404e1c1fd22a269190c36e4093&method=vimeo.videos.upload.getTicket", "advanced/upload/get_ticket.json")
27
+ response = @upload.get_ticket("token")
28
+
29
+ assert_equal "ticket_id", response["ticket"]["id"]
30
+ end
31
+
32
+ # TODO: Stub out the HTTPClient calls correctly since FakeWeb doesn't work here.
33
+ # should "be able to upload a file to vimeo" do
34
+ # HTTPClient.any_instance.stubs(:post)
35
+ # file_path = File.expand_path(File.dirname(__FILE__) + "../../../fixtures/advanced/upload/sample_iTunes.mov")
36
+ # response = @upload.upload("token", file_path, "ticket_id", "http:\/\/67.202.6.15\/upload_multi?ticket_id=ticket_id")
37
+ #
38
+ # assert_equal "MD5", response
39
+ # end
40
+
41
+ # TODO: Make sure this manifest fixture file is right.
42
+ should "be able to verify a file manifest" do
43
+ stub_post("?api_key=12345&ticket_id=ticket_id&format=json&auth_token=token&api_sig=3b1c022ba0be09e5901bd91fb5a4426c&method=vimeo.videos.upload.verifyManifest", "advanced/upload/verify_manifest.json")
44
+ response = @upload.verify_manifest("token", "ticket_id", "json_manifest")
45
+
46
+ assert_equal "ticket_id", response["ticket"]["id"]
47
+ end
48
+
49
+ end
50
+ end
@@ -0,0 +1,26 @@
1
+ require 'test_helper'
2
+
3
+ class VideoEmbedTest < Test::Unit::TestCase
4
+
5
+ context "vimeo advanced video embed" do
6
+
7
+ setup do
8
+ @video_embed = Vimeo::Advanced::VideoEmbed.new("12345", "secret")
9
+ end
10
+
11
+ should "be able to get a list presets for video embeds" do
12
+ stub_post("?api_key=12345&format=json&method=vimeo.video.embed.getPresets&auth_token=token&api_sig=37baebafad1eafc408b9789e9f0115be", "advanced/video_embed/get_presets.json")
13
+ response = @video_embed.get_presets("token")
14
+
15
+ assert_equal "fail", response["stat"]
16
+ end
17
+
18
+ should "be able to set the preset of a video embed" do
19
+ stub_post("?preset_id=preset_id&video_id=video_id&api_key=12345&format=json&method=vimeo.video.embed.setPreset&auth_token=token&api_sig=116e80503e8273a6b4475b8561c2818b", "advanced/video_embed/set_preset.json")
20
+ response = @video_embed.set_preset("token", "video_id", "preset_id")
21
+
22
+ assert_equal "ok", response["stat"]
23
+ end
24
+
25
+ end
26
+ end
@@ -0,0 +1,203 @@
1
+ require 'test_helper'
2
+
3
+ class VideoTest < Test::Unit::TestCase
4
+
5
+ context "vimeo advanced video" do
6
+
7
+ setup do
8
+ @video = Vimeo::Advanced::Video.new("12345", "secret")
9
+ end
10
+
11
+ should "be able to add cast to a video" do
12
+ stub_post("?video_id=video_id&api_key=12345&user_id=user_id&format=json&method=vimeo.videos.addCast&auth_token=token&api_sig=d4490b9ebe5914fe2e05756dd6fb1db0", "advanced/video/add_cast.json")
13
+ response = @video.add_cast("token", "video_id", "user_id")
14
+
15
+ assert_equal "ok", response["stat"]
16
+ end
17
+
18
+ should "be able to add photos to a video" do
19
+ stub_post("?video_id=video_id&api_key=12345&format=json&method=vimeo.videos.addPhotos&photo_urls=photo_urls&auth_token=token&api_sig=25e09737829e9a0c3a57201ada350b03", "advanced/video/add_photos.json")
20
+ response = @video.add_photos("token", "video_id", "photo_urls")
21
+
22
+ assert_equal "ok", response["stat"]
23
+ end
24
+
25
+ should "be able to add tags to a video" do
26
+ stub_post("?video_id=video_id&api_key=12345&format=json&method=vimeo.videos.addTags&auth_token=token&tags=tags&api_sig=9969e062d985a91363630d2003843341", "advanced/video/add_tags.json")
27
+ response = @video.add_tags("token", "video_id", "tags")
28
+
29
+ assert_equal "ok", response["stat"]
30
+ end
31
+
32
+ should "be able to clear tags from a video" do
33
+ stub_post("?video_id=video_id&api_key=12345&format=json&method=vimeo.videos.clearTags&auth_token=token&api_sig=b901229a90f9f2d99d82d71da269573f", "advanced/video/clear_tags.json")
34
+ response = @video.clear_tags("token", "video_id")
35
+
36
+ assert_equal "ok", response["stat"]
37
+ end
38
+
39
+ should "be able to delete a video" do
40
+ stub_post("?video_id=video_id&api_key=12345&format=json&method=vimeo.videos.delete&auth_token=token&api_sig=55a6902be853ed835d5f9f359fd66719", "advanced/video/delete.json")
41
+ response = @video.delete("token", "video_id")
42
+
43
+ assert_equal "ok", response["stat"]
44
+ end
45
+
46
+ should "be able to get all videos from a user" do
47
+ stub_post("?api_key=12345&user_id=user_id&format=json&method=vimeo.videos.getAll&api_sig=0b828f177a2357d8d6caaa53443acbd1", "advanced/video/get_all.json")
48
+ response = @video.get_all("user_id")
49
+
50
+ assert_equal "ok", response["stat"]
51
+ end
52
+
53
+ should "be able to get all videos a user appears in" do
54
+ stub_post("?api_key=12345&user_id=user_id&format=json&method=vimeo.videos.getAppearsIn&api_sig=e1c50479c4e304a7eeb16b3f85eccc80", "advanced/video/get_appears_in.json")
55
+ response = @video.get_appears_in("user_id")
56
+
57
+ assert_equal "ok", response["stat"]
58
+ end
59
+
60
+ should "be able to get videos by tag" do
61
+ stub_post("?api_key=12345&format=json&method=vimeo.videos.getByTag&tag=tag&api_sig=d8fde9128d34b6f986dd3712ea4f1034", "advanced/video/get_by_tag.json")
62
+ response = @video.get_by_tag("tag")
63
+
64
+ assert_equal "ok", response["stat"]
65
+ end
66
+
67
+ should "be able to get the cast of a video" do
68
+ stub_post("?video_id=video_id&api_key=12345&format=json&method=vimeo.videos.getCast&api_sig=b5d96ed4f1b72c42480afb4c0e0a1a61", "advanced/video/get_cast.json")
69
+ response = @video.get_cast("video_id")
70
+
71
+ assert_equal "ok", response["stat"]
72
+ end
73
+
74
+ should "be able to get videos a user's contacts liked" do
75
+ stub_post("?api_key=12345&user_id=user_id&format=json&method=vimeo.videos.getContactsLiked&api_sig=6069cc86ec692d50889733472da30e72", "advanced/video/get_contacts_liked.json")
76
+ response = @video.get_contacts_liked("user_id")
77
+
78
+ assert_equal "ok", response["stat"]
79
+ end
80
+
81
+ should "be able to get videos a user's contacts uploaded" do
82
+ stub_post("?api_key=12345&user_id=user_id&format=json&method=vimeo.videos.getContactsUploaded&api_sig=7e3caceb0edfbf4fa143410ca0c9549e", "advanced/video/get_contacts_uploaded.json")
83
+ response = @video.get_contacts_uploaded("user_id")
84
+
85
+ assert_equal "ok", response["stat"]
86
+ end
87
+
88
+ should "be able to get info about a video" do
89
+ stub_post("?video_id=video_id&api_key=12345&format=json&method=vimeo.videos.getInfo&api_sig=0f1a7df7325961a0cf352da6264e913f", "advanced/video/get_info.json")
90
+ response = @video.get_info("video_id")
91
+
92
+ assert_equal "ok", response["stat"]
93
+ end
94
+
95
+ should "be able to get the videos a user has liked" do
96
+ stub_post("?api_key=12345&user_id=user_id&format=json&method=vimeo.videos.getLikes&api_sig=49705aaa8cfb4bf4362ba5f81f4fe0df", "advanced/video/get_likes.json")
97
+ response = @video.get_likes("user_id")
98
+
99
+ assert_equal "ok", response["stat"]
100
+ end
101
+
102
+ should "be able to get a user's subscriptions" do
103
+ stub_post("?api_key=12345&user_id=user_id&format=json&method=vimeo.videos.getSubscriptions&api_sig=892782d6bef613e66da3dcb14427afdf", "advanced/video/get_subscriptions.json")
104
+ response = @video.get_subscriptions("user_id")
105
+
106
+ assert_equal "ok", response["stat"]
107
+ end
108
+
109
+ should "be able to get thumbnail urls for a video" do
110
+ stub_post("?video_id=video_id&api_key=12345&format=json&method=vimeo.videos.getThumbnailUrls&api_sig=faf1c7ac2296d9eb56656baa4a98c9d6", "advanced/video/get_thumbnail_urls.json")
111
+ response = @video.get_thumbnail_urls("video_id")
112
+
113
+ assert_equal "ok", response["stat"]
114
+ end
115
+
116
+ should "be able to get all videos a user has uploaded" do
117
+ stub_post("?api_key=12345&user_id=user_id&format=json&method=vimeo.videos.getUploaded&api_sig=f1fb4954a2a261ed195d2ad47e3c9702", "advanced/video/get_uploaded.json")
118
+ response = @video.get_uploaded("user_id")
119
+
120
+ assert_equal "ok", response["stat"]
121
+ end
122
+
123
+ should "be able to remove cast from a video" do
124
+ stub_post("?video_id=video_id&api_key=12345&user_id=user_id&format=json&method=vimeo.videos.removeCast&auth_token=token&api_sig=31edc8eb16e2bc192d2b04405a7577c5", "advanced/video/remove_cast.json")
125
+ response = @video.remove_cast("token", "video_id", "user_id")
126
+
127
+ assert_equal "ok", response["stat"]
128
+ end
129
+
130
+ should "be able to remove a tag from a video" do
131
+ stub_post("?video_id=video_id&api_key=12345&tag_id=tag_id&format=json&method=vimeo.videos.removeTag&auth_token=token&api_sig=8a0f215d43a6cd5ecdb07525f19323d6", "advanced/video/remove_tag.json")
132
+ response = @video.remove_tag("token", "video_id", "tag_id")
133
+
134
+ assert_equal "ok", response["stat"]
135
+ end
136
+
137
+ should "be able to search for videos" do
138
+ stub_post("?api_key=12345&query=query&format=json&method=vimeo.videos.search&api_sig=16df9ac70be74b29f1660e9997d3d0df", "advanced/video/search.json")
139
+ response = @video.search("query")
140
+
141
+ assert_equal "ok", response["stat"]
142
+ end
143
+
144
+ should "be able to set the description of a video" do
145
+ stub_post("?video_id=video_id&api_key=12345&format=json&method=vimeo.videos.setDescription&description=description&auth_token=token&api_sig=b80965c8c5f62f006c7d897fc9ce10b2", "advanced/video/set_description.json")
146
+ response = @video.set_description("token", "video_id", "description")
147
+
148
+ assert_equal "ok", response["stat"]
149
+ end
150
+
151
+ should "be able to set the like of a video" do
152
+ stub_post("?video_id=video_id&api_key=12345&format=json&method=vimeo.videos.setLike&like=like&auth_token=token&api_sig=55d3ad34bc4015cc4b0b8c1bf36ca68e", "advanced/video/set_like.json")
153
+ response = @video.set_like("token", "video_id", "like")
154
+
155
+ assert_equal "ok", response["stat"]
156
+ end
157
+
158
+ should "be able to set the privacy for a video" do
159
+ stub_post("?privacy=privacy&video_id=video_id&api_key=12345&format=json&method=vimeo.videos.setPrivacy&auth_token=token&api_sig=e34654e6260ca22869a39c0213938e80", "advanced/video/set_privacy.json")
160
+ response = @video.set_privacy("token", "video_id", "privacy")
161
+
162
+ assert_equal "ok", response["stat"]
163
+ end
164
+
165
+ should "be able to set the title of a video" do
166
+ stub_post("?title=title&video_id=video_id&api_key=12345&format=json&method=vimeo.videos.setTitle&auth_token=token&api_sig=164cc69c87f1a460169875493623f9b4", "advanced/video/set_title.json")
167
+ response = @video.set_title("token", "video_id", "title")
168
+
169
+ assert_equal "ok", response["stat"]
170
+ end
171
+
172
+ # comments
173
+
174
+ should "be able to add a comment to a video" do
175
+ stub_post("?video_id=video_id&api_key=12345&format=json&comment_text=comment_text&method=vimeo.videos.comments.addComment&auth_token=token&api_sig=cd01f8a9ed97bd68a4e1da8be337d9df", "advanced/video/add_comment.json")
176
+ response = @video.add_comment("token", "video_id", "comment_text")
177
+
178
+ assert_equal "ok", response["stat"]
179
+ end
180
+
181
+ should "be able to delete a comment" do
182
+ stub_post("?video_id=video_id&api_key=12345&format=json&method=vimeo.videos.comments.deleteComment&auth_token=token&comment_id=comment_id&api_sig=aac80a3b34f94950f4000be7e337f1a8", "advanced/video/delete_comment.json")
183
+ response = @video.delete_comment("token", "video_id", "comment_id")
184
+
185
+ assert_equal "ok", response["stat"]
186
+ end
187
+
188
+ should "be able to edit a comment" do
189
+ stub_post("?video_id=video_id&api_key=12345&format=json&comment_text=comment_text&method=vimeo.videos.comments.editComment&auth_token=token&comment_id=comment_id&api_sig=4f2c2503cd53ead8f1203b55241259c8", "advanced/video/edit_comment.json")
190
+ response = @video.edit_comment("token", "video_id", "comment_id", "comment_text")
191
+
192
+ assert_equal "ok", response["stat"]
193
+ end
194
+
195
+ should "be able to get a list of comments" do
196
+ stub_post("?video_id=video_id&api_key=12345&format=json&method=vimeo.videos.comments.getList&api_sig=ed4c2455eabcaad041d44b659b002ff8", "advanced/video/get_comments_list.json")
197
+ response = @video.get_comments_list("video_id")
198
+
199
+ assert_equal "ok", response["stat"]
200
+ end
201
+
202
+ end
203
+ end
File without changes
@@ -0,0 +1,60 @@
1
+ require 'test_helper'
2
+
3
+ class ActivityTest < Test::Unit::TestCase
4
+
5
+ context "vimeo simple activity" do
6
+
7
+ setup do
8
+ @username = "brad" # Brad Dougherty, Vimeo Staffer
9
+ end
10
+
11
+ context "making api calls" do
12
+
13
+ should "be able to get activity by the user" do
14
+ stub_get("/activity/#{@username}/user_did.json", "simple/activity/user_did.json")
15
+ activities = Vimeo::Simple::Activity.user_did(@username)
16
+
17
+ assert_equal 20, activities.size
18
+ first = activities.first
19
+ assert_equal "add_comment_forum", first["type"]
20
+ end
21
+
22
+ should "be able to get activity on the user" do
23
+ stub_get("/activity/#{@username}/happened_to_user.json", "simple/activity/happened_to_user.json")
24
+ activities = Vimeo::Simple::Activity.happened_to_user(@username)
25
+
26
+ assert_equal 20, activities.size
27
+ first = activities.first
28
+ assert_equal "like", first["type"]
29
+ end
30
+
31
+ should "be able to get activity by the user's contacts" do
32
+ stub_get("/activity/#{@username}/contacts_did.json", "simple/activity/contacts_did.json")
33
+ activities = Vimeo::Simple::Activity.contacts_did(@username)
34
+
35
+ assert_equal 20, activities.size
36
+ first = activities.first
37
+ assert_equal "add_comment_forum", first["type"]
38
+ end
39
+
40
+ should "be able to get activity on the user's contacts" do
41
+ stub_get("/activity/#{@username}/happened_to_contacts.json", "simple/activity/happened_to_contacts.json")
42
+ activities = Vimeo::Simple::Activity.happened_to_contacts(@username)
43
+
44
+ assert_equal 20, activities.size
45
+ first = activities.first
46
+ assert_equal "like", first["type"]
47
+ end
48
+
49
+ should "be able to get activity by everyone" do
50
+ stub_get("/activity/#{@username}/everyone_did.json", "simple/activity/everyone_did.json")
51
+ activities = Vimeo::Simple::Activity.everyone_did(@username)
52
+
53
+ assert_equal 20, activities.size
54
+ first = activities.first
55
+ assert_equal "upload", first["type"]
56
+ end
57
+
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,31 @@
1
+ require 'test_helper'
2
+
3
+ class AlbumTest < Test::Unit::TestCase
4
+
5
+ context "vimeo simple album" do
6
+
7
+ setup do
8
+ @album_id = "129077"
9
+ end
10
+
11
+ context "making api calls" do
12
+
13
+ should "be able to see videos in an album" do
14
+ stub_get("/album/#{@album_id}/videos.json", "simple/album/videos.json")
15
+ videos = Vimeo::Simple::Album.videos(@album_id)
16
+
17
+ assert_equal 20, videos.size
18
+ first = videos.first
19
+ assert_equal "Pause", first["title"]
20
+ end
21
+
22
+ should "be able to get information about an album" do
23
+ stub_get("/album/#{@album_id}/info.json", "simple/album/info.json")
24
+ info = Vimeo::Simple::Album.info(@album_id)
25
+
26
+ assert_equal "129077", info["id"]
27
+ end
28
+
29
+ end
30
+ end
31
+ end