Class: ParamsHash

Inherits:
Hash
  • Object
show all
Defined in:
lib/bitly_oauth/lib/core_ext/hash.rb

Instance Method Summary collapse

Methods inherited from Hash

#stringify_keys, #stringify_keys!, #symbolize_keys, #symbolize_keys!

Instance Method Details

#to_queryObject



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/bitly_oauth/lib/core_ext/hash.rb', line 26

def to_query
  map do |key, value|
    case value
    when Array
      value.map do |v|
        "#{key}=#{CGI.escape(v.to_s)}"
      end.join('&')
    else
      "#{key}=#{CGI.escape(value.to_s)}"
    end
  end.sort * '&'
end