stripe 16.1.0.pre.beta.1 → 17.1.0.pre.beta.1

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: 253fff4ad36106e7191ee6d1286f7a88fe5dd56afb8ddb058b23131f39bd0cda
4
- data.tar.gz: 97d61f2eaef7ff81f91937c97ada84f0a1a90070e19e1d321155e67998f78840
3
+ metadata.gz: b879928beeb4512222ac791d14b4e63ee20fa33f1143ade1dfb3a37bd12529a6
4
+ data.tar.gz: '09e4ecbc0c9b7cbf3027c715e7220f4d5b8b2e264b909b19ecfb652f5c9b3952'
5
5
  SHA512:
6
- metadata.gz: 9859c21f5fa39d5d3064850f1696a7bdc0c88e7cb588f04c1594afb8e60abaf0fe3186994c5cee43653a1310cd9297ea675147ca0af29d5568e18f5c00cf4284
7
- data.tar.gz: a2dd228ea746b8a7a11bcd8f5826327105f46191348990c45d65dd50dd61b2a0daf7d83bf9a440394dd840ea729f91d7950ab2f839749beafb8337893cf0d89c
6
+ metadata.gz: 40ef9e4990d7575ebf9b5fd5248da3e081733ff651370bc052335b56753f59b515a61293e2c743770bb9477e41360b1c6651ffacac8a554a6e6f4da8cedd453a
7
+ data.tar.gz: e2bc2b0ee1d3e53829537be05640c2c0a2ec009c39c5a1e16a61ab700a859a27bc4eaf1701cf7d2f88d10afe746684f1e1beb1a5fa0512a95c2052b7df7c1b25
@@ -572,8 +572,10 @@ module Stripe
572
572
  headers["Content-Type"] = content_type
573
573
 
574
574
  # `#to_s` any complex objects like files and the like to build output
575
- # that's more condusive to logging.
575
+ # that's more conducive to logging.
576
576
  flattened_params =
577
+ # https://go/j/RUN_DEVSDK-1956 - this is probably a bug
578
+ # once fixed, you can remove the exclusions referencing this ticket in .rubocop.yml
577
579
  flattened_params.map { |k, v| [k, v.is_a?(String) ? v : v.to_s] }.to_h
578
580
 
579
581
  elsif api_mode == :v2
@@ -132,9 +132,7 @@ module Stripe
132
132
 
133
133
  # Get options that are copyable from StripeObject to StripeObject
134
134
  def self.copyable(req_opts)
135
- req_opts.select do |k, _v|
136
- RequestOptions::OPTS_COPYABLE.include?(k)
137
- end
135
+ req_opts.slice(*RequestOptions::OPTS_COPYABLE)
138
136
  end
139
137
  end
140
138
  end
@@ -43,7 +43,7 @@ module Stripe
43
43
  connect_base: connect_base,
44
44
  meter_events_base: meter_events_base,
45
45
  client_id: client_id,
46
- }.reject { |_k, v| v.nil? }
46
+ }.compact
47
47
 
48
48
  config = StripeConfiguration.client_init(config_opts)
49
49
  @requestor = APIRequestor.new(config)
@@ -46,12 +46,7 @@ module Stripe
46
46
  imported_options = USER_CONFIGURABLE_GLOBAL_OPTIONS - StripeClient::CLIENT_OPTIONS
47
47
  client_config = StripeConfiguration.setup do |instance|
48
48
  imported_options.each do |key|
49
- begin
50
- instance.public_send("#{key}=", global_config.public_send(key)) if global_config.respond_to?(key)
51
- rescue NotImplementedError => e
52
- # In Ruby <= 2.5, we can't set write_timeout on Net::HTTP, log an error and continue
53
- Util.log_error("Failed to set #{key} on client configuration: #{e}")
54
- end
49
+ instance.public_send("#{key}=", global_config.public_send(key)) if global_config.respond_to?(key)
55
50
  end
56
51
  end
57
52
  client_config.reverse_duplicate_merge(config_opts)
@@ -202,13 +202,13 @@ module Stripe
202
202
  value.respond_to?(:to_hash) ? value.to_hash : value
203
203
  end
204
204
 
205
- @values.each_with_object({}) do |(key, value), acc|
206
- acc[key] = case value
207
- when Array
208
- value.map(&maybe_to_hash)
209
- else
210
- maybe_to_hash.call(value)
211
- end
205
+ @values.transform_values do |value|
206
+ case value
207
+ when Array
208
+ value.map(&maybe_to_hash)
209
+ else
210
+ maybe_to_hash.call(value)
211
+ end
212
212
  end
213
213
  end
214
214
 
@@ -273,7 +273,7 @@ module Stripe
273
273
 
274
274
  # a `nil` that makes it out of `#serialize_params_value` signals an empty
275
275
  # value that we shouldn't appear in the serialized form of the object
276
- update_hash.reject! { |_, v| v.nil? }
276
+ update_hash.compact!
277
277
 
278
278
  update_hash
279
279
  end
@@ -313,6 +313,7 @@ module Stripe
313
313
  protected def remove_accessors(keys)
314
314
  # not available in the #instance_eval below
315
315
  protected_fields = self.class.protected_fields
316
+ obj = self # capture self to use inside instance_eval
316
317
 
317
318
  metaclass.instance_eval do
318
319
  keys.each do |k|
@@ -342,6 +343,11 @@ module Stripe
342
343
  "collide with an API property name.")
343
344
  end
344
345
  end
346
+
347
+ # Also remove instance variables so that static attr_readers (if any exist)
348
+ # will return nil instead of stale data or data of the wrong type
349
+ ivar_name = :"@#{k}"
350
+ obj.remove_instance_variable(ivar_name) if obj.instance_variable_defined?(ivar_name)
345
351
  end
346
352
  end
347
353
  end
data/lib/stripe/util.rb CHANGED
@@ -334,7 +334,7 @@ module Stripe
334
334
  def self.valid_variable_name?(key)
335
335
  return false if key.empty? || key[0] !~ LEGAL_FIRST_CHARACTER
336
336
 
337
- key[1..-1].chars.all? { |char| char =~ LEGAL_VARIABLE_CHARACTER }
337
+ key[1..].chars.all? { |char| char =~ LEGAL_VARIABLE_CHARACTER }
338
338
  end
339
339
 
340
340
  def self.check_string_argument!(key)
@@ -434,7 +434,7 @@ module Stripe
434
434
  private_class_method :level_name
435
435
 
436
436
  def self.log_internal(message, data = {}, color:, level:, logger:, out:)
437
- data_str = data.reject { |_k, v| v.nil? }
437
+ data_str = data.compact
438
438
  .map do |(k, v)|
439
439
  format("%<key>s=%<value>s",
440
440
  key: colorize(k, color, logger.nil? && !out.nil? && out.isatty),
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stripe
4
- VERSION = "16.1.0-beta.1"
4
+ VERSION = "17.1.0-beta.1"
5
5
  end
data/lib/stripe.rb CHANGED
@@ -160,18 +160,18 @@ module Stripe
160
160
  end
161
161
 
162
162
  def self.add_beta_version(beta_name, version)
163
- unless version.start_with?("v") && version[1..-1].to_i.to_s == version[1..-1]
163
+ unless version.start_with?("v") && version[1..].to_i.to_s == version[1..]
164
164
  raise ArgumentError, "Version must be in the format 'v' followed by a number (e.g., 'v3')"
165
165
  end
166
166
 
167
167
  if (index = api_version.index("; #{beta_name}="))
168
168
  start_index = index + "; #{beta_name}=".length
169
169
  end_index = api_version.index(";", start_index) || api_version.length
170
- current_version = api_version[start_index...end_index][1..-1].to_i
171
- new_version = version[1..-1].to_i
170
+ current_version = api_version[start_index...end_index][1..].to_i
171
+ new_version = version[1..].to_i
172
172
  return if new_version <= current_version # Keep the higher version, no update needed
173
173
 
174
- self.api_version = api_version[0...index] + "; #{beta_name}=#{version}" + api_version[end_index..-1]
174
+ self.api_version = api_version[0...index] + "; #{beta_name}=#{version}" + api_version[end_index..]
175
175
  else
176
176
  self.api_version = "#{api_version}; #{beta_name}=#{version}"
177
177
  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: 16.1.0.pre.beta.1
4
+ version: 17.1.0.pre.beta.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-10-01 00:00:00.000000000 Z
11
+ date: 2025-10-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.
@@ -1343,7 +1343,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
1343
1343
  requirements:
1344
1344
  - - ">="
1345
1345
  - !ruby/object:Gem::Version
1346
- version: 2.3.0
1346
+ version: 2.6.0
1347
1347
  required_rubygems_version: !ruby/object:Gem::Requirement
1348
1348
  requirements:
1349
1349
  - - ">"