Skip to content

Instantly share code, notes, and snippets.

@benbonnet
Created May 28, 2009 13:59
Show Gist options
  • Save benbonnet/119312 to your computer and use it in GitHub Desktop.
Save benbonnet/119312 to your computer and use it in GitHub Desktop.
@keyword = params[:search][:keyword]
keyword = CGI::escape(@keyword)
method = "vimeo.videos.search"
api_key = "xxxxx"
secret = "xxxxx"
query = "ruby"
sig_base = "#{secret}api_key#{api_key}fullResponse1method#{method}query#{@keyword}" ## LE MOT CLE DANS LA SIGNATURE NE DOIT PAS ETRE PASSÉ EN CGI.
api_sig = Digest::MD5.hexdigest(sig_base)
@feed_url = "http://vimeo.com/api/rest?api_key=#{api_key}&fullResponse=1&method=#{method}&query=#{keyword}&api_sig=#{api_sig}"
# FULL RESPONSE, UN PEU PLUS LENT ####################################################################
#### ajouter fullResponse=1, dans la signature (ne pas oublier ordre alpha), dans les paramètres. ####
# sig_base = "#{secret}api_key#{api_key}fullResponse1method#{method}query#{query}"
# api_sig = Digest::MD5.hexdigest(sig_base)
# url = "http://vimeo.com/api/rest?api_key=#{api_key}&fullResponse=1&method=#{method}&query=#{query}&fullResponse=1&api_sig=#{api_sig}"
@doc = Hpricot.parse(open(@feed_url))
render(:update) do |page|
page.replace_html "api_content", :partial => "vimeo/search"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment