grac 2.2.1 → 2.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/grac/client.rb +12 -2
- data/lib/grac/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 280ed2bb063aec54e36cdbae1273eed77bf6d7a8
|
4
|
+
data.tar.gz: a3f5f241c7b34fe9f1bb22de72b15b199038def1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00fac6601b78e14c03f9f6e12010675187d664d59c46e928ac84dee53b65a4cc66f03c526b9c1ecd89976b95fc39d76ded2f35faab1c4fd0b050c717ee64e884
|
7
|
+
data.tar.gz: 36cc32054886343c9d792eab5b7b24aeeb3a7c935c703b0742dd6d6317b6bff49ddea6d783a60b5f509bea9f7b35cad1cf1d7378a49baeed8a26b2a47f3d53f1
|
data/lib/grac/client.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'cgi'
|
1
2
|
require 'json'
|
2
3
|
require 'typhoeus'
|
3
4
|
require 'uri'
|
@@ -42,7 +43,7 @@ module Grac
|
|
42
43
|
|
43
44
|
def path(path, variables = {})
|
44
45
|
variables.each do |key, value|
|
45
|
-
path = path.gsub("{#{key}}", value)
|
46
|
+
path = path.gsub("{#{key}}", escape_url_param(value))
|
46
47
|
end
|
47
48
|
self.class.new("#{@uri}#{path}", @options)
|
48
49
|
end
|
@@ -64,7 +65,7 @@ module Grac
|
|
64
65
|
def call(opts, request_uri, method, params, body)
|
65
66
|
request_hash = {
|
66
67
|
:method => method,
|
67
|
-
:params => params,
|
68
|
+
:params => params, # Query params are escaped by Typhoeus
|
68
69
|
:body => body,
|
69
70
|
:connecttimeout => opts[:connecttimeout],
|
70
71
|
:timeout => opts[:timeout],
|
@@ -162,5 +163,14 @@ module Grac
|
|
162
163
|
|
163
164
|
return data
|
164
165
|
end
|
166
|
+
|
167
|
+
def escape_url_param(value)
|
168
|
+
# We don't want spaces to be encoded as plus sign - a plus sign can be ambiguous in a URL and
|
169
|
+
# either represent a plus sign or a space.
|
170
|
+
# CGI::escape replaces all plus signs with their percent-encoding representation, so all
|
171
|
+
# remaining plus signs are spaces. Replacing these with a space's percent encoding makes the
|
172
|
+
# encoding unambiguous.
|
173
|
+
CGI::escape(value).gsub('+', '%20')
|
174
|
+
end
|
165
175
|
end
|
166
176
|
end
|
data/lib/grac/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grac
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Schoknecht
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
126
|
version: '0'
|
127
127
|
requirements: []
|
128
128
|
rubyforge_project:
|
129
|
-
rubygems_version: 2.
|
129
|
+
rubygems_version: 2.4.8
|
130
130
|
signing_key:
|
131
131
|
specification_version: 4
|
132
132
|
summary: Very generic client for REST API with basic error handling
|