davetron5000-gliffy 0.9.4 → 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/gliffy/handle.rb +2 -1
- data/lib/gliffy/url.rb +15 -2
- data/lib/gliffy/version.rb +1 -1
- metadata +1 -1
data/lib/gliffy/handle.rb
CHANGED
@@ -330,11 +330,12 @@ module Gliffy
|
|
330
330
|
# [+parse+] if true, request is parsed; set to false to get the raw result back
|
331
331
|
# [+link_only+] don't make a request just send the full link (useful for <img> tags)
|
332
332
|
def make_request(method,url,params=nil,parse=true,link_only=false)
|
333
|
+
url = SignedURL::encodeParts(url)
|
333
334
|
update_token
|
334
335
|
if link_only
|
335
336
|
@request.link_for(method,url,params)
|
336
337
|
else
|
337
|
-
@logger.debug("Requesting #{url} with {
|
338
|
+
@logger.debug("Requesting #{url} with #{params.inspect}")
|
338
339
|
response = @request.send(method,url,params)
|
339
340
|
@logger.debug("Got back #{response.body}")
|
340
341
|
if parse
|
data/lib/gliffy/url.rb
CHANGED
@@ -16,10 +16,23 @@ module Gliffy
|
|
16
16
|
'oauth_timestamp' => true,
|
17
17
|
}
|
18
18
|
|
19
|
-
#
|
19
|
+
# Encodes each part of this url, accounting for some
|
20
|
+
# of the weirdness we are dealing with
|
21
|
+
def self.encodeParts(url)
|
22
|
+
parts = url.split(/\//).map do |part|
|
23
|
+
if part =~ /^\$/
|
24
|
+
part
|
25
|
+
else
|
26
|
+
encode(part)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
parts.join('/')
|
30
|
+
end
|
31
|
+
|
32
|
+
# Ruby's CGI::encode doesn't encode spaces correctly
|
20
33
|
def self.encode(string)
|
21
34
|
string.gsub(/([^ a-zA-Z0-9_.-]+)/n) do
|
22
|
-
|
35
|
+
'%' + $1.unpack('H2' * $1.size).join('%').upcase
|
23
36
|
end.gsub(' ', '%20')
|
24
37
|
end
|
25
38
|
|
data/lib/gliffy/version.rb
CHANGED