Class: Ralexa::UriSigner
- Inherits:
-
Object
- Object
- Ralexa::UriSigner
- Defined in:
- lib/ralexa/uri_signer.rb
Constant Summary collapse
- SIGNATURE_VERSION =
2
Instance Attribute Summary collapse
-
#base64_encoder ⇒ Object
writeonly
Sets the attribute base64_encoder.
-
#digest ⇒ Object
writeonly
dependency injectors.
-
#hmac_signer ⇒ Object
writeonly
Sets the attribute hmac_signer.
-
#time_utc ⇒ Object
writeonly
Sets the attribute time_utc.
Instance Method Summary collapse
-
#initialize(access_key_id, secret_access_key) ⇒ UriSigner
constructor
A new instance of UriSigner.
- #sign_uri(original_uri) ⇒ Object
Constructor Details
#initialize(access_key_id, secret_access_key) ⇒ UriSigner
Returns a new instance of UriSigner.
10 11 12 13 |
# File 'lib/ralexa/uri_signer.rb', line 10 def initialize(access_key_id, secret_access_key) @access_key_id = access_key_id @secret_access_key = secret_access_key end |
Instance Attribute Details
#base64_encoder=(value) ⇒ Object
Sets the attribute base64_encoder
18 19 20 |
# File 'lib/ralexa/uri_signer.rb', line 18 def base64_encoder=(value) @base64_encoder = value end |
#digest=(value) ⇒ Object
dependency injectors
16 17 18 |
# File 'lib/ralexa/uri_signer.rb', line 16 def digest=(value) @digest = value end |
#hmac_signer=(value) ⇒ Object
Sets the attribute hmac_signer
17 18 19 |
# File 'lib/ralexa/uri_signer.rb', line 17 def hmac_signer=(value) @hmac_signer = value end |
#time_utc=(value) ⇒ Object
Sets the attribute time_utc
19 20 21 |
# File 'lib/ralexa/uri_signer.rb', line 19 def time_utc=(value) @time_utc = value end |
Instance Method Details
#sign_uri(original_uri) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/ralexa/uri_signer.rb', line 21 def sign_uri(original_uri) original_uri.dup.tap do |uri| add_query_values(uri, "AWSAccessKeyId" => @access_key_id, "Timestamp" => , "SignatureVersion" => SIGNATURE_VERSION.to_s, "SignatureMethod" => signature_method, ) add_query_values(uri, "Signature" => signature(uri) ) end end |