diff --git a/README.markdown b/README.markdown index 23dca34..58c27ec 100644 --- a/README.markdown +++ b/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" }) diff --git a/lib/vimeo/advanced/video.rb b/lib/vimeo/advanced/video.rb index e09ff03..30bd4cb 100644 --- a/lib/vimeo/advanced/video.rb +++ b/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], diff --git a/test/fixtures/advanced/video/get_collections.json b/test/fixtures/advanced/video/get_collections.json new file mode 100644 index 0000000..f1d572c --- /dev/null +++ b/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" + } + ] + } +} \ No newline at end of file diff --git a/test/vimeo/advanced/videos_test.rb b/test/vimeo/advanced/videos_test.rb index 1882356..b18e414 100644 --- a/test/vimeo/advanced/videos_test.rb +++ b/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")