soda-ruby 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/soda/client.rb +9 -6
- data/lib/soda/version.rb +1 -1
- metadata +2 -2
data/lib/soda/client.rb
CHANGED
@@ -14,8 +14,7 @@ module SODA
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def get(resource, params = {})
|
17
|
-
|
18
|
-
query = params.collect{ |key, val| "#{key}=#{CGI::escape(val.to_s)}" }.join("&")
|
17
|
+
query = query_string(params)
|
19
18
|
|
20
19
|
# If we didn't get a full path, assume "/resource/"
|
21
20
|
if !resource.start_with?("/")
|
@@ -53,8 +52,7 @@ module SODA
|
|
53
52
|
end
|
54
53
|
|
55
54
|
def post(resource, body = "", params = {})
|
56
|
-
|
57
|
-
query = params.collect{ |key, val| "#{key}=#{CGI::escape(val)}" }.join("&")
|
55
|
+
query = query_string(params)
|
58
56
|
|
59
57
|
# If we didn't get a full path, assume "/resource/"
|
60
58
|
if !resource.start_with?("/")
|
@@ -94,8 +92,7 @@ module SODA
|
|
94
92
|
end
|
95
93
|
|
96
94
|
def put(resource, body = "", params = {})
|
97
|
-
|
98
|
-
query = params.collect{ |key, val| "#{key}=#{CGI::escape(val)}" }.join("&")
|
95
|
+
query = query_string(params)
|
99
96
|
|
100
97
|
# If we didn't get a full path, assume "/resource/"
|
101
98
|
if !resource.start_with?("/")
|
@@ -133,5 +130,11 @@ module SODA
|
|
133
130
|
end
|
134
131
|
end
|
135
132
|
end
|
133
|
+
|
134
|
+
private
|
135
|
+
def query_string(params)
|
136
|
+
# Create query string of escaped key, value pairs
|
137
|
+
return params.collect{ |key, val| "#{key}=#{CGI::escape(val.to_s)}" }.join("&")
|
138
|
+
end
|
136
139
|
end
|
137
140
|
end
|
data/lib/soda/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soda-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-12-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hashie
|