transport 1.0.0 → 1.0.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.
data/README.rdoc
CHANGED
@@ -52,7 +52,7 @@ possible on JSON requests. But a few differences should be mentioned here.
|
|
52
52
|
* The <tt>Accept</tt> header will be set to <tt>application/json</tt> anyway.
|
53
53
|
* If a request body is specified, the <tt>Content-Type</tt> will also be set to <tt>application/json</tt> cause only
|
54
54
|
json data should be transferred.
|
55
|
-
* If the option <tt>encode_parameters</tt> is set
|
55
|
+
* If the option <tt>encode_parameters</tt> is set to true, all parameters will be encoded to json, before encoded to
|
56
56
|
the url. This makes it possible to transfer more complex parameters like arrays and hashes.
|
57
57
|
* The response body will also be parsed to json.
|
58
58
|
|
@@ -106,4 +106,4 @@ defined in the YML file, it will raises a <tt>Transport::Spec::Faker::NoFakeRequ
|
|
106
106
|
|
107
107
|
== Development
|
108
108
|
|
109
|
-
This project is still
|
109
|
+
This project is still under development. Any bug report and contribution is welcome!
|
@@ -36,14 +36,14 @@ module Transport
|
|
36
36
|
@result = if @parameters.nil? || @parameters.empty?
|
37
37
|
nil
|
38
38
|
else
|
39
|
-
@quoted_parameters.
|
40
|
-
self.class.pair key,
|
39
|
+
@quoted_parameters.keys.sort.map do |key|
|
40
|
+
self.class.pair key, @quoted_parameters[key]
|
41
41
|
end.join("&")
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
45
|
def self.escape(value)
|
46
|
-
value.is_a?(Array) ? value.map{ |element| CGI.escape element } : CGI.escape(value)
|
46
|
+
value.is_a?(Array) ? value.map{ |element| CGI.escape element.to_s } : CGI.escape(value.to_s)
|
47
47
|
end
|
48
48
|
|
49
49
|
def self.pair(key, value)
|
@@ -10,9 +10,9 @@ describe Transport::HTTP::RequestBuilder::ParameterSerializer do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
it "should return a correctly encoded query string" do
|
13
|
-
serializer = described_class.new :foo => "bar", :test => [ "value1", "value2" ]
|
13
|
+
serializer = described_class.new :foo => "bar", :test => [ "value1", "value2", true ], :another_test => 5
|
14
14
|
serializer.perform
|
15
|
-
serializer.result.should == "foo=bar&test=value1&test=value2"
|
15
|
+
serializer.result.should == "another_test=5&foo=bar&test=value1&test=value2&test=true"
|
16
16
|
end
|
17
17
|
|
18
18
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
8
|
+
- 1
|
9
|
+
version: 1.0.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- "Philipp Br\xC3\xBCll"
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-11-
|
17
|
+
date: 2010-11-30 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|