def normalize(params)
      params.sort.map do |k, values|
        if values.is_a?(Array)
          # make sure the array has an element so we don't lose the key
          values << nil if values.empty?
          # multiple values were provided for a single key
          values.sort.collect do |v|
            [escape(k),escape(v)] * "="
          end
        elsif values.is_a?(Hash)
          normalize_nested_query(values, k)
        else
          [escape(k),escape(values)] * "="
        end
      end * "&"
    end
def normalize(params)
      params.sort.map do |k, values|
        if values.is_a?(Array)
          # make sure the array has an element so we don't lose the key
          values << nil if values.empty?
          # multiple values were provided for a single key
          values.sort.collect do |v|
            [escape(k),escape(v)] * "="
          end
        elsif values.is_a?(Hash)
          normalize_nested_query(values, k)
        else
          [escape(k),escape(values)] * "="
        end
      end * "&"
    end
Normalize a +Hash+ of parameter values. Parameters are sorted by name, using lexicographical
 byte value ordering. If two or more parameters share the same name, they are sorted by their value.
 Parameters are concatenated in their sorted order into a single string. For each parameter, the name
 is separated from the corresponding value by an "=" character, even if the value is empty. Each
 name-value pair is separated by an "&" character.

 See Also: {OAuth core spec version 1.0, section 9.1.1}[http://oauth.net/core/1.0#rfc.section.9.1.1]