stripe 5.5.0 → 5.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +6 -0
- data/CHANGELOG.md +3 -0
- data/VERSION +1 -1
- data/lib/stripe/api_operations/request.rb +17 -1
- data/lib/stripe/version.rb +1 -1
- data/test/stripe/api_resource_test.rb +17 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b717ef70627c0f7467317a2e2f08e8d553b04411b6324df41f4cc5eac6bd6800
|
4
|
+
data.tar.gz: 26a05a4ceeb4412c95c2ad12776785c72bd291841c5843eba2ec03a6dc21a722
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef1b962195d8a8510a1d360d8fbd18a246c65363877b43a451bccd1340c1ea18008581c04c4a0e62eb6eed9f2f8afebfccf9c4f5d059b08a2ccd921cae5b5cd0
|
7
|
+
data.tar.gz: 98fb62f907a16aadb4cab5564053ce85e96931193a8e1eeccb8ef10ebcfa726ddf086e51aef09db0825c685129867d5a91716addcc2252ae771869ca4d83bc8a
|
data/.rubocop.yml
CHANGED
@@ -4,6 +4,12 @@ AllCops:
|
|
4
4
|
DisplayCopNames: true
|
5
5
|
TargetRubyVersion: 2.3
|
6
6
|
|
7
|
+
Exclude:
|
8
|
+
# brandur: Exclude ephmeral script-like files that I use to try and
|
9
|
+
# reproduce problems with the library. If you know of a better way of doing
|
10
|
+
# this (e.g. exclude files not tracked by Git), feel free to change it.
|
11
|
+
- "example_*"
|
12
|
+
|
7
13
|
Layout/CaseIndentation:
|
8
14
|
EnforcedStyle: end
|
9
15
|
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 5.6.0 - 2019-10-04
|
4
|
+
* [#861](https://github.com/stripe/stripe-ruby/pull/861) Nicer error when specifying non-nil non-string opt value
|
5
|
+
|
3
6
|
## 5.5.0 - 2019-10-03
|
4
7
|
* [#859](https://github.com/stripe/stripe-ruby/pull/859) User-friendly messages and retries for `EOFError`, `Errno::ECONNRESET`, `Errno::ETIMEDOUT`, and `Errno::EHOSTUNREACH` network errors
|
5
8
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
5.
|
1
|
+
5.6.0
|
@@ -8,6 +8,8 @@ module Stripe
|
|
8
8
|
warn_on_opts_in_params(params)
|
9
9
|
|
10
10
|
opts = Util.normalize_opts(opts)
|
11
|
+
error_on_non_string_user_opts(opts)
|
12
|
+
|
11
13
|
opts[:client] ||= StripeClient.active_client
|
12
14
|
|
13
15
|
headers = opts.clone
|
@@ -31,10 +33,24 @@ module Stripe
|
|
31
33
|
[resp, opts_to_persist]
|
32
34
|
end
|
33
35
|
|
36
|
+
private def error_on_non_string_user_opts(opts)
|
37
|
+
Util::OPTS_USER_SPECIFIED.each do |opt|
|
38
|
+
next unless opts.key?(opt)
|
39
|
+
|
40
|
+
val = opts[opt]
|
41
|
+
next if val.nil?
|
42
|
+
next if val.is_a?(String)
|
43
|
+
|
44
|
+
raise ArgumentError,
|
45
|
+
"request option '#{opt}' should be a string value " \
|
46
|
+
"(was a #{val.class})"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
34
50
|
private def warn_on_opts_in_params(params)
|
35
51
|
Util::OPTS_USER_SPECIFIED.each do |opt|
|
36
52
|
if params.key?(opt)
|
37
|
-
warn("WARNING: #{opt} should be in opts instead of params.")
|
53
|
+
warn("WARNING: '#{opt}' should be in opts instead of params.")
|
38
54
|
end
|
39
55
|
end
|
40
56
|
end
|
data/lib/stripe/version.rb
CHANGED
@@ -227,6 +227,23 @@ module Stripe
|
|
227
227
|
end
|
228
228
|
end
|
229
229
|
|
230
|
+
should "error if a user-specified opt is given a non-nil non-string value" do
|
231
|
+
stub_request(:post, "#{Stripe.api_base}/v1/charges")
|
232
|
+
.to_return(body: JSON.generate(charge_fixture))
|
233
|
+
|
234
|
+
# Works fine if not included or a string.
|
235
|
+
Stripe::Charge.create({ amount: 100, currency: "usd" }, {})
|
236
|
+
Stripe::Charge.create({ amount: 100, currency: "usd" }, idempotency_key: "12345")
|
237
|
+
|
238
|
+
# Errors on a non-string.
|
239
|
+
e = assert_raises(ArgumentError) do
|
240
|
+
Stripe::Charge.create({ amount: 100, currency: "usd" }, idempotency_key: :foo)
|
241
|
+
end
|
242
|
+
assert_equal "request option 'idempotency_key' should be a string value " \
|
243
|
+
"(was a Symbol)",
|
244
|
+
e.message
|
245
|
+
end
|
246
|
+
|
230
247
|
should "requesting with a unicode ID should result in a request" do
|
231
248
|
stub_request(:get, "#{Stripe.api_base}/v1/customers/%E2%98%83")
|
232
249
|
.to_return(body: JSON.generate(make_missing_id_error), status: 404)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stripe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stripe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Stripe is the easiest way to accept payments online. See https://stripe.com
|
14
14
|
for details.
|
@@ -246,7 +246,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
246
246
|
- !ruby/object:Gem::Version
|
247
247
|
version: '0'
|
248
248
|
requirements: []
|
249
|
-
rubygems_version: 3.0.
|
249
|
+
rubygems_version: 3.0.6
|
250
250
|
signing_key:
|
251
251
|
specification_version: 4
|
252
252
|
summary: Ruby bindings for the Stripe API
|