stripe 5.16.0 → 5.17.0
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/CHANGELOG.md +3 -0
- data/VERSION +1 -1
- data/lib/stripe/errors.rb +8 -0
- data/lib/stripe/version.rb +1 -1
- data/test/stripe/errors_test.rb +12 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e5181361c0234383970aeb248643fe3252af8de194930a3be57bbc40f8b56dc
|
4
|
+
data.tar.gz: 5ffcb0999f420f44967e9229fb4771f62a5537dd61b8f6ffc077acb65850583c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6ab8a5a9b64cd533836e51b4ad85a46ed82660bbdcb34f27928ea57e06cb9812f151aaa9e02118a70021a1ae53b5baf3184ec0b2ec886a99a4ba76bbf482e5c
|
7
|
+
data.tar.gz: 6f1fafe111117e91fbc9402b6cb8d77b1aecb23de7d6b2943ab31d5e04770ab68753677962a5079fa28c486d5b91720b3c0ee30b2b3f5e355ab464f7334ad17f
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 5.17.0 - 2020-02-26
|
4
|
+
* [#907](https://github.com/stripe/stripe-ruby/pull/907) Add `StripeError#idempotent_replayed?`
|
5
|
+
|
3
6
|
## 5.16.0 - 2020-02-26
|
4
7
|
* [#906](https://github.com/stripe/stripe-ruby/pull/906) Add support for listing Checkout sessions
|
5
8
|
* [#903](https://github.com/stripe/stripe-ruby/pull/903) Upgrade to Rubocop 0.80
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
5.
|
1
|
+
5.17.0
|
data/lib/stripe/errors.rb
CHANGED
@@ -25,6 +25,7 @@ module Stripe
|
|
25
25
|
@http_status = http_status
|
26
26
|
@http_body = http_body
|
27
27
|
@http_headers = http_headers || {}
|
28
|
+
@idempotent_replayed = @http_headers["idempotent-replayed"] == "true"
|
28
29
|
@json_body = json_body
|
29
30
|
@code = code
|
30
31
|
@request_id = @http_headers["request-id"]
|
@@ -37,6 +38,13 @@ module Stripe
|
|
37
38
|
ErrorObject.construct_from(@json_body[:error])
|
38
39
|
end
|
39
40
|
|
41
|
+
# Whether the error was the result of an idempotent replay, meaning that it
|
42
|
+
# originally occurred on a previous request and is being replayed back
|
43
|
+
# because the user sent the same idempotency key for this one.
|
44
|
+
def idempotent_replayed?
|
45
|
+
@idempotent_replayed
|
46
|
+
end
|
47
|
+
|
40
48
|
def to_s
|
41
49
|
status_string = @http_status.nil? ? "" : "(Status #{@http_status}) "
|
42
50
|
id_string = @request_id.nil? ? "" : "(Request #{@request_id}) "
|
data/lib/stripe/version.rb
CHANGED
data/test/stripe/errors_test.rb
CHANGED
@@ -14,6 +14,18 @@ module Stripe
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
+
context "#idempotent_replayed?" do
|
18
|
+
should "initialize from header" do
|
19
|
+
e = StripeError.new("message", http_headers: { "idempotent-replayed" => "true" })
|
20
|
+
assert_equal true, e.idempotent_replayed?
|
21
|
+
end
|
22
|
+
|
23
|
+
should "be 'falsey' by default" do
|
24
|
+
e = StripeError.new("message")
|
25
|
+
refute_equal true, e.idempotent_replayed?
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
17
29
|
context "#to_s" do
|
18
30
|
should "convert to string" do
|
19
31
|
e = StripeError.new("message")
|
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.17.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stripe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-02-
|
11
|
+
date: 2020-02-27 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.
|