public
Last active — forked from isaiah/gist:199468

  • Download Gist
gistfile1.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
require "rubygems"
require "hmac-sha1"
require "base64"
ankoder_access_key = ANKODER_ACCESS_KEY
private_key = ANKODER_PRIVATE_KEY
ankoder_date = Time.now.strftime("%a, %d %b %Y %X GMT")
ankoder_action = "GET"
ankoder_path = "/video.xml"
string = "-#{ankoder_date}-#{ankoder_action}-#{ankoder_path}-"
 
salt = Digest::SHA1.hexdigest(string)[0..19]
 
passkey = Base64.encode64(HMAC::SHA1::digest(private_key, salt)).strip
 
res = `curl api.ankoder.com/video.xml -X GET -H "ankoder_access_key: #{ankoder_access_key}" -H "ankoder_passkey: #{passkey}" -H "ankoder_date: #{ankoder_date}"`
 
puts res

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.