Skip to content

Instantly share code, notes, and snippets.

@aitor
Created May 14, 2012 21:43
Show Gist options
  • Save aitor/2697469 to your computer and use it in GitHub Desktop.
Save aitor/2697469 to your computer and use it in GitHub Desktop.
class VgVimeo
def initialize(url=nil, options={})
# general settings
@url = url
@video_id = parse_url(url)
res = Net::HTTP.get(URI.parse("http://vimeo.com/api/v2/video/#{@video_id}.xml"))
@feed = REXML::Document.new(res)
end
def title
REXML::XPath.first( @feed, "//title" )[0].to_s
end
def thumbnail
REXML::XPath.first( @feed, "//thumbnail_large" )[0].to_s
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment