stripe 5.27.0 → 5.28.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/README.md +2 -1
- data/VERSION +1 -1
- data/lib/stripe.rb +1 -0
- data/lib/stripe/connection_manager.rb +3 -0
- data/lib/stripe/stripe_configuration.rb +11 -0
- data/lib/stripe/version.rb +1 -1
- data/test/stripe/connection_manager_test.rb +4 -0
- data/test/stripe/stripe_configuration_test.rb +3 -0
- data/test/stripe_test.rb +13 -0
- data/test/test_helper.rb +2 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fc768f1967f8b5d8d925a101dffc820bd4dfa96155cecc9bd86926cb30f07cbe
|
|
4
|
+
data.tar.gz: 7dcd29fb83035f6f6af335bf3a4acde40ea4ce7e0e097413b9f76c696bb3e529
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e911a5c3138805c0aeb5abe270186e4d4219b8414e3336579cda3caa02ad32797d0d088cce8468156f4dff27a6ff55ac107419e7a0b01040eec36be8684073d7
|
|
7
|
+
data.tar.gz: 6fd38cd5ffde35f1065ce18104382f106eec79fb3494099e49723745ada158f7f63df1164653a6ada3fe0c62ae0ed764cbf9e40e878f4e3bb4dbd6c799cffbfa
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 5.28.0 - 2020-10-14
|
|
4
|
+
* [#950](https://github.com/stripe/stripe-ruby/pull/950) Add configuration option for `write_timeout` for connections on Ruby 2.6+
|
|
5
|
+
|
|
3
6
|
## 5.27.0 - 2020-10-14
|
|
4
7
|
* [#951](https://github.com/stripe/stripe-ruby/pull/951) Add support for the Payout Reverse API
|
|
5
8
|
|
data/README.md
CHANGED
|
@@ -186,11 +186,12 @@ retries are safe.
|
|
|
186
186
|
|
|
187
187
|
### Configuring Timeouts
|
|
188
188
|
|
|
189
|
-
Open and
|
|
189
|
+
Open, read and write timeouts are configurable:
|
|
190
190
|
|
|
191
191
|
```ruby
|
|
192
192
|
Stripe.open_timeout = 30 # in seconds
|
|
193
193
|
Stripe.read_timeout = 80
|
|
194
|
+
Stripe.write_timeout = 30 # only supported on Ruby 2.6+
|
|
194
195
|
```
|
|
195
196
|
|
|
196
197
|
Please take care to set conservative read timeouts. Some API requests can take
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
5.
|
|
1
|
+
5.28.0
|
data/lib/stripe.rb
CHANGED
|
@@ -71,6 +71,7 @@ module Stripe
|
|
|
71
71
|
def_delegators :@configuration, :connect_base, :connect_base=
|
|
72
72
|
def_delegators :@configuration, :open_timeout, :open_timeout=
|
|
73
73
|
def_delegators :@configuration, :read_timeout, :read_timeout=
|
|
74
|
+
def_delegators :@configuration, :write_timeout, :write_timeout=
|
|
74
75
|
def_delegators :@configuration, :proxy, :proxy=
|
|
75
76
|
def_delegators :@configuration, :verify_ssl_certs, :verify_ssl_certs=
|
|
76
77
|
def_delegators :@configuration, :ca_bundle_path, :ca_bundle_path=
|
|
@@ -119,6 +119,9 @@ module Stripe
|
|
|
119
119
|
|
|
120
120
|
connection.open_timeout = Stripe.open_timeout
|
|
121
121
|
connection.read_timeout = Stripe.read_timeout
|
|
122
|
+
if connection.respond_to?(:write_timeout=)
|
|
123
|
+
connection.write_timeout = Stripe.write_timeout
|
|
124
|
+
end
|
|
122
125
|
|
|
123
126
|
connection.use_ssl = uri.scheme == "https"
|
|
124
127
|
|
|
@@ -42,6 +42,7 @@ module Stripe
|
|
|
42
42
|
attr_reader :max_network_retry_delay
|
|
43
43
|
attr_reader :open_timeout
|
|
44
44
|
attr_reader :read_timeout
|
|
45
|
+
attr_reader :write_timeout
|
|
45
46
|
attr_reader :proxy
|
|
46
47
|
attr_reader :verify_ssl_certs
|
|
47
48
|
|
|
@@ -72,6 +73,7 @@ module Stripe
|
|
|
72
73
|
|
|
73
74
|
@open_timeout = 30
|
|
74
75
|
@read_timeout = 80
|
|
76
|
+
@write_timeout = 30
|
|
75
77
|
|
|
76
78
|
@api_base = "https://api.stripe.com"
|
|
77
79
|
@connect_base = "https://connect.stripe.com"
|
|
@@ -109,6 +111,15 @@ module Stripe
|
|
|
109
111
|
StripeClient.clear_all_connection_managers
|
|
110
112
|
end
|
|
111
113
|
|
|
114
|
+
def write_timeout=(write_timeout)
|
|
115
|
+
unless Net::HTTP.instance_methods.include?(:write_timeout=)
|
|
116
|
+
raise NotImplementedError
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
@write_timeout = write_timeout
|
|
120
|
+
StripeClient.clear_all_connection_managers
|
|
121
|
+
end
|
|
122
|
+
|
|
112
123
|
def proxy=(proxy)
|
|
113
124
|
@proxy = proxy
|
|
114
125
|
StripeClient.clear_all_connection_managers
|
data/lib/stripe/version.rb
CHANGED
|
@@ -39,6 +39,7 @@ module Stripe
|
|
|
39
39
|
|
|
40
40
|
old_open_timeout = Stripe.open_timeout
|
|
41
41
|
old_read_timeout = Stripe.read_timeout
|
|
42
|
+
old_write_timeout = Stripe.write_timeout
|
|
42
43
|
|
|
43
44
|
begin
|
|
44
45
|
# Make sure any global initialization here is undone in the `ensure`
|
|
@@ -47,6 +48,7 @@ module Stripe
|
|
|
47
48
|
|
|
48
49
|
Stripe.open_timeout = 123
|
|
49
50
|
Stripe.read_timeout = 456
|
|
51
|
+
Stripe.write_timeout = 789 if WRITE_TIMEOUT_SUPPORTED
|
|
50
52
|
|
|
51
53
|
conn = @manager.connection_for("https://stripe.com")
|
|
52
54
|
|
|
@@ -63,6 +65,7 @@ module Stripe
|
|
|
63
65
|
# Timeouts
|
|
64
66
|
assert_equal 123, conn.open_timeout
|
|
65
67
|
assert_equal 456, conn.read_timeout
|
|
68
|
+
assert_equal 789, conn.write_timeout if WRITE_TIMEOUT_SUPPORTED
|
|
66
69
|
|
|
67
70
|
assert_equal true, conn.use_ssl?
|
|
68
71
|
assert_equal OpenSSL::SSL::VERIFY_PEER, conn.verify_mode
|
|
@@ -72,6 +75,7 @@ module Stripe
|
|
|
72
75
|
|
|
73
76
|
Stripe.open_timeout = old_open_timeout
|
|
74
77
|
Stripe.read_timeout = old_read_timeout
|
|
78
|
+
Stripe.write_timeout = old_write_timeout if WRITE_TIMEOUT_SUPPORTED
|
|
75
79
|
end
|
|
76
80
|
end
|
|
77
81
|
|
|
@@ -16,6 +16,7 @@ module Stripe
|
|
|
16
16
|
assert_equal 0, config.max_network_retries
|
|
17
17
|
assert_equal 30, config.open_timeout
|
|
18
18
|
assert_equal 80, config.read_timeout
|
|
19
|
+
assert_equal 30, config.write_timeout
|
|
19
20
|
assert_equal "https://api.stripe.com", config.api_base
|
|
20
21
|
assert_equal "https://connect.stripe.com", config.connect_base
|
|
21
22
|
assert_equal "https://files.stripe.com", config.uploads_base
|
|
@@ -25,10 +26,12 @@ module Stripe
|
|
|
25
26
|
config = Stripe::StripeConfiguration.setup do |c|
|
|
26
27
|
c.open_timeout = 100
|
|
27
28
|
c.read_timeout = 100
|
|
29
|
+
c.write_timeout = 100 if WRITE_TIMEOUT_SUPPORTED
|
|
28
30
|
end
|
|
29
31
|
|
|
30
32
|
assert_equal 100, config.open_timeout
|
|
31
33
|
assert_equal 100, config.read_timeout
|
|
34
|
+
assert_equal 100, config.write_timeout if WRITE_TIMEOUT_SUPPORTED
|
|
32
35
|
end
|
|
33
36
|
end
|
|
34
37
|
|
data/test/stripe_test.rb
CHANGED
|
@@ -54,6 +54,19 @@ class StripeTest < Test::Unit::TestCase
|
|
|
54
54
|
assert_equal 10, Stripe.read_timeout
|
|
55
55
|
end
|
|
56
56
|
|
|
57
|
+
if WRITE_TIMEOUT_SUPPORTED
|
|
58
|
+
should "allow write timeout to be configured" do
|
|
59
|
+
Stripe.write_timeout = 10
|
|
60
|
+
assert_equal 10, Stripe.write_timeout
|
|
61
|
+
end
|
|
62
|
+
else
|
|
63
|
+
should "raise when write timeout to be configured is not supported" do
|
|
64
|
+
assert_raises NotImplementedError do
|
|
65
|
+
Stripe.write_timeout = 10
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
57
70
|
should "allow api_key to be configured" do
|
|
58
71
|
Stripe.api_key = "sk_local_test"
|
|
59
72
|
assert_equal "sk_local_test", Stripe.api_key
|
data/test/test_helper.rb
CHANGED