Remove usage of deprecated URI.escape

URI.escape is considered harmful and deprecated. It also raises many
warnings when running specs. This commit removes URI.escape and uses
CGI.escape on the uuid of resources.