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.
@@ -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 {#params.inspect}")
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
@@ -16,10 +16,23 @@ module Gliffy
16
16
  'oauth_timestamp' => true,
17
17
  }
18
18
 
19
- # Ruby's SignedURL::encode doesn't encode spaces correctly
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
- '%' + $1.unpack('H2' * $1.size).join('%').upcase
35
+ '%' + $1.unpack('H2' * $1.size).join('%').upcase
23
36
  end.gsub(' ', '%20')
24
37
  end
25
38
 
@@ -1,4 +1,4 @@
1
1
  # Generated by rake update_version
2
2
  module Gliffy
3
- GLIFFY_VERSION = '0.9.4'
3
+ GLIFFY_VERSION = '0.9.5'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: davetron5000-gliffy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Copeland