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,84 @@
1
+ module Vimeo
2
+ module Simple
3
+
4
+ class User < Vimeo::Simple::Base
5
+ # Returns a user's metadata.
6
+ #
7
+ # @param [String] username The user's id or username.
8
+ def self.info(username)
9
+ get("/#{username}/info.json")
10
+ end
11
+
12
+ # Returns a list of a user's videos.
13
+ #
14
+ # @param [String] username The user's id or username.
15
+ def self.videos(username)
16
+ get("/#{username}/videos.json")
17
+ end
18
+
19
+ # Returns a list of a user's liked videos.
20
+ #
21
+ # @param [String] username The user's id or username.
22
+ def self.likes(username)
23
+ get("/#{username}/likes.json")
24
+ end
25
+
26
+ # Returns a list of the videos a user appears in.
27
+ #
28
+ # @param [String] username The user's id or username.
29
+ def self.appears_in(username)
30
+ get("/#{username}/appears_in.json")
31
+ end
32
+
33
+ # Returns a list of all videos that are related to a user.
34
+ #
35
+ # @param [String] username The user's id or username.
36
+ def self.all_videos(username)
37
+ get("/#{username}/all_videos.json")
38
+ end
39
+
40
+ # Returns a list of a user's subscriptions.
41
+ #
42
+ # @param [String] username The user's id or username.
43
+ def self.subscriptions(username)
44
+ get("/#{username}/subscriptions.json")
45
+ end
46
+
47
+ # Returns a list of a user's albums.
48
+ #
49
+ # @param [String] username The user's id or username.
50
+ def self.albums(username)
51
+ get("/#{username}/albums.json")
52
+ end
53
+
54
+ # Returns a list of a user's channels.
55
+ #
56
+ # @param [String] username The user's id or username.
57
+ def self.channels(username)
58
+ get("/#{username}/channels.json")
59
+ end
60
+
61
+ # Returns a list of a user's groups.
62
+ #
63
+ # @param [String] username The user's id or username.
64
+ def self.groups(username)
65
+ get("/#{username}/groups.json")
66
+ end
67
+
68
+ # Returns a list of a user's contact's videos.
69
+ #
70
+ # @param [String] username The user's id or username.
71
+ def self.contacts_videos(username)
72
+ get("/#{username}/contacts_videos.json")
73
+ end
74
+
75
+ # Returns a list of videos that a user's contacts liked.
76
+ #
77
+ # @param [String] username The user's id or username.
78
+ def self.contacts_like(username)
79
+ get("/#{username}/contacts_like.json")
80
+ end
81
+ end
82
+
83
+ end # End Simple
84
+ end # End Vimeo
@@ -0,0 +1,14 @@
1
+ module Vimeo
2
+ module Simple
3
+
4
+ class Video < Vimeo::Simple::Base
5
+ # Returns this video's information.
6
+ #
7
+ # @param [String] video_id The video's id.
8
+ def self.info(video_id)
9
+ get("/video/#{video_id}.json")
10
+ end
11
+ end
12
+
13
+ end # End Simple
14
+ end # End Vimeo
@@ -0,0 +1,14 @@
1
+ $:.unshift(File.dirname(__FILE__))
2
+ require 'simple/base'
3
+ require 'simple/activity'
4
+ require 'simple/album'
5
+ require 'simple/channel'
6
+ require 'simple/group'
7
+ require 'simple/user'
8
+ require 'simple/video'
9
+
10
+ module Vimeo
11
+ module Simple
12
+
13
+ end # Simple
14
+ end # Vimeo
data/lib/vimeo.rb ADDED
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'httparty'
3
+ require 'digest/md5'
4
+
5
+ $:.unshift(File.dirname(__FILE__))
6
+ require 'vimeo/simple'
7
+ require 'vimeo/advanced'
8
+
9
+ module Vimeo
10
+ end
@@ -0,0 +1,4 @@
1
+ {
2
+ "generated_in":"0.4800",
3
+ "stat":"ok"
4
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "generated_in":"0.5089",
3
+ "stat":"ok",
4
+ "album":{
5
+ "id":"129683"
6
+ }
7
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "generated_in":"0.3576",
3
+ "stat":"ok"
4
+ }
@@ -0,0 +1,111 @@
1
+ {
2
+ "generated_in":"0.6876",
3
+ "stat":"ok",
4
+ "albums":{
5
+ "on_this_page":"3",
6
+ "page":"1",
7
+ "perpage":"25",
8
+ "total":"3",
9
+ "album":[
10
+ {
11
+ "id":"129683",
12
+ "title":"Test Album Vimeo Gem",
13
+ "description":"Test",
14
+ "created_on":"2009-09-24 17:35:26",
15
+ "total_videos":"2",
16
+ "url":"http:\/\/vimeo.com\/album\/129683",
17
+ "video_sort_method":"arranged",
18
+ "thumbnail_video":{
19
+ "id":"2529363",
20
+ "owner":"888046",
21
+ "title":"Test Video",
22
+ "thumbnails":{
23
+ "thumbnail":[
24
+ {
25
+ "height":"75",
26
+ "width":"100",
27
+ "_content":"http:\/\/images.vimeo.com\/21\/88\/91\/218891849\/218891849_100.jpg"
28
+ },
29
+ {
30
+ "height":"150",
31
+ "width":"200",
32
+ "_content":"http:\/\/images.vimeo.com\/21\/88\/91\/218891849\/218891849_200.jpg"
33
+ },
34
+ {
35
+ "height":"480",
36
+ "width":"640",
37
+ "_content":"http:\/\/bitcast.vimeo.com\/vimeo\/thumbnails\/defaults\/default.300x400.jpg"
38
+ }
39
+ ]
40
+ }
41
+ }
42
+ },
43
+ {
44
+ "id":"129692",
45
+ "title":"Test Album Vimeo Gem22223",
46
+ "description":"Test",
47
+ "created_on":"2009-09-24 17:52:17",
48
+ "total_videos":"2",
49
+ "url":"http:\/\/vimeo.com\/album\/129692",
50
+ "video_sort_method":"arranged",
51
+ "thumbnail_video":{
52
+ "id":"2529363",
53
+ "owner":"888046",
54
+ "title":"Test Video",
55
+ "thumbnails":{
56
+ "thumbnail":[
57
+ {
58
+ "height":"75",
59
+ "width":"100",
60
+ "_content":"http:\/\/images.vimeo.com\/21\/88\/91\/218891849\/218891849_100.jpg"
61
+ },
62
+ {
63
+ "height":"150",
64
+ "width":"200",
65
+ "_content":"http:\/\/images.vimeo.com\/21\/88\/91\/218891849\/218891849_200.jpg"
66
+ },
67
+ {
68
+ "height":"480",
69
+ "width":"640",
70
+ "_content":"http:\/\/bitcast.vimeo.com\/vimeo\/thumbnails\/defaults\/default.300x400.jpg"
71
+ }
72
+ ]
73
+ }
74
+ }
75
+ },
76
+ {
77
+ "id":"129689",
78
+ "title":"Test Album Vimeo Gem21312",
79
+ "description":"Test",
80
+ "created_on":"2009-09-24 17:46:46",
81
+ "total_videos":"2",
82
+ "url":"http:\/\/vimeo.com\/album\/129689",
83
+ "video_sort_method":"arranged",
84
+ "thumbnail_video":{
85
+ "id":"2529363",
86
+ "owner":"888046",
87
+ "title":"Test Video",
88
+ "thumbnails":{
89
+ "thumbnail":[
90
+ {
91
+ "height":"75",
92
+ "width":"100",
93
+ "_content":"http:\/\/images.vimeo.com\/21\/88\/91\/218891849\/218891849_100.jpg"
94
+ },
95
+ {
96
+ "height":"150",
97
+ "width":"200",
98
+ "_content":"http:\/\/images.vimeo.com\/21\/88\/91\/218891849\/218891849_200.jpg"
99
+ },
100
+ {
101
+ "height":"480",
102
+ "width":"640",
103
+ "_content":"http:\/\/bitcast.vimeo.com\/vimeo\/thumbnails\/defaults\/default.300x400.jpg"
104
+ }
105
+ ]
106
+ }
107
+ }
108
+ }
109
+ ]
110
+ }
111
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "generated_in":"0.2487",
3
+ "stat":"ok",
4
+ "videos":{
5
+ "on_this_page":"2",
6
+ "page":"1",
7
+ "perpage":"25",
8
+ "total":"2",
9
+ "video":[
10
+ {
11
+ "embed_privacy":"anywhere",
12
+ "id":"411684",
13
+ "is_hd":"1",
14
+ "owner":"151382",
15
+ "privacy":"anybody",
16
+ "title":"my home (minn heima)",
17
+ "upload_date":"2007-12-01 16:11:19"
18
+ },
19
+ {
20
+ "embed_privacy":"anywhere",
21
+ "id":"2529363",
22
+ "is_hd":"0",
23
+ "owner":"888046",
24
+ "privacy":"anybody",
25
+ "title":"Test Video",
26
+ "upload_date":"2008-12-14 23:57:19"
27
+ }
28
+ ]
29
+ }
30
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "generated_in":"0.5773",
3
+ "stat":"ok"
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "generated_in":"0.3232",
3
+ "stat":"ok"
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "generated_in":"0.2277",
3
+ "stat":"ok"
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "generated_in":"0.1217",
3
+ "stat":"ok"
4
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "generated_in":"0.9726",
3
+ "stat":"ok",
4
+ "auth":{
5
+ "token":"token",
6
+ "perms":"delete",
7
+ "user":{
8
+ "fullname":"Matt Hooks",
9
+ "id":"888046",
10
+ "username":"matthooks"
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "generated_in":"0.0901",
3
+ "stat":"ok",
4
+ "frob":"frob"
5
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "generated_in":"1.1758",
3
+ "stat":"ok",
4
+ "auth": {
5
+ "token":"token",
6
+ "perms":"delete",
7
+ "user": {
8
+ "fullname":"Matt Hooks",
9
+ "id":"888046",
10
+ "username":"matthooks"
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "generated_in":"0.4800",
3
+ "stat":"ok"
4
+ }