Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
require "rubygems"
require "hmac-sha1"
require "base64"
ankoder_access_key = ANKODER_ACCESS_KEY
ankoder_date ="%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 -X GET -H "ankoder_access_key: #{ankoder_access_key}" -H "ankoder_passkey: #{passkey}" -H "ankoder_date: #{ankoder_date}"`
puts res
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment