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,58 @@
1
+ module Vimeo
2
+ module Advanced
3
+ class Channel < Vimeo::Advanced::Base
4
+
5
+ # Adds a video to a channel.
6
+ create_api_method :add_video,
7
+ "vimeo.channels.addVideo",
8
+ :required => [:auth_token, :channel_id, :video_id]
9
+
10
+ # Returns a list of all channels.
11
+ create_api_method :get_all,
12
+ "vimeo.channels.getAll",
13
+ :optional => [:page, :per_page, :sort]
14
+
15
+ # Returns information about a channel.
16
+ # FIXME: Do we need page and per_page here?
17
+ create_api_method :get_info,
18
+ "vimeo.channels.getInfo",
19
+ :required => [:channel_id],
20
+ :optional => [:page, :per_page]
21
+
22
+ # Returns a list of the moderators of a channel.
23
+ create_api_method :get_moderators,
24
+ "vimeo.channels.getModerators",
25
+ :required => [:channel_id],
26
+ :optional => [:page, :per_page]
27
+
28
+ # Returns a list of the subscribers of a channel.
29
+ create_api_method :get_subscribers,
30
+ "vimeo.channels.getSubscribers",
31
+ :required => [:channel_id],
32
+ :optional => [:page, :per_page]
33
+
34
+ # Returns a list of the videos in a channel.
35
+ # FIXME: Should there be a sort option here?
36
+ create_api_method :get_videos,
37
+ "vimeo.channels.getVideos",
38
+ :required => [:channel_id],
39
+ :optional => [:page, :per_page, :full_response]
40
+
41
+ # Removes a video from a channel.
42
+ create_api_method :remove_video,
43
+ "vimeo.channels.removeVideo",
44
+ :required => [:auth_token, :channel_id, :video_id]
45
+
46
+ # Subscribes to a channel
47
+ create_api_method :subscribe,
48
+ "vimeo.channels.subscribe",
49
+ :required => [:auth_token, :channel_id]
50
+
51
+ # Unsubscribes from a channel
52
+ create_api_method :unsubscribe,
53
+ "vimeo.channels.unsubscribe",
54
+ :required => [:auth_token, :channel_id]
55
+
56
+ end # Channel
57
+ end # Advanced
58
+ end # Vimeo
@@ -0,0 +1,31 @@
1
+ module Vimeo
2
+ module Advanced
3
+ class Contact < Vimeo::Advanced::Base
4
+
5
+ # Returns a list of a user's contacts.
6
+ create_api_method :get_all,
7
+ "vimeo.contacts.getAll",
8
+ :required => [:user_id],
9
+ :optional => [:page, :per_page, :sort]
10
+
11
+ # Returns a list of your mutual contacts with a user.
12
+ create_api_method :get_mutual,
13
+ "vimeo.contacts.getMutual",
14
+ :required => [:user_id],
15
+ :optional => [:page, :per_page, :sort]
16
+
17
+ # Returns a list of your contacts who are online.
18
+ # FIXME: Shouldn't this have optional params?
19
+ create_api_method :get_online,
20
+ "vimeo.contacts.getOnline",
21
+ :optional => [:page, :per_page, :sort]
22
+
23
+ # Returns a list of users who added a user as a contact.
24
+ create_api_method :get_who_added,
25
+ "vimeo.contacts.getWhoAdded",
26
+ :required => [:user_id],
27
+ :optional => [:page, :per_page, :sort]
28
+
29
+ end # Contact
30
+ end # Advanced
31
+ end # Vimeo
@@ -0,0 +1,68 @@
1
+ module Vimeo
2
+ module Advanced
3
+ class Group < Vimeo::Advanced::Base
4
+
5
+ # Adds a video to a group.
6
+ create_api_method :add_video,
7
+ "vimeo.groups.addVideo",
8
+ :required => [:auth_token, :group_id, :video_id]
9
+
10
+ # Returns a list of all groups.
11
+ create_api_method :get_all,
12
+ "vimeo.groups.getAll",
13
+ :optional => [:page, :per_page, :sort]
14
+
15
+ # Returns a list of a group's files.
16
+ # FIXME: Sort optional param?
17
+ create_api_method :get_files,
18
+ "vimeo.groups.getFiles",
19
+ :required => [:group_id],
20
+ :optional => [:page, :per_page]
21
+
22
+ # Returns information about a group.
23
+ # FIXME: Does this need pagination options?
24
+ create_api_method :get_info,
25
+ "vimeo.groups.getInfo",
26
+ :required => [:group_id],
27
+ :optional => [:page, :per_page]
28
+
29
+ # Returns a list of the members in a group.
30
+ create_api_method :get_members,
31
+ "vimeo.groups.getMembers",
32
+ :required => [:group_id],
33
+ :optional => [:page, :per_page, :sort]
34
+
35
+ # Returns a list of the moderators of a group.
36
+ # FIXME: Should this have sort?
37
+ create_api_method :get_moderators,
38
+ "vimeo.groups.getModerators",
39
+ :required => [:group_id],
40
+ :optional => [:page, :per_page]
41
+
42
+ # Returns a list of the comments on a video in a group.
43
+ # FIXME: Should this have sort?
44
+ create_api_method :get_video_comments,
45
+ "vimeo.groups.getVideoComments",
46
+ :required => [:group_id, :video_id],
47
+ :optional => [:page, :per_page]
48
+
49
+ # Returns a list of the videos in a group.
50
+ # FIXME: Should this have sort?
51
+ create_api_method :get_videos,
52
+ "vimeo.groups.getVideos",
53
+ :required => [:group_id],
54
+ :optional => [:page, :per_page, :sort, :full_response]
55
+
56
+ # Joins a group.
57
+ create_api_method :join,
58
+ "vimeo.groups.join",
59
+ :required => [:auth_token, :group_id]
60
+
61
+ # Leaves a group.
62
+ create_api_method :leave,
63
+ "vimeo.groups.leave",
64
+ :required => [:auth_token, :group_id]
65
+
66
+ end # Group
67
+ end # Advanced
68
+ end # Vimeo
@@ -0,0 +1,25 @@
1
+ module Vimeo
2
+ module Advanced
3
+ class GroupEvents < Vimeo::Advanced::Base
4
+
5
+ # Returns a list of events from a group for a specific month.
6
+ create_api_method :get_month,
7
+ "vimeo.groups.events.getMonth",
8
+ :required => [:group_id],
9
+ :optional => [:page, :per_page, :month, :year]
10
+
11
+ # Returns a list of all past events from a group.
12
+ create_api_method :get_past,
13
+ "vimeo.groups.events.getPast",
14
+ :required => [:group_id],
15
+ :optional => [:page, :per_page]
16
+
17
+ # Returns a list of all upcoming events from a group.
18
+ create_api_method :get_upcoming,
19
+ "vimeo.groups.events.getUpcoming",
20
+ :required => [:group_id],
21
+ :optional => [:page, :per_page]
22
+
23
+ end # GroupEvents
24
+ end # Advanced
25
+ end # Vimeo
@@ -0,0 +1,19 @@
1
+ module Vimeo
2
+ module Advanced
3
+ class GroupForums < Vimeo::Advanced::Base
4
+
5
+ # Returns a list of comments for a group forum topic.
6
+ create_api_method :get_topic_comments,
7
+ "vimeo.groups.forums.getTopicComments",
8
+ :required => [:group_id, :topic_id],
9
+ :optional => [:page, :per_page]
10
+
11
+ # Returns a list of all group forum topics.
12
+ create_api_method :get_topics,
13
+ "vimeo.groups.forums.getTopics",
14
+ :required => [:group_id],
15
+ :optional => [:page, :per_page]
16
+
17
+ end # GroupForums
18
+ end # Advanced
19
+ end # Vimeo
@@ -0,0 +1,48 @@
1
+ module Vimeo
2
+ module Advanced
3
+ class Person < Vimeo::Advanced::Base
4
+
5
+ # Adds a user to your contact list.
6
+ create_api_method :add_contact,
7
+ "vimeo.people.addContact",
8
+ :required => [:auth_token, :user_id]
9
+
10
+ # Adds a subscription to your subscriptions.
11
+ # Types is a comma-delimited string. Valid options: "likes", "appears", "uploads"
12
+ create_api_method :add_subscription,
13
+ "vimeo.people.addSubscription",
14
+ :required => [:auth_token, :user_id, :types]
15
+
16
+ # Finds a user by their e-mail.
17
+ create_api_method :find_by_email,
18
+ "vimeo.people.findByEmail",
19
+ :required => [:user_id]
20
+
21
+ create_api_method :get_hd_embeds,
22
+ "vimeo.people.getHDEmbeds",
23
+ :required => [:auth_token]
24
+
25
+ # Returns a user's information
26
+ create_api_method :get_info,
27
+ "vimeo.people.getInfo",
28
+ :required => [:user_id]
29
+
30
+ # Returns a user's portrait URLs.
31
+ create_api_method :get_portrait_urls,
32
+ "vimeo.people.getPortraitUrls",
33
+ :required => [:user_id]
34
+
35
+ # Removes a user from your contact list.
36
+ create_api_method :remove_contact,
37
+ "vimeo.people.removeContact",
38
+ :required => [:auth_token, :user_id]
39
+
40
+ # Removes a subscription to your subscriptions.
41
+ # Types is a comma-delimited string. Valid options: "likes", "appears", "uploads"
42
+ create_api_method :remove_subscription,
43
+ "vimeo.people.removeSubscription",
44
+ :required => [:auth_token, :user_id, :types]
45
+
46
+ end # Person
47
+ end # Advanced
48
+ end # Vimeo
@@ -0,0 +1,36 @@
1
+ module Vimeo
2
+ module Advanced
3
+
4
+ class Test < Vimeo::Advanced::Base
5
+
6
+ # An echo test. Echoes all parameters.
7
+ # Options can be anything except method, api_key,
8
+ # and api_sig -- if any of these options are
9
+ # present they will be overwritten by the proper
10
+ # values.
11
+ create_api_method :echo,
12
+ "vimeo.test.echo"
13
+
14
+ # def echo(options={})
15
+ # options.merge!(:method => "vimeo.test.echo")
16
+ # api_sig = generate_api_sig options
17
+ # options.merge!(:api_sig => api_sig)
18
+ # self.class.post("/api/rest", :query => options)
19
+ # end
20
+
21
+ # Tests if the user associated to this token
22
+ # is able to make authenticated calls.
23
+ create_api_method :login,
24
+ "vimeo.test.login",
25
+ :required => [:auth_token]
26
+
27
+
28
+ # A simple ping test.
29
+ create_api_method :null,
30
+ "vimeo.test.null",
31
+ :required => [:auth_token]
32
+
33
+ end
34
+
35
+ end # Advanced
36
+ end # Vimeo
@@ -0,0 +1,62 @@
1
+ require 'httpclient'
2
+ require 'json'
3
+
4
+ module Vimeo
5
+ module Advanced
6
+
7
+ class Upload < Vimeo::Advanced::Base
8
+
9
+ # TODO: Make this work with either a JSON or an XML manifest.
10
+ # Confirms the upload process.
11
+ create_api_method :confirm,
12
+ "vimeo.videos.upload.confirm",
13
+ :required => [:auth_token, :ticket_id],
14
+ :unsigned => [:json_manifest]
15
+
16
+ # "{\"files\":[{\"md5\":\"731f09145a1ea9ec9dad689de6fa0358\"}]}"
17
+
18
+ # Returns the space and HD uploads left for a user.
19
+ create_api_method :get_quota,
20
+ "vimeo.videos.upload.getQuota",
21
+ :required => [:auth_token]
22
+
23
+ # Returns an upload ticket.
24
+ create_api_method :get_ticket,
25
+ "vimeo.videos.upload.getTicket",
26
+ :required => [:auth_token]
27
+
28
+ # Upload +file+ to vimeo with +ticket_id+ and +auth_token+
29
+ # Returns the json manifest necessary to confirm the upload.
30
+ def upload(auth_token, file_path, ticket_id, end_point)
31
+ params = {
32
+ :auth_token => auth_token,
33
+ :ticket_id => ticket_id
34
+ }
35
+ params[:api_sig] = generate_api_sig params
36
+
37
+ params.merge!({ :file_data => File.open(file_path) })
38
+
39
+ client = HTTPClient.new
40
+ response = client.post(end_point, params)
41
+ md5 = response.content
42
+
43
+ self.class.create_json_manifest(md5)
44
+ end
45
+
46
+ # TODO: Make this work with either json or xml manifest.
47
+ # FIXME: Ticket id is required?
48
+ # Verifies a file manifest.
49
+ create_api_method :verify_manifest,
50
+ "vimeo.videos.upload.verifyManifest",
51
+ :required => [:auth_token, :ticket_id],
52
+ :unsigned => [:json_manifest]
53
+
54
+
55
+ # TODO: Make this more flexible for split uploads?
56
+ def self.create_json_manifest(md5s)
57
+ { :files => md5s.map { |md5| { :md5 => md5 } } }.to_json
58
+ end
59
+
60
+ end # Upload
61
+ end # Advanced
62
+ end # Vimeo
@@ -0,0 +1,131 @@
1
+ module Vimeo
2
+ module Advanced
3
+ class Video < Vimeo::Advanced::Base
4
+
5
+ create_api_method :add_cast,
6
+ "vimeo.videos.addCast",
7
+ :required => [:auth_token, :video_id, :user_id],
8
+ :optional => [:role]
9
+
10
+ create_api_method :add_photos,
11
+ "vimeo.videos.addPhotos",
12
+ :required => [:auth_token, :video_id, :photo_urls]
13
+
14
+ create_api_method :add_tags,
15
+ "vimeo.videos.addTags",
16
+ :required => [:auth_token, :video_id, :tags]
17
+
18
+ create_api_method :clear_tags,
19
+ "vimeo.videos.clearTags",
20
+ :required => [:auth_token, :video_id]
21
+
22
+ create_api_method :delete,
23
+ "vimeo.videos.delete",
24
+ :required => [:auth_token, :video_id]
25
+
26
+ create_api_method :get_all,
27
+ "vimeo.videos.getAll",
28
+ :required => [:user_id],
29
+ :optional => [:page, :per_page, :full_response, :sort]
30
+
31
+ create_api_method :get_appears_in,
32
+ "vimeo.videos.getAppearsIn",
33
+ :required => [:user_id],
34
+ :optional => [:page, :per_page, :full_response, :sort]
35
+
36
+ create_api_method :get_by_tag,
37
+ "vimeo.videos.getByTag",
38
+ :required => [:tag],
39
+ :optional => [:page, :per_page, :full_response, :sort]
40
+
41
+ create_api_method :get_cast,
42
+ "vimeo.videos.getCast",
43
+ :required => [:video_id],
44
+ :optional => [:page, :per_page]
45
+
46
+ create_api_method :get_contacts_liked,
47
+ "vimeo.videos.getContactsLiked",
48
+ :required => [:user_id],
49
+ :optional => [:page, :per_page, :full_response, :sort]
50
+
51
+ create_api_method :get_contacts_uploaded,
52
+ "vimeo.videos.getContactsUploaded",
53
+ :required => [:user_id],
54
+ :optional => [:page, :per_page, :full_response, :sort]
55
+
56
+ create_api_method :get_info,
57
+ "vimeo.videos.getInfo",
58
+ :required => [:video_id]
59
+
60
+ create_api_method :get_likes,
61
+ "vimeo.videos.getLikes",
62
+ :required => [:user_id],
63
+ :optional => [:page, :per_page, :full_response, :sort]
64
+
65
+ create_api_method :get_subscriptions,
66
+ "vimeo.videos.getSubscriptions",
67
+ :required => [:user_id],
68
+ :optional => [:page, :per_page, :full_response, :sort]
69
+
70
+ create_api_method :get_thumbnail_urls,
71
+ "vimeo.videos.getThumbnailUrls",
72
+ :required => [:video_id]
73
+
74
+ create_api_method :get_uploaded,
75
+ "vimeo.videos.getUploaded",
76
+ :required => [:user_id],
77
+ :optional => [:page, :per_page, :full_response, :sort]
78
+
79
+ create_api_method :remove_cast,
80
+ "vimeo.videos.removeCast",
81
+ :required => [:auth_token, :video_id, :user_id]
82
+
83
+ create_api_method :remove_tag,
84
+ "vimeo.videos.removeTag",
85
+ :required => [:auth_token, :video_id, :tag_id]
86
+
87
+ create_api_method :search,
88
+ "vimeo.videos.search",
89
+ :required => [:query],
90
+ :optional => [:page, :per_page, :full_response, :sort, :user_id]
91
+
92
+ create_api_method :set_description,
93
+ "vimeo.videos.setDescription",
94
+ :required => [:auth_token, :video_id, :description]
95
+
96
+ create_api_method :set_like,
97
+ "vimeo.videos.setLike",
98
+ :required => [:auth_token, :video_id, :like]
99
+
100
+ create_api_method :set_privacy,
101
+ "vimeo.videos.setPrivacy",
102
+ :required => [:auth_token, :video_id, :privacy],
103
+ :optional => [:users, :password]
104
+
105
+ create_api_method :set_title,
106
+ "vimeo.videos.setTitle",
107
+ :required => [:auth_token, :video_id, :title]
108
+
109
+
110
+ # comments
111
+ create_api_method :add_comment,
112
+ "vimeo.videos.comments.addComment",
113
+ :required => [:auth_token, :video_id, :comment_text],
114
+ :optional => [:reply_to_comment_id]
115
+
116
+ create_api_method :delete_comment,
117
+ "vimeo.videos.comments.deleteComment",
118
+ :required => [:auth_token, :video_id, :comment_id]
119
+
120
+ create_api_method :edit_comment,
121
+ "vimeo.videos.comments.editComment",
122
+ :required => [:auth_token, :video_id, :comment_id, :comment_text]
123
+
124
+ create_api_method :get_comments_list,
125
+ "vimeo.videos.comments.getList",
126
+ :required => [:video_id],
127
+ :optional => [:page, :per_page]
128
+
129
+ end # Video
130
+ end # Advanced
131
+ end # Vimeo
@@ -0,0 +1,19 @@
1
+ module Vimeo
2
+ module Advanced
3
+ class VideoEmbed < Vimeo::Advanced::Base
4
+
5
+ # Returns a list of presets for a video embed.
6
+ # FIXME: Needs a page optional as well...?
7
+ create_api_method :get_presets,
8
+ "vimeo.video.embed.getPresets",
9
+ :required => [:auth_token],
10
+ :optional => [:page, :per_page]
11
+
12
+ # Sets a preset for a video embed.
13
+ create_api_method :set_preset,
14
+ "vimeo.video.embed.setPreset",
15
+ :required => [:auth_token, :video_id, :preset_id]
16
+
17
+ end # VideoEmbed
18
+ end # Advanced
19
+ end # Vimeo
@@ -0,0 +1,20 @@
1
+ $:.unshift(File.dirname(__FILE__))
2
+ require 'advanced/base'
3
+ require 'advanced/album'
4
+ require 'advanced/auth'
5
+ require 'advanced/channel'
6
+ require 'advanced/contact'
7
+ require 'advanced/group'
8
+ require 'advanced/group_events'
9
+ require 'advanced/group_forums'
10
+ require 'advanced/person'
11
+ require 'advanced/test'
12
+ require 'advanced/upload'
13
+ require 'advanced/video'
14
+ require 'advanced/video_embed'
15
+
16
+ module Vimeo
17
+ module Advanced
18
+
19
+ end
20
+ end
@@ -0,0 +1,42 @@
1
+ module Vimeo
2
+ module Simple
3
+
4
+ class Activity < Vimeo::Simple::Base
5
+ # Returns a list of a user's activities.
6
+ #
7
+ # @param [String] username The user's id or username.
8
+ def self.user_did(username)
9
+ get("/activity/#{username}/user_did.json")
10
+ end
11
+
12
+ # Returns a list of activities that happened to a user.
13
+ #
14
+ # @param [String] username The user's id or username.
15
+ def self.happened_to_user(username)
16
+ get("/activity/#{username}/happened_to_user.json")
17
+ end
18
+
19
+ # Returns a list of activities a user's contact's did.
20
+ #
21
+ # @param [String] username The user's id or username.
22
+ def self.contacts_did(username)
23
+ get("/activity/#{username}/contacts_did.json")
24
+ end
25
+
26
+ # Returns a list of activities that happened to a user's contacts.
27
+ #
28
+ # @param [String] username The user's id or username.
29
+ def self.happened_to_contacts(username)
30
+ get("/activity/#{username}/happened_to_contacts.json")
31
+ end
32
+
33
+ # Returns a list of activities everyone did.
34
+ #
35
+ # @param [String] username The user's id or username.
36
+ def self.everyone_did(username)
37
+ get("/activity/#{username}/everyone_did.json")
38
+ end
39
+ end
40
+
41
+ end # Simple
42
+ end # Vimeo
@@ -0,0 +1,21 @@
1
+ module Vimeo
2
+ module Simple
3
+
4
+ class Album < Vimeo::Simple::Base
5
+ # Returns a list of an album's videos.
6
+ #
7
+ # @param [String] album_id The album's id.
8
+ def self.videos(album_id)
9
+ get("/album/#{album_id}/videos.json")
10
+ end
11
+
12
+ # Returns an album's metadata.
13
+ #
14
+ # @param [String] album_id The album's id.
15
+ def self.info(album_id)
16
+ get("/album/#{album_id}/info.json")
17
+ end
18
+ end
19
+
20
+ end # Simple
21
+ end # Vimeo
@@ -0,0 +1,10 @@
1
+ module Vimeo
2
+ module Simple
3
+
4
+ class Base
5
+ include HTTParty
6
+ base_uri 'vimeo.com/api/v2'
7
+ end # Base
8
+
9
+ end # Simple
10
+ end # Vimeo
@@ -0,0 +1,21 @@
1
+ module Vimeo
2
+ module Simple
3
+
4
+ class Channel < Vimeo::Simple::Base
5
+ # Returns a list of a channel's videos.
6
+ #
7
+ # @param [String] channelname The channel's name.
8
+ def self.videos(channelname)
9
+ get("/channel/#{channelname}/videos.json")
10
+ end
11
+
12
+ # Returns a channel's metadata.
13
+ #
14
+ # @param [String] channelname The channel's name.
15
+ def self.info(channelname)
16
+ get("/channel/#{channelname}/info.json")
17
+ end
18
+ end
19
+
20
+ end # Simple
21
+ end # Vimeo
@@ -0,0 +1,28 @@
1
+ module Vimeo
2
+ module Simple
3
+
4
+ class Group < Vimeo::Simple::Base
5
+ # Returns a list of a group's videos.
6
+ #
7
+ # @param [String] group_name The groups's name.
8
+ def self.videos(groupname)
9
+ get("/group/#{groupname}/videos.json")
10
+ end
11
+
12
+ # Returns a list of a group's users.
13
+ #
14
+ # @param [String] group_name The groups's name.
15
+ def self.users(groupname)
16
+ get("/group/#{groupname}/users.json")
17
+ end
18
+
19
+ # Returns a group's metadata.
20
+ #
21
+ # @param [String] group_name The groups's name.
22
+ def self.info(groupname)
23
+ get("/group/#{groupname}/info.json")
24
+ end
25
+ end
26
+
27
+ end # Simple
28
+ end # Vimeo