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 CHANGED
@@ -1 +1 @@
1
- 1.4.0
1
+ 1.4.1
data/history.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 1.4.1
2
+
3
+ - fixed parameters managment when using hash
4
+
1
5
  # 1.4.0
2
6
 
3
7
  - Response is no more a String, and the mixin is replaced by an abstract_response, existing calls are redirected to response body with a warning.
@@ -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 << flatten_params(value, calculated_key).flatten
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]
@@ -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 properyl handle arrays as repeated parameters" do
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
- - 0
9
- version: 1.4.0
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-02-22 00:00:00 +01:00
18
+ date: 2010-03-05 00:00:00 +01:00
19
19
  default_executable: restclient
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency