Method: Lily#format_params

Defined in:
lib/lily.rb

#format_params(params) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/lily.rb', line 32

def format_params(params)
  path_arr = []
  sig_str = ""
  params = params.sort_by { |key, value| key }
  params.each do |key, value|
    path_arr.push("#{key}=" + URI.encode(value.to_s))
    sig_str += key + value.to_s if (key != "format")
  end
  sig_str += @keys.private
  sig = Digest::MD5.hexdigest(sig_str)
  path_arr.push("api_sig=#{sig}")
  path = path_arr.join("&")
  return path
end