songkick-transport 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/songkick/transport/serialization.rb +8 -6
- data/spec/songkick/transport_spec.rb +2 -2
- metadata +3 -3
- data/examples/foo.rb +0 -9
@@ -16,7 +16,7 @@ module Songkick
|
|
16
16
|
def build_query_string(params, fully_encode = true, sanitize = false)
|
17
17
|
return params if String === params
|
18
18
|
pairs = []
|
19
|
-
each_qs_param('', params) do |key, value|
|
19
|
+
each_qs_param('', params, fully_encode) do |key, value|
|
20
20
|
value = SANITIZED_VALUE if sanitize and sanitize?(key)
|
21
21
|
pairs << [key, value]
|
22
22
|
end
|
@@ -30,19 +30,21 @@ module Songkick
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
def each_qs_param(prefix, value, &block)
|
33
|
+
def each_qs_param(prefix, value, fully_encode = true, &block)
|
34
34
|
case value
|
35
35
|
when Array
|
36
|
-
value.each { |e| each_qs_param(prefix + "[]", e, &block) }
|
36
|
+
value.each { |e| each_qs_param(prefix + "[]", e, fully_encode, &block) }
|
37
37
|
when Hash
|
38
38
|
value.each do |k,v|
|
39
|
-
|
40
|
-
|
39
|
+
encoded = fully_encode ? CGI.escape(k.to_s) : k.to_s
|
40
|
+
key = (prefix == '') ? encoded : prefix + "[#{encoded}]"
|
41
|
+
each_qs_param(key, v, fully_encode, &block)
|
41
42
|
end
|
42
43
|
when Transport::IO
|
43
44
|
block.call(prefix, value)
|
44
45
|
else
|
45
|
-
|
46
|
+
encoded = fully_encode ? CGI.escape(value.to_s) : value.to_s
|
47
|
+
block.call(prefix, encoded)
|
46
48
|
end
|
47
49
|
end
|
48
50
|
|
@@ -119,7 +119,7 @@ describe Songkick::Transport do
|
|
119
119
|
let(:upload) { Songkick::Transport::IO.new(file, "image/jpeg", "songkick.png") }
|
120
120
|
|
121
121
|
let :params do
|
122
|
-
{:concert => {:file => upload, :foo =>
|
122
|
+
{:concert => {:file => upload, :foo => "me@thing.com"}}
|
123
123
|
end
|
124
124
|
|
125
125
|
let :expected_response do
|
@@ -127,7 +127,7 @@ describe Songkick::Transport do
|
|
127
127
|
"filename" => "songkick.png",
|
128
128
|
"method" => @http_method,
|
129
129
|
"size" => 6694,
|
130
|
-
"foo" => "
|
130
|
+
"foo" => "me@thing.com"
|
131
131
|
}
|
132
132
|
end
|
133
133
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: songkick-transport
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
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: 2013-
|
12
|
+
date: 2013-04-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multipart-post
|
@@ -151,7 +151,6 @@ files:
|
|
151
151
|
- examples/loop.rb
|
152
152
|
- examples/thread_safety.rb
|
153
153
|
- examples/server.rb
|
154
|
-
- examples/foo.rb
|
155
154
|
- examples/example.rb
|
156
155
|
- lib/songkick/transport/request.rb
|
157
156
|
- lib/songkick/transport/rack_test.rb
|
@@ -200,3 +199,4 @@ signing_key:
|
|
200
199
|
specification_version: 3
|
201
200
|
summary: HTTP client abstraction for service clients
|
202
201
|
test_files: []
|
202
|
+
has_rdoc:
|