Skip to content

Commit

Permalink
Adding video.get_collections for Advanced api
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan committed Mar 28, 2012
1 parent 8271b4e commit 34301c6
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.markdown
Expand Up @@ -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" })
Expand Down
4 changes: 4 additions & 0 deletions lib/vimeo/advanced/video.rb
Expand Up @@ -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],
Expand Down
58 changes: 58 additions & 0 deletions 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"
}
]
}
}
7 changes: 7 additions & 0 deletions test/vimeo/advanced/videos_test.rb
Expand Up @@ -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")
Expand Down

0 comments on commit 34301c6

Please sign in to comment.