Class: RightAws::AwsUtils

Inherits:
Object show all
Defined in:
lib/awsbase/right_awsbase.rb

Overview

:nodoc:

Class Method Summary collapse

Class Method Details

.sign(aws_secret_access_key, auth_string) ⇒ Object



29
30
31
# File 'lib/awsbase/right_awsbase.rb', line 29

def self.sign(aws_secret_access_key, auth_string)
  Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new("sha1"), aws_secret_access_key, auth_string)).strip
end

.URLencode(raw) ⇒ Object

From Amazon’s SQS Dev Guide, a brief description of how to escape: “URL encode the computed signature and other query parameters as specified in RFC1738, section 2.2. In addition, because the + character is interpreted as a blank space by Sun Java classes that perform URL decoding, make sure to encode the + character although it is not required by RFC1738.” Avoid using CGI::escape to escape URIs. CGI::escape will escape characters in the protocol, host, and port sections of the URI. Only target chars in the query string should be escaped.



42
43
44
45
# File 'lib/awsbase/right_awsbase.rb', line 42

def self.URLencode(raw)
  e = URI.escape(raw)
  e.gsub(/\+/, "%2b")
end