Class: HmacSignature::Signature
- Inherits:
-
Struct
- Object
- Struct
- HmacSignature::Signature
- Defined in:
- lib/hmac_signature/signature.rb
Constant Summary collapse
- VERSION =
"1.0"
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#method ⇒ Object
Returns the value of attribute method.
-
#params ⇒ Object
Returns the value of attribute params.
-
#path ⇒ Object
Returns the value of attribute path.
-
#secret ⇒ Object
Returns the value of attribute secret.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key
4 5 6 |
# File 'lib/hmac_signature/signature.rb', line 4 def key @key end |
#method ⇒ Object
Returns the value of attribute method
4 5 6 |
# File 'lib/hmac_signature/signature.rb', line 4 def method @method end |
#params ⇒ Object
Returns the value of attribute params
4 5 6 |
# File 'lib/hmac_signature/signature.rb', line 4 def params @params end |
#path ⇒ Object
Returns the value of attribute path
4 5 6 |
# File 'lib/hmac_signature/signature.rb', line 4 def path @path end |
#secret ⇒ Object
Returns the value of attribute secret
4 5 6 |
# File 'lib/hmac_signature/signature.rb', line 4 def secret @secret end |
#timestamp ⇒ Object
Returns the value of attribute timestamp
4 5 6 |
# File 'lib/hmac_signature/signature.rb', line 4 def @timestamp end |
#version ⇒ Object
Returns the value of attribute version
4 5 6 |
# File 'lib/hmac_signature/signature.rb', line 4 def version @version end |
Instance Method Details
#string_to_sign ⇒ Object
12 13 14 |
# File 'lib/hmac_signature/signature.rb', line 12 def string_to_sign [method, path, parameter_string].join("\n") end |
#to_s ⇒ Object
7 8 9 10 |
# File 'lib/hmac_signature/signature.rb', line 7 def to_s digest = OpenSSL::Digest::SHA256.new OpenSSL::HMAC.hexdigest(digest, secret, string_to_sign) end |