stripe 5.25.0 → 5.29.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2bff9fb79cc55a44a50f4f3bf5ae748d3a23a242e283cee0988a27ad0df2c1b3
4
- data.tar.gz: 668da0eecea17d8fe1714f0cb51639ce8c928be8e21ba0a3ac1ba3c5b0014a62
3
+ metadata.gz: f2339577f165121c223f4295756bda5201da78e319999ade2af402d20d126ee2
4
+ data.tar.gz: 8488a28668b139b205ce0d5f1352ae330fe8c5c9653c4028a9fa0302aed77711
5
5
  SHA512:
6
- metadata.gz: 0c0cd52e780ad6f033ef5fa5c6966f1a8a51c667cf2ef99190dcaa7a501c1ea58bfe6cdeab55d90b4d308cbeb1596bc716d45ac212b2de0b0667c243d55b6195
7
- data.tar.gz: 129ea3f6979acbd37fea34fe1dc739e0664ac327118b8768eee49cec4d4b9ac4e70987d8f739d2b121e8535776ed0e2abdcc474343352788c3dd400f0de4b178
6
+ metadata.gz: 16992739fced47381ac70ca4f4b8bd710a63633824c496fe1fdd8cb7cdf7928022a4c3aa4b84fe631ebb0e75a42aaa246d575c7ea7eaadfc15bf26631f031258
7
+ data.tar.gz: b7ce68eae234665c2ded8c5e9691865bb6c98564cfe5f4928f94b660e42cc08eddfa375d4a9a790eb61e096ab679affdfd53e16c8a707dcf88c275e2ffaf2d5e
data/.travis.yml CHANGED
@@ -12,12 +12,10 @@ notifications:
12
12
  email:
13
13
  on_success: never
14
14
 
15
- sudo: false
16
-
17
15
  env:
18
16
  global:
19
17
  # If changing this number, please also change it in `test/test_helper.rb`.
20
- - STRIPE_MOCK_VERSION=0.98.0
18
+ - STRIPE_MOCK_VERSION=0.101.0
21
19
 
22
20
  cache:
23
21
  directories:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.29.1 - 2021-02-09
4
+ * [#964](https://github.com/stripe/stripe-ruby/pull/964) Fix return value of `Customer#delete_discount`
5
+
6
+ ## 5.29.0 - 2021-01-05
7
+ * [#952](https://github.com/stripe/stripe-ruby/pull/952) Allow client_id configuration on instance config
8
+
9
+ ## 5.28.0 - 2020-10-14
10
+ * [#950](https://github.com/stripe/stripe-ruby/pull/950) Add configuration option for `write_timeout` for connections on Ruby 2.6+
11
+
12
+ ## 5.27.0 - 2020-10-14
13
+ * [#951](https://github.com/stripe/stripe-ruby/pull/951) Add support for the Payout Reverse API
14
+
15
+ ## 5.26.0 - 2020-09-29
16
+ * [#949](https://github.com/stripe/stripe-ruby/pull/949) Add support for the `SetupAttempt` resource and List API
17
+
3
18
  ## 5.25.0 - 2020-09-02
4
19
  * [#944](https://github.com/stripe/stripe-ruby/pull/944) Add support for the Issuing Dispute Submit API
5
20
 
data/README.md CHANGED
@@ -21,6 +21,9 @@ The library also provides other features. For example:
21
21
 
22
22
  See the [Ruby API docs](https://stripe.com/docs/api/ruby#intro).
23
23
 
24
+ See [video demonstrations][youtube-playlist] covering how to use the library.
25
+
26
+
24
27
  ## Installation
25
28
 
26
29
  You don't need this source code unless you want to modify the gem. If you just
@@ -186,11 +189,12 @@ retries are safe.
186
189
 
187
190
  ### Configuring Timeouts
188
191
 
189
- Open and read timeouts are configurable:
192
+ Open, read and write timeouts are configurable:
190
193
 
191
194
  ```ruby
192
195
  Stripe.open_timeout = 30 # in seconds
193
196
  Stripe.read_timeout = 80
197
+ Stripe.write_timeout = 30 # only supported on Ruby 2.6+
194
198
  ```
195
199
 
196
200
  Please take care to set conservative read timeouts. Some API requests can take
@@ -339,6 +343,7 @@ Update the bundled [stripe-mock] by editing the version number found in
339
343
  [idempotency-keys]: https://stripe.com/docs/api/ruby#idempotent_requests
340
344
  [stripe-mock]: https://github.com/stripe/stripe-mock
341
345
  [versioning]: https://stripe.com/docs/api/ruby#versioning
346
+ [youtube-playlist]: https://www.youtube.com/playlist?list=PLy1nL-pvL2M50RmP6ie-gdcSnfOuQCRYk
342
347
 
343
348
  <!--
344
349
  # vim: set tw=79:
data/VERSION CHANGED
@@ -1 +1 @@
1
- 5.25.0
1
+ 5.29.1
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=
@@ -78,13 +79,12 @@ module Stripe
78
79
  def_delegators :@configuration, :logger, :logger=
79
80
  def_delegators :@configuration, :max_network_retries, :max_network_retries=
80
81
  def_delegators :@configuration, :enable_telemetry=, :enable_telemetry?
82
+ def_delegators :@configuration, :client_id=, :client_id
81
83
 
82
84
  # Internal configurations
83
85
  def_delegators :@configuration, :max_network_retry_delay
84
86
  def_delegators :@configuration, :initial_network_retry_delay
85
87
  def_delegators :@configuration, :ca_store
86
-
87
- attr_accessor :client_id
88
88
  end
89
89
 
90
90
  # Gets the application for a plugin that's identified some. See
@@ -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
 
@@ -73,6 +73,7 @@ module Stripe
73
73
  Reversal::OBJECT_NAME => Reversal,
74
74
  Review::OBJECT_NAME => Review,
75
75
  SKU::OBJECT_NAME => SKU,
76
+ SetupAttempt::OBJECT_NAME => SetupAttempt,
76
77
  SetupIntent::OBJECT_NAME => SetupIntent,
77
78
  Sigma::ScheduledQueryRun::OBJECT_NAME => Sigma::ScheduledQueryRun,
78
79
  Source::OBJECT_NAME => Source,
@@ -61,6 +61,7 @@ require "stripe/resources/reporting/report_run"
61
61
  require "stripe/resources/reporting/report_type"
62
62
  require "stripe/resources/reversal"
63
63
  require "stripe/resources/review"
64
+ require "stripe/resources/setup_attempt"
64
65
  require "stripe/resources/setup_intent"
65
66
  require "stripe/resources/sigma/scheduled_query_run"
66
67
  require "stripe/resources/sku"
@@ -28,9 +28,14 @@ module Stripe
28
28
  alias detach_source delete_source
29
29
  end
30
30
 
31
+ # Deletes a discount associated with the customer.
32
+ #
33
+ # Returns the deleted discount. The customer object is not updated,
34
+ # so you must call `refresh` on it to get a new version with the
35
+ # discount removed.
31
36
  def delete_discount
32
37
  resp, opts = execute_resource_request(:delete, resource_url + "/discount")
33
- initialize_from(resp.data, opts, true)
38
+ Util.convert_to_stripe_object(resp.data, opts)
34
39
  end
35
40
  end
36
41
  end
@@ -10,6 +10,7 @@ module Stripe
10
10
  OBJECT_NAME = "payout"
11
11
 
12
12
  custom_method :cancel, http_verb: :post
13
+ custom_method :reverse, http_verb: :post
13
14
 
14
15
  def cancel(params = {}, opts = {})
15
16
  request_stripe_object(
@@ -19,5 +20,14 @@ module Stripe
19
20
  opts: opts
20
21
  )
21
22
  end
23
+
24
+ def reverse(params = {}, opts = {})
25
+ request_stripe_object(
26
+ method: :post,
27
+ path: resource_url + "/reverse",
28
+ params: params,
29
+ opts: opts
30
+ )
31
+ end
22
32
  end
23
33
  end
@@ -0,0 +1,10 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ class SetupAttempt < APIResource
6
+ extend Stripe::APIOperations::List
7
+
8
+ OBJECT_NAME = "setup_attempt"
9
+ end
10
+ end
@@ -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.25.0"
4
+ VERSION = "5.29.1"
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
 
@@ -56,9 +56,9 @@ module Stripe
56
56
  context "#delete_discount" do
57
57
  should "delete a discount" do
58
58
  customer = Stripe::Customer.retrieve("cus_123")
59
- customer = customer.delete_discount
60
- assert_requested :delete, "#{Stripe.api_base}/v1/customers/#{customer.id}/discount"
61
- assert customer.is_a?(Stripe::Customer)
59
+ discount = customer.delete_discount
60
+ assert_requested :delete, "#{Stripe.api_base}/v1/customers/cus_123/discount"
61
+ assert discount.is_a?(Stripe::Discount)
62
62
  end
63
63
  end
64
64
 
@@ -53,5 +53,20 @@ module Stripe
53
53
  assert payout.is_a?(Stripe::Payout)
54
54
  end
55
55
  end
56
+
57
+ context "#reverse" do
58
+ should "reverse a payout" do
59
+ payout = Stripe::Payout.retrieve("tr_123")
60
+ payout = payout.reverse
61
+ assert payout.is_a?(Stripe::Payout)
62
+ end
63
+ end
64
+
65
+ context ".reverse" do
66
+ should "reverse a payout" do
67
+ payout = Stripe::Payout.reverse("pm_123")
68
+ assert payout.is_a?(Stripe::Payout)
69
+ end
70
+ end
56
71
  end
57
72
  end
@@ -19,8 +19,7 @@ module Stripe
19
19
 
20
20
  should "be creatable" do
21
21
  product = Stripe::Product.create(
22
- name: "My Product",
23
- type: "good"
22
+ name: "My Product"
24
23
  )
25
24
  assert_requested :post, "#{Stripe.api_base}/v1/products"
26
25
  assert product.is_a?(Stripe::Product)
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require ::File.expand_path("../test_helper", __dir__)
4
+
5
+ module Stripe
6
+ class SetupAttemptTest < Test::Unit::TestCase
7
+ should "be listable" do
8
+ setup_attempts = Stripe::SetupAttempt.list({
9
+ setup_intent: "seti_123",
10
+ })
11
+ assert_requested :get, "#{Stripe.api_base}/v1/setup_attempts?setup_intent=seti_123"
12
+ assert setup_attempts.data.is_a?(Array)
13
+ assert setup_attempts.data[0].is_a?(Stripe::SetupAttempt)
14
+ end
15
+ end
16
+ end
@@ -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
@@ -16,7 +16,7 @@ require ::File.expand_path("test_data", __dir__)
16
16
  require ::File.expand_path("stripe_mock", __dir__)
17
17
 
18
18
  # If changing this number, please also change it in `.travis.yml`.
19
- MOCK_MINIMUM_VERSION = "0.98.0"
19
+ MOCK_MINIMUM_VERSION = "0.101.0"
20
20
  MOCK_PORT = Stripe::StripeMock.start
21
21
 
22
22
  # Disable all real network connections except those that are outgoing to
@@ -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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stripe
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.25.0
4
+ version: 5.29.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-02 00:00:00.000000000 Z
11
+ date: 2021-02-09 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.
@@ -116,6 +116,7 @@ files:
116
116
  - lib/stripe/resources/reporting/report_type.rb
117
117
  - lib/stripe/resources/reversal.rb
118
118
  - lib/stripe/resources/review.rb
119
+ - lib/stripe/resources/setup_attempt.rb
119
120
  - lib/stripe/resources/setup_intent.rb
120
121
  - lib/stripe/resources/sigma/scheduled_query_run.rb
121
122
  - lib/stripe/resources/sku.rb
@@ -207,6 +208,7 @@ files:
207
208
  - test/stripe/reporting/report_type_test.rb
208
209
  - test/stripe/reversal_test.rb
209
210
  - test/stripe/review_test.rb
211
+ - test/stripe/setup_attempt_test.rb
210
212
  - test/stripe/setup_intent_test.rb
211
213
  - test/stripe/sigma/scheduled_query_run_test.rb
212
214
  - test/stripe/sku_test.rb
@@ -244,7 +246,7 @@ metadata:
244
246
  github_repo: ssh://github.com/stripe/stripe-ruby
245
247
  homepage_uri: https://stripe.com/docs/api/ruby
246
248
  source_code_uri: https://github.com/stripe/stripe-ruby
247
- post_install_message:
249
+ post_install_message:
248
250
  rdoc_options: []
249
251
  require_paths:
250
252
  - lib
@@ -260,7 +262,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
260
262
  version: '0'
261
263
  requirements: []
262
264
  rubygems_version: 3.1.2
263
- signing_key:
265
+ signing_key:
264
266
  specification_version: 4
265
267
  summary: Ruby bindings for the Stripe API
266
268
  test_files:
@@ -326,6 +328,7 @@ test_files:
326
328
  - test/stripe/reporting/report_type_test.rb
327
329
  - test/stripe/reversal_test.rb
328
330
  - test/stripe/review_test.rb
331
+ - test/stripe/setup_attempt_test.rb
329
332
  - test/stripe/setup_intent_test.rb
330
333
  - test/stripe/sigma/scheduled_query_run_test.rb
331
334
  - test/stripe/sku_test.rb