ruby-vodpod
文件大小: unknow
源码售价: 5 个金币 积分规则     积分充值
资源说明:Ruby bindings for the Vodpod API.
Vodpod - Ruby bindings for the Vodpod API.
==========================================

Vodpod is a web site that allows you to collect videos. This library lets you
interact with those collections and videos over their REST-style API, using
clean Ruby. Maybe you want to integrate with a content management system, or
copy videos automatically from a social bookmarking site.  Be creative. :-)

You can search for videos, retrieve users, collections, videos, and their tags and comments. You can filter by tags, sort and paginate every dataset, and generally be awesome.

Source code: http://github.com/aphyr/ruby-vodpod.

Gem: gem install vodpod

Examples
--------

Vodpod.start(:api_key => '...', :auth_key => '...') do |v|
  # View the user associated with this API key
  v.me 
  #=> #"Spencer", "thumbnail"=>"http://s3.amazonaws.com/vodpod.com.users.image/8.medium.jpg", "videos_count"=>670, "description"=>"Co-founder and Engineer at Vodpod", "key"=>"spencer"}>

  # Attributes are accessed like so...
  v.me.name #=> "Spencer"

  # Get a user, with some extra attributes
  v.user :aphyr, :include => [:collections, :followers] 
  #=> #"aphyr", "collections"=>[#"aphyr's videos", "key"=>"aphyr"}>], "followers"=>[#"Spencer", "thumbnail"=>"http://s3.amazonaws.com/vodpod.com.users.image/8.medium.jpg", "key"=>"spencer"}>, #"pkulak", "thumbnail"=>"http://s3.amazonaws.com/vodpod.com.users.image/11221.medium.jpg", "key"=>"pkulak"}>], "thumbnail"=>"http://s3.amazonaws.com/vodpod.com.users.image/493234.medium.jpg", "videos_count"=>69, "description"=>"I'm a developer here at Vodpod. I'm also a freelance photographer, Aikido nut, gamer, book enthusiast, and physics and math geek.", "key"=>"aphyr"}>

  # Associated objects are automatically instantiated.
  v.user(:aphyr, :include => :collections).collections
  # => [#"aphyr's videos", "key"=>"aphyr"}>]

  # You can get more detail about a collection with collection(user_key,
  # collection_key). Let's build a tag cloud for aphyr's collection named
  # "aphyr".
  v.collection(:aphyr, :aphyr, :include => :tags).tags.map { |t| t.count, t.name }
  # => [[16, "funny"], [12, "awesome"], [6, "music"], [4, "trailer"], [4, "game"], [3, "apple"], [3, "ruby"], [3, "_why"], [3, "math"], [3, "fail"], [3, "robot"], [3, "lego"], [3, "neotokyo"], [2, "future-occupation?"], [2, "microsoft"], [2, "gay"], [2, "cat"], [2, "evil"], [2, "parkour"], [2, "science fiction"]]

  # You can find videos by searching...
  v.search(:kittens, :limit => 1, :offset => 14).first
  # => #"", "total_views"=>77, "created_at"=>#, "title"=>"Samson the Kitten", "video_host"=>{"url"=>"http://www.youtube.com/v/jn0Fo0Mt6xo", "domain"=>"youtube.com", "description"=>"Zachary gets Samson nodding and shaking his head."}, "thumbnail"=>"http://assetscdn.vodpod.com/images/missing_video_100.gif", "down_votes"=>0, "url"=>"http://vodpod.com/watch/29740-samson-the-kitten", "up_votes"=>0, "embed"=>"", "description"=>nil, "key"=>29740}>

  # Or by tags...
  v.videos(:tags => ['star trek', :bloopers]).total
  # => 494
  
  # You can retrieve specific videos if you know their key
  v.video(29740)
  # => (same video as from search)

  # You can also get CollectionVideos--the version of a video belonging to a
  # specific user/collection.
  v.videos(:spencer, :electro, :limit => 1).first
  # => #"", "total_views"=>3, "created_at"=>#, "title"=>"Crystal Castles - Knights", "video_host"=>{"url"=>"http://www.pitchforkmedia.com/article/download/145440-video-crystal-castles-knights", "domain"=>"pitchforkmedia.com", "description"=>""}, "thumbnail"=>"http://img.vodpod.com/1002751.medium100.jpg", "down_votes"=>0, "url"=>"http://vodpod.com/watch/1002751-crystal-castles-knights?pod=electro", "up_votes"=>1, "embed"=>"", "description"=>"", "key"=>1002751}>
end

You can contact support@vodpod.com for help with the toolkit. Patches welcome
on github!

本源码包内暂不包含可直接显示的源代码文件,请下载源码包。