peakium 0.1.1 → 0.1.2
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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/peakium/util.rb +4 -4
- data/lib/peakium/version.rb +1 -1
- data/test/peakium/api_resource_test.rb +6 -3
- data/test/peakium/submission_form_test.rb +1 -1
- data/test/peakium/util_test.rb +11 -0
- data/test/test_helper.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad6fa15589cfc6f99c51e0c63b5fbce1e357a494
|
4
|
+
data.tar.gz: 9e626d881d802bd0ce907ea9ea063a3cfd1ddefa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2bb3011d97ee05912167fb8d3927fa34f048b2045428704ba04e3d630bbabdd0e7f4ad61013589341b8e669bef2755b9e63e5579101ab8804c5e2b862b3c98a
|
7
|
+
data.tar.gz: afb6312f0cedb87f5ac36f7a28ab0773f5e053025dfae3a8ff8600980943cdda4387f4af691921289b3c5b150b07b97205b60a31b2e24b2cb30ebcbfca7ff9f7
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/lib/peakium/util.rb
CHANGED
@@ -92,13 +92,13 @@ module Peakium
|
|
92
92
|
|
93
93
|
def self.flatten_params_array(value, calculated_key)
|
94
94
|
result = []
|
95
|
-
value.
|
95
|
+
value.each_with_index do |elem,index|
|
96
96
|
if elem.is_a?(Hash)
|
97
|
-
result += flatten_params(elem, calculated_key)
|
97
|
+
result += flatten_params(elem, calculated_key + "[#{index}]")
|
98
98
|
elsif elem.is_a?(Array)
|
99
|
-
result += flatten_params_array(elem, calculated_key)
|
99
|
+
result += flatten_params_array(elem, calculated_key + "[#{index}]")
|
100
100
|
else
|
101
|
-
result << ["#{calculated_key}[]", elem]
|
101
|
+
result << ["#{calculated_key}[#{index}]", elem]
|
102
102
|
end
|
103
103
|
end
|
104
104
|
result
|
data/lib/peakium/version.rb
CHANGED
@@ -282,32 +282,35 @@ module Peakium
|
|
282
282
|
response = test_response(test_missing_id_error, 404)
|
283
283
|
@mock.expects(:get).once.raises(RestClient::ExceptionWithResponse.new(response, 404))
|
284
284
|
|
285
|
+
rescued = false
|
285
286
|
begin
|
286
287
|
Peakium::Gateway.new("gw_test_gateway").refresh
|
287
288
|
assert false #shouldn't get here either
|
288
289
|
rescue Peakium::InvalidRequestError => e # we don't use assert_raises because we want to examine e
|
290
|
+
rescued = true
|
289
291
|
assert e.kind_of? Peakium::InvalidRequestError
|
290
292
|
assert_equal "id", e.param
|
291
293
|
assert_equal "Missing id", e.message
|
292
294
|
return
|
293
295
|
end
|
294
296
|
|
295
|
-
|
297
|
+
assert_equal true, rescued
|
296
298
|
end
|
297
299
|
|
298
300
|
should "5XXs should raise an APIError" do
|
299
301
|
response = test_response(test_api_error, 500)
|
300
302
|
@mock.expects(:get).once.raises(RestClient::ExceptionWithResponse.new(response, 500))
|
301
303
|
|
304
|
+
rescued = false
|
302
305
|
begin
|
303
306
|
Peakium::Gateway.new("gw_test_gateway").refresh
|
304
307
|
assert false #shouldn't get here either
|
305
308
|
rescue Peakium::APIError => e # we don't use assert_raises because we want to examine e
|
309
|
+
rescued = true
|
306
310
|
assert e.kind_of? Peakium::APIError
|
307
|
-
return
|
308
311
|
end
|
309
312
|
|
310
|
-
|
313
|
+
assert_equal true, rescued
|
311
314
|
end
|
312
315
|
end
|
313
316
|
end
|
@@ -6,7 +6,7 @@ module Peakium
|
|
6
6
|
should "create should return a new submission form" do
|
7
7
|
@mock.expects(:post).once.returns(test_response(test_submission_form))
|
8
8
|
sf = Peakium::SubmissionForm.build('create_subscription', {:customer => "test_customer"})
|
9
|
-
assert_equal "<
|
9
|
+
assert_equal "<form></form>", sf.html
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
data/test/peakium/util_test.rb
CHANGED
@@ -25,5 +25,16 @@ module Peakium
|
|
25
25
|
symbolized = Peakium::Util.symbolize_names(start)
|
26
26
|
assert_equal(finish, symbolized)
|
27
27
|
end
|
28
|
+
|
29
|
+
should "uri_encode should handle arrays correctly" do
|
30
|
+
start = {
|
31
|
+
'foo' => 'bar',
|
32
|
+
'array' => [{ 'foo' => 'bar' }, {'foo' => 'bar 2'}],
|
33
|
+
}
|
34
|
+
finish = 'foo=bar&array[0][foo]=bar&array[1][foo]=bar%202'
|
35
|
+
|
36
|
+
uri = Peakium.uri_encode(start)
|
37
|
+
assert_equal(finish, uri)
|
38
|
+
end
|
28
39
|
end
|
29
40
|
end
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: peakium
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Schultzer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|