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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f1c99c066374d7370a0d975b8a8bf1b7f656c11a50ac73584ff7aeb76388c02c
4
- data.tar.gz: 7fd08d9c1601d15c2b61e451c2d9ca32f7f195f82e60d2eac26a8386291ea123
3
+ metadata.gz: 1e5181361c0234383970aeb248643fe3252af8de194930a3be57bbc40f8b56dc
4
+ data.tar.gz: 5ffcb0999f420f44967e9229fb4771f62a5537dd61b8f6ffc077acb65850583c
5
5
  SHA512:
6
- metadata.gz: 81c6026fce3c6b305d60d00bf333a49e893592e3d74be76708512fb3287293de92a49832e4466e854b2bbd18a1cd54f802ee031f11f1cd712c6ba5976e881fb1
7
- data.tar.gz: 55acb0e73747fc49f2ca96595561acaaab676f18181b5611f5a47f64dc8426a9b5bc9f565e29752099a7f3db2113730ea6e7c839fcd9778eeb09cdb38a22ed67
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.16.0
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}) "
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stripe
4
- VERSION = "5.16.0"
4
+ VERSION = "5.17.0"
5
5
  end
@@ -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.16.0
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-26 00:00:00.000000000 Z
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.