rest-client 1.4.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of rest-client might be problematic. Click here for more details.
- data/VERSION +1 -1
- data/history.md +4 -0
- data/lib/restclient/payload.rb +2 -2
- data/spec/payload_spec.rb +8 -3
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.4.
|
1
|
+
1.4.1
|
data/history.md
CHANGED
data/lib/restclient/payload.rb
CHANGED
@@ -58,10 +58,10 @@ module RestClient
|
|
58
58
|
params.each do |key, value|
|
59
59
|
calculated_key = parent_key ? "#{parent_key}[#{escape key}]" : escape(key)
|
60
60
|
if value.is_a? Hash
|
61
|
-
result
|
61
|
+
result += flatten_params(value, calculated_key)
|
62
62
|
elsif value.is_a? Array
|
63
63
|
value.each do |elem|
|
64
|
-
result << [calculated_key, elem]
|
64
|
+
result << ["#{calculated_key}[]", elem]
|
65
65
|
end
|
66
66
|
else
|
67
67
|
result << [calculated_key, value]
|
data/spec/payload_spec.rb
CHANGED
@@ -21,6 +21,11 @@ describe RestClient::Payload do
|
|
21
21
|
should == "foo[bar][baz]=qux"
|
22
22
|
end
|
23
23
|
|
24
|
+
it "should handle many attributes inside a hash" do
|
25
|
+
parameters = RestClient::Payload::UrlEncoded.new({:foo => {:bar => 'baz', :baz => 'qux'}}).to_s
|
26
|
+
parameters.should include("foo[bar]=baz", "foo[baz]=qux")
|
27
|
+
end
|
28
|
+
|
24
29
|
it "should form properly use symbols as parameters" do
|
25
30
|
RestClient::Payload::UrlEncoded.new({:foo => :bar}).to_s.
|
26
31
|
should == "foo=bar"
|
@@ -28,11 +33,11 @@ describe RestClient::Payload do
|
|
28
33
|
should == "foo[bar]=baz"
|
29
34
|
end
|
30
35
|
|
31
|
-
it "should
|
36
|
+
it "should properly handle arrays as repeated parameters" do
|
32
37
|
RestClient::Payload::UrlEncoded.new({:foo => ['bar']}).to_s.
|
33
|
-
should == "foo=bar"
|
38
|
+
should == "foo[]=bar"
|
34
39
|
RestClient::Payload::UrlEncoded.new({:foo => ['bar', 'baz']}).to_s.
|
35
|
-
should == "foo=bar&foo=baz"
|
40
|
+
should == "foo[]=bar&foo[]=baz"
|
36
41
|
end
|
37
42
|
|
38
43
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 4
|
8
|
-
-
|
9
|
-
version: 1.4.
|
8
|
+
- 1
|
9
|
+
version: 1.4.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Adam Wiggins
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-03-05 00:00:00 +01:00
|
19
19
|
default_executable: restclient
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|