Class: Polar::SignatureCalculator
- Inherits:
-
Object
- Object
- Polar::SignatureCalculator
- Defined in:
- lib/polar/signature_calculator.rb
Instance Method Summary collapse
- #calculate(hash) ⇒ Object
-
#initialize(secret_key) ⇒ SignatureCalculator
constructor
A new instance of SignatureCalculator.
Constructor Details
#initialize(secret_key) ⇒ SignatureCalculator
Returns a new instance of SignatureCalculator.
6 7 8 |
# File 'lib/polar/signature_calculator.rb', line 6 def initialize(secret_key) @secret_key = secret_key end |
Instance Method Details
#calculate(hash) ⇒ Object
10 11 12 |
# File 'lib/polar/signature_calculator.rb', line 10 def calculate(hash) Digest::MD5.hexdigest(hash.collect { |(k, v)| "#{k}=#{v}" }.sort * "" << @secret_key) end |