Method: VivialConnect::Client#get_canonicalized_query_string
- Defined in:
- lib/vivialconnect/client.rb
#get_canonicalized_query_string(url) ⇒ Object
182 183 184 185 186 187 188 189 |
# File 'lib/vivialconnect/client.rb', line 182 def get_canonicalized_query_string(url) return "" unless url.query_values sorted_params = url.query_values.sort # gsub because Addressable encodes an empty space as + in parameters # and vivial connect api requires spaces to be %20 encoded # http://stackoverflow.com/questions/2824126/whats-the-difference-between-uri-escape-and-cgi-escape encoded_sorted_params = Addressable::URI.form_encode(sorted_params).gsub('+', '%20') end |