Method: SparkApi::Authentication::ApiAuth#build_param_string

Defined in:
lib/spark_api/authentication/api_auth.rb

#build_param_string(param_hash) ⇒ Object

Builds an ordered list of key value pairs and concatenates it all as one big string. Used specifically for signing a request.



39
40
41
42
43
44
45
46
47
48
49
# File 'lib/spark_api/authentication/api_auth.rb', line 39

def build_param_string(param_hash)
  return "" if param_hash.nil?
    sorted = param_hash.keys.sort do |a,b|
      a.to_s <=> b.to_s
    end
    params = ""
    sorted.each do |key|
      params += key.to_s + param_hash[key].to_s
    end
    params
end