Created
October 2, 2009 04:35
-
-
Save isaiah/199468 to your computer and use it in GitHub Desktop.
Ruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.localankoder.com/video.xml -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