Class: Squake::Util
Class Method Summary collapse
Class Method Details
.encode_parameters(params) ⇒ Object
13 14 15 |
# File 'lib/squake/util.rb', line 13 def self.encode_parameters(params) params.map { |k, v| "#{url_encode(k.to_s)}=#{url_encode(v)}" }.join('&') end |
.url_encode(key) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/squake/util.rb', line 21 def self.url_encode(key) CGI.escape(key.to_s). # Don't use strict form encoding by changing the square bracket control # characters back to their literals. This is fine by the server, and # makes these parameter strings easier to read. gsub('%5B', '[').gsub('%5D', ']') end |