stripe 1.27.0 → 1.27.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.txt +4 -0
- data/VERSION +1 -1
- data/lib/stripe.rb +2 -1
- data/lib/stripe/product.rb +1 -1
- data/lib/stripe/version.rb +1 -1
- data/test/stripe/api_resource_test.rb +22 -0
- data/test/stripe/order_test.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: 1f4235e27307b38df8ab0559790ed8198ee52fa8
|
4
|
+
data.tar.gz: 9370238b510e753ff6259f67150048b366266d6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03cbd36f734b4644c508168daaae265027977988f24b68b925febec71350aba92aa6e119a9a0b5902db13112d05c32d7946ba34db853744122548868768470d3
|
7
|
+
data.tar.gz: efec64ae57b51dbf989db5da396678fd4a375b2e312c9459a0ca2fa2b8edeb698fafd1a1d6b22333cfd9a7aad07ab5da394090f2a229076cbb5f294fe7230eb8
|
data/History.txt
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.27.
|
1
|
+
1.27.1
|
data/lib/stripe.rb
CHANGED
@@ -253,7 +253,8 @@ module Stripe
|
|
253
253
|
begin
|
254
254
|
error_obj = JSON.parse(resp.body)
|
255
255
|
error_obj = Util.symbolize_names(error_obj)
|
256
|
-
error = error_obj[:error]
|
256
|
+
error = error_obj[:error]
|
257
|
+
raise StripeError.new unless error && error.is_a?(Hash)
|
257
258
|
|
258
259
|
rescue JSON::ParserError, StripeError
|
259
260
|
raise general_api_error(resp.code, resp.body)
|
data/lib/stripe/product.rb
CHANGED
data/lib/stripe/version.rb
CHANGED
@@ -125,6 +125,28 @@ module Stripe
|
|
125
125
|
'sk_test_local')
|
126
126
|
end
|
127
127
|
|
128
|
+
should "handle error response with empty body" do
|
129
|
+
response = make_response('', 500)
|
130
|
+
@mock.expects(:post).once.raises(RestClient::ExceptionWithResponse.new(response, 500))
|
131
|
+
|
132
|
+
e = assert_raises Stripe::APIError do
|
133
|
+
Stripe::Charge.create
|
134
|
+
end
|
135
|
+
|
136
|
+
assert_equal 'Invalid response object from API: "" (HTTP response code was 500)', e.message
|
137
|
+
end
|
138
|
+
|
139
|
+
should "handle error response with non-object error value" do
|
140
|
+
response = make_response('{"error": "foo"}', 500)
|
141
|
+
@mock.expects(:post).once.raises(RestClient::ExceptionWithResponse.new(response, 500))
|
142
|
+
|
143
|
+
e = assert_raises Stripe::APIError do
|
144
|
+
Stripe::Charge.create
|
145
|
+
end
|
146
|
+
|
147
|
+
assert_equal 'Invalid response object from API: "{\"error\": \"foo\"}" (HTTP response code was 500)', e.message
|
148
|
+
end
|
149
|
+
|
128
150
|
should "have default open and read timeouts" do
|
129
151
|
assert_equal Stripe.open_timeout, 30
|
130
152
|
assert_equal Stripe.read_timeout, 80
|
data/test/stripe/order_test.rb
CHANGED
@@ -45,7 +45,7 @@ module Stripe
|
|
45
45
|
@mock.expects(:post).once.
|
46
46
|
with('https://api.stripe.com/v1/orders/or_test_order/pay', nil, 'token=test_token').
|
47
47
|
returns(make_response(make_paid_order))
|
48
|
-
order.pay(token
|
48
|
+
order.pay(:token => 'test_token')
|
49
49
|
assert_equal "paid", order.status
|
50
50
|
end
|
51
51
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stripe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.27.
|
4
|
+
version: 1.27.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ross Boucher
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-09-
|
12
|
+
date: 2015-09-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|