Module: BOTR::Authentication
Instance Method Summary collapse
Instance Method Details
#signature(params = {}) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/botr/api/authentication.rb', line 7 def signature(params = {}) sorted_params = {} str_params = "" # Sort params by key (hashes maintain insertion order) params.keys.sort.each do |key| sorted_params[key] = params[key] end # URL encode params str_params = URI.encode_www_form(sorted_params) Digest::SHA1.hexdigest str_params + api_secret_key end |