Method: Koala::HTTPService.encode_params
- Defined in:
- lib/koala/http_service.rb
.encode_params(param_hash) ⇒ Object
Encodes a given hash into a query string. This is used mainly by the Batch API nowadays, since Faraday handles this for regular cases.
112 113 114 115 116 117 |
# File 'lib/koala/http_service.rb', line 112 def self.encode_params(param_hash) ((param_hash || {}).sort_by{|k, v| k.to_s}.collect do |key_and_value| key_and_value[1] = MultiJson.dump(key_and_value[1]) unless key_and_value[1].is_a? String "#{key_and_value[0].to_s}=#{CGI.escape key_and_value[1]}" end).join("&") end |