Module: Appoxy::Api::Signatures
- Defined in:
- lib/api/signatures.rb
Class Method Summary collapse
- .generate_signature(operation, timestamp, secret_key) ⇒ Object
- .generate_timestamp(gmtime) ⇒ Object
- .hash_to_s(hash) ⇒ Object
Class Method Details
.generate_signature(operation, timestamp, secret_key) ⇒ Object
12 13 14 15 16 |
# File 'lib/api/signatures.rb', line 12 def self.generate_signature(operation, , secret_key) my_sha_hmac = Digest::HMAC.digest(operation + , secret_key, Digest::SHA1) my_b64_hmac_digest = Base64.encode64(my_sha_hmac).strip return my_b64_hmac_digest end |
.generate_timestamp(gmtime) ⇒ Object
7 8 9 |
# File 'lib/api/signatures.rb', line 7 def self.(gmtime) return gmtime.strftime("%Y-%m-%dT%H:%M:%SZ") end |
.hash_to_s(hash) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/api/signatures.rb', line 19 def self.hash_to_s(hash) str = "" hash.sort.each { |a| str+= "#{a[0]}#{a[1]}" } #removing all characters that could differ after parsing with rails return str.delete "\"\/:{}[]\' T" end |