Permalink
Browse files

Merge pull request #34 from paratiger/master

Adding Advanced API vimeo.videos.getCollections
  • Loading branch information...
2 parents 8271b4e + 34301c6 commit 419b317c9dee1a11f5886f5203d1e708dfeb4415 @matthooks committed Mar 29, 2012
View
1 README.markdown
@@ -276,6 +276,7 @@ Some methods have optional variables. Pass these as a hash at the end of a call.
video.get_cast("video_id", { :page => "1", :per_page => "25" })
video.get_contacts_liked("user_id", { :page => "1", :per_page => "25", :full_response => "0", :sort => "newest" })
video.get_contacts_uploaded("user_id", { :page => "1", :per_page => "25", :full_response => "0", :sort => "newest" })
+ video.get_collections("video_id")
video.get_info("video_id")
video.get_likes("user_id", { :page => "1", :per_page => "25", :full_response => "0", :sort => "newest" })
video.get_subscriptions("user_id", { :page => "1", :per_page => "25", :full_response => "0", :sort => "newest" })
View
4 lib/vimeo/advanced/video.rb
@@ -57,6 +57,10 @@ class Video < Vimeo::Advanced::Base
"vimeo.videos.getInfo",
:required => [:video_id]
+ create_api_method :get_collections,
+ "vimeo.videos.getCollections",
+ :required => [:video_id]
+
create_api_method :get_likes,
"vimeo.videos.getLikes",
:required => [:user_id],
View
58 test/fixtures/advanced/video/get_collections.json
@@ -0,0 +1,58 @@
+{
+ "generated_in":"0.0352",
+ "stat":"ok",
+ "collections":{
+ "collection":[
+ {
+ "id":"238",
+ "name":"Paragliding",
+ "thumbnail":"http:\/\/b.vimeocdn.com\/ts\/271\/061\/271061013_200.jpg",
+ "type":"group"
+ },
+ {
+ "id":"69227",
+ "name":"ACRO PARAGLIDING",
+ "thumbnail":"http:\/\/b.vimeocdn.com\/ts\/269\/902\/269902809_200.jpg",
+ "type":"group"
+ },
+ {
+ "id":"3886",
+ "name":"Paragliding",
+ "thumbnail":"http:\/\/b.vimeocdn.com\/ts\/261\/654\/261654324_200.jpg",
+ "type":"channel"
+ },
+ {
+ "id":"246957",
+ "name":"Paragliding HD",
+ "thumbnail":"http:\/\/b.vimeocdn.com\/ts\/270\/993\/270993310_200.jpg",
+ "type":"channel"
+ },
+ {
+ "id":"61208",
+ "name":"VL",
+ "thumbnail":"http:\/\/b.vimeocdn.com\/ts\/252\/711\/252711076_200.jpg",
+ "type":"album"
+ }
+ ]
+ },
+ "urls":{
+ "url":[
+ {
+ "type":"group",
+ "_content":"http:\/\/vimeo.com\/groups\/paragliding\/videos\/38054508"
+ },
+ {
+ "type":"group",
+ "_content":"http:\/\/vimeo.com\/groups\/acroparagliding\/videos\/38054508"
+ },
+ {
+ "type":"channel",
+ "_content":"http:\/\/vimeo.com\/channels\/paragliding\/38054508"
+ },
+ {
+ "type":"channel",
+ "_content":"http:\/\/vimeo.com\/channels\/paraglidinghd\/38054508"
+ }
+ ]
+ }
+}
View
7 test/vimeo/advanced/videos_test.rb
@@ -85,6 +85,13 @@ class VideoTest < Test::Unit::TestCase
assert_equal "ok", response["stat"]
end
+ should "be able to get collections for a video" do
+ stub_post("?video_id=video_id&api_key=12345&format=json&method=vimeo.videos.getCollections&api_sig=0f1a7df7325961a0cf352da6264e913f", "advanced/video/get_collections.json")
+ response = @video.get_info("video_id")
+
+ assert_equal "ok", response["stat"]
+ end
+
should "be able to get info about a video" do
stub_post("?video_id=video_id&api_key=12345&format=json&method=vimeo.videos.getInfo&api_sig=0f1a7df7325961a0cf352da6264e913f", "advanced/video/get_info.json")
response = @video.get_info("video_id")

0 comments on commit 419b317

Please sign in to comment.