stripe 11.3.0 → 11.4.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: d194f568d73d4b7aad08e89250b62192c4577cc97da642287a83b487f3d3e6ce
4
- data.tar.gz: e4ba60356e5de058254e19f71ca72f665adedbc1c9fa7cc85bcac7754ac04e0e
3
+ metadata.gz: cd6a3e42dbb95019d823e6954b1d21e2fabcb3944bd75f5e39645d50afabca9e
4
+ data.tar.gz: e3251ac60295b039a63a29645ab59e0dd3ab02b6abec5a71c4b7d2f3eee21fad
5
5
  SHA512:
6
- metadata.gz: f6cbcc13a8f5d0549d8e910f437900f5e52889df9d41f919d617ade29a463f5a101baecf9c3d25ed19f1fdcd1da91e4e0103234f8ba701bc622e8083a1085513
7
- data.tar.gz: '08feaf01a76272eb6d9923f88988ef68808b24ced8d9df06c38347809e92dd0223e141ba1078bbf367b5d0f2f4b8e934ae36b82ef6eacd71088d8d0a4a0184be'
6
+ metadata.gz: 0a26e79aca89d810145faac1b9e95e895b4f45408144abe167f7c5ce7fd2b496c419c8cdc9af617299730897ccfe51bb2a01947a8ad103b91c7eb8b61acb9bf9
7
+ data.tar.gz: a60299c26fc4519bb9d681eb8d7ec43782ebc3dde09bfe90a316bb53d4ae9455587246689394269b5cd8d6b7f269f741ea2acca0dfcf148630a2126eeb3481bf
data/CHANGELOG.md CHANGED
@@ -1,4 +1,12 @@
1
1
  # Changelog
2
+ ## 11.4.0 - 2024-05-09
3
+ * [#1397](https://github.com/stripe/stripe-ruby/pull/1397) Update generated code
4
+ * Add support for `update` test helper method on resources `Treasury.OutboundPayment` and `Treasury.OutboundTransfer`
5
+ * [#1399](https://github.com/stripe/stripe-ruby/pull/1399) Pass params to transfer reversal
6
+ * Allow `Stripe::Transfer.retrieve_reversal()` to accept a params hash as the third argument, followed by opts. No changes to existing calls are necessary, but in a future major version this method will be updated to only accept params as the first argument. Fixes [#1393](https://github.com/stripe/stripe-ruby/issues/1393)
7
+ * [#1389](https://github.com/stripe/stripe-ruby/pull/1389) Removed jaro_winkler as a dependency
8
+ * [#1396](https://github.com/stripe/stripe-ruby/pull/1396) Start tracking `StripeClient#request` usage
9
+
2
10
  ## 11.3.0 - 2024-05-02
3
11
  * [#1387](https://github.com/stripe/stripe-ruby/pull/1387) Update generated code
4
12
 
data/Gemfile CHANGED
@@ -27,10 +27,6 @@ group :development do
27
27
  # The latest version of rubocop is only compatible with Ruby 2.7+
28
28
  gem "rubocop", "1.57.2" if RUBY_VERSION >= "2.7"
29
29
 
30
- # jaro_winkler 1.5.5 installation fails for jruby
31
- # don't install on truffleruby
32
- gem "jaro_winkler", "1.5.4" unless RUBY_ENGINE == "truffleruby"
33
-
34
30
  gem "sorbet"
35
31
  gem "tapioca"
36
32
 
data/OPENAPI_VERSION CHANGED
@@ -1 +1 @@
1
- v1005
1
+ v1011
data/VERSION CHANGED
@@ -1 +1 @@
1
- 11.3.0
1
+ 11.4.0
@@ -35,6 +35,7 @@ module Stripe
35
35
  end
36
36
  end
37
37
 
38
+ # rubocop:disable Metrics/MethodLength
38
39
  private def define_operation(
39
40
  resource,
40
41
  operation,
@@ -53,12 +54,30 @@ module Stripe
53
54
  )
54
55
  end
55
56
  when :retrieve
57
+ # TODO: (Major) Split params_or_opts to params and opts and get rid of the complicated way to add params
56
58
  define_singleton_method(:"retrieve_#{resource}") \
57
- do |id, nested_id, opts = {}|
59
+ do |id, nested_id, params_or_opts = {}, definitely_opts = nil|
60
+ opts = nil
61
+ params = nil
62
+ if definitely_opts.nil?
63
+ unrecognized_key = params_or_opts.keys.find { |k| !Util::OPTS_USER_SPECIFIED.include?(k) }
64
+ if unrecognized_key
65
+ raise ArgumentError,
66
+ "Unrecognized request option: #{unrecognized_key}. Did you mean to specify this as " \
67
+ "retrieve params? " \
68
+ "If so, you must explicitly pass an opts hash as a fourth argument. " \
69
+ "For example: .retrieve(#{id}, #{nested_id}, {#{unrecognized_key}: 'foo'}, {})"
70
+ end
71
+
72
+ opts = params_or_opts
73
+ else
74
+ opts = definitely_opts
75
+ params = params_or_opts
76
+ end
58
77
  request_stripe_object(
59
78
  method: :get,
60
79
  path: send(resource_url_method, id, nested_id),
61
- params: {},
80
+ params: params,
62
81
  opts: opts
63
82
  )
64
83
  end
@@ -96,6 +115,7 @@ module Stripe
96
115
  raise ArgumentError, "Unknown operation: #{operation.inspect}"
97
116
  end
98
117
  end
118
+ # rubocop:enable Metrics/MethodLength
99
119
  end
100
120
  end
101
121
  end
@@ -124,6 +124,26 @@ module Stripe
124
124
  opts: opts
125
125
  )
126
126
  end
127
+
128
+ # Updates a test mode created OutboundPayment with tracking details. The OutboundPayment must not be cancelable, and cannot be in the canceled or failed states.
129
+ def self.update(id, params = {}, opts = {})
130
+ request_stripe_object(
131
+ method: :post,
132
+ path: format("/v1/test_helpers/treasury/outbound_payments/%<id>s", { id: CGI.escape(id) }),
133
+ params: params,
134
+ opts: opts
135
+ )
136
+ end
137
+
138
+ # Updates a test mode created OutboundPayment with tracking details. The OutboundPayment must not be cancelable, and cannot be in the canceled or failed states.
139
+ def update(params = {}, opts = {})
140
+ @resource.request_stripe_object(
141
+ method: :post,
142
+ path: format("/v1/test_helpers/treasury/outbound_payments/%<id>s", { id: CGI.escape(@resource["id"]) }),
143
+ params: params,
144
+ opts: opts
145
+ )
146
+ end
127
147
  end
128
148
  end
129
149
  end
@@ -124,6 +124,26 @@ module Stripe
124
124
  opts: opts
125
125
  )
126
126
  end
127
+
128
+ # Updates a test mode created OutboundTransfer with tracking details. The OutboundTransfer must not be cancelable, and cannot be in the canceled or failed states.
129
+ def self.update(outbound_transfer, params = {}, opts = {})
130
+ request_stripe_object(
131
+ method: :post,
132
+ path: format("/v1/test_helpers/treasury/outbound_transfers/%<outbound_transfer>s", { outbound_transfer: CGI.escape(outbound_transfer) }),
133
+ params: params,
134
+ opts: opts
135
+ )
136
+ end
137
+
138
+ # Updates a test mode created OutboundTransfer with tracking details. The OutboundTransfer must not be cancelable, and cannot be in the canceled or failed states.
139
+ def update(params = {}, opts = {})
140
+ @resource.request_stripe_object(
141
+ method: :post,
142
+ path: format("/v1/test_helpers/treasury/outbound_transfers/%<outbound_transfer>s", { outbound_transfer: CGI.escape(@resource["id"]) }),
143
+ params: params,
144
+ opts: opts
145
+ )
146
+ end
127
147
  end
128
148
  end
129
149
  end
@@ -18,6 +18,11 @@ module Stripe
18
18
  @system_profiler = SystemProfiler.new
19
19
  @last_request_metrics = nil
20
20
 
21
+ # The following attribute is only used to log whether or not
22
+ # StripeClient#request has been called. To be removed in a
23
+ # future major version.
24
+ @usage = []
25
+
21
26
  @config = case config_arg
22
27
  when Hash
23
28
  Stripe.config.reverse_duplicate_merge(config_arg)
@@ -186,6 +191,7 @@ module Stripe
186
191
  # charge, resp = client.request { Charge.create }
187
192
  #
188
193
  def request
194
+ @usage = ["stripe_client_request"]
189
195
  old_stripe_client = self.class.current_thread_context.active_client
190
196
  self.class.current_thread_context.active_client = self
191
197
 
@@ -200,6 +206,7 @@ module Stripe
200
206
  res = yield
201
207
  [res, self.class.current_thread_context.last_responses[object_id]]
202
208
  ensure
209
+ @usage = []
203
210
  self.class.current_thread_context.active_client = old_stripe_client
204
211
  self.class.current_thread_context.last_responses.delete(object_id)
205
212
  end
@@ -583,7 +590,7 @@ module Stripe
583
590
  if config.enable_telemetry? && context.request_id
584
591
  request_duration_ms = (request_duration * 1000).to_i
585
592
  @last_request_metrics =
586
- StripeRequestMetrics.new(context.request_id, request_duration_ms, usage: usage)
593
+ StripeRequestMetrics.new(context.request_id, request_duration_ms, usage: usage + @usage)
587
594
  end
588
595
 
589
596
  # We rescue all exceptions from a request so that we have an easy spot to
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stripe
4
- VERSION = "11.3.0"
4
+ VERSION = "11.4.0"
5
5
  end
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: 11.3.0
4
+ version: 11.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-05-02 00:00:00.000000000 Z
11
+ date: 2024-05-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.