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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6f68f6b92029b2acf9c99eb5837af2aa39ff686877d189acc79f997c7f56c414
4
- data.tar.gz: c650ded2ab2ee0062f5f5be7a6b0a78a3d2f91173576aea916aedd57fb1c6e33
3
+ metadata.gz: fc768f1967f8b5d8d925a101dffc820bd4dfa96155cecc9bd86926cb30f07cbe
4
+ data.tar.gz: 7dcd29fb83035f6f6af335bf3a4acde40ea4ce7e0e097413b9f76c696bb3e529
5
5
  SHA512:
6
- metadata.gz: b6d8708699cc5911fdfb5a2b7f1fad2cb62f432d8421535d3ffe238f271becab4aa6e0f85c875ad1949a509f07f6a779a979e63f5a5ddcdbee456db9fdcd63f0
7
- data.tar.gz: 846bf9d449649354d1f210fe461801ab009281c0583a70f3f7efe63efcf8e5de8e768e9d6332a50a4b5484acf185036b3c9bde937b2b4488689450549d2b40db
6
+ metadata.gz: e911a5c3138805c0aeb5abe270186e4d4219b8414e3336579cda3caa02ad32797d0d088cce8468156f4dff27a6ff55ac107419e7a0b01040eec36be8684073d7
7
+ data.tar.gz: 6fd38cd5ffde35f1065ce18104382f106eec79fb3494099e49723745ada158f7f63df1164653a6ada3fe0c62ae0ed764cbf9e40e878f4e3bb4dbd6c799cffbfa
@@ -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 read timeouts are configurable:
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.27.0
1
+ 5.28.0
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stripe
4
- VERSION = "5.27.0"
4
+ VERSION = "5.28.0"
5
5
  end
@@ -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
 
@@ -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
@@ -56,6 +56,8 @@ module Test
56
56
  include Stripe::TestData
57
57
  include Mocha
58
58
 
59
+ WRITE_TIMEOUT_SUPPORTED = Net::HTTP.instance_methods.include?(:write_timeout=)
60
+
59
61
  setup do
60
62
  Stripe.api_key = "sk_test_123"
61
63
  Stripe.api_base = "http://localhost:#{MOCK_PORT}"
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: 5.27.0
4
+ version: 5.28.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe