stripe 18.4.0.pre.alpha.5 → 18.4.0.pre.alpha.6

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: df9a53548270e88d7ed4ab754648b73cc7b560b9e9bf066b8116f942668b107e
4
- data.tar.gz: e4eec93f3dee3b0c59ddc1023eb18a824d603f2b85a258fb94e8857e941398a6
3
+ metadata.gz: 2401c7a043ebd47ce50478f3504d47b3d4f87858b2ff59b7609ce9433b3afd79
4
+ data.tar.gz: 85edd7ba11d395b79b7b26391083aa1b6c5a92db930b3893535d3f7f31e3cee4
5
5
  SHA512:
6
- metadata.gz: db7e9c243c079ccee1b5a9618bf8c29d455d969cb6e80365b295ce3d8983dfa759f4e14c3d4e6abeb6489e0bd29c81d185b19691f33221fc2402235f1ec0bcfb
7
- data.tar.gz: 2153bd8aa626daea42bc474df76407f2e5a13eeeb969daa0790460b48cda4d9f850539bf25d54585487d1e6505c244db837910668ca3c30a06d11693afee11a4
6
+ metadata.gz: a51d46f6b4d7a2fca45c0e394bd32e07dcf2e6a883341589db805d487639bccf52afafe61eb372c3abef9b3c5a182dd8d76b19b9e933cd761bae41c7f4aeca96
7
+ data.tar.gz: 1b1087ef84a593165062c1b8196894455637bfa6f03e864b1321cc963d90415a629d1b591267879ef7fd484b7ea5c88896ac8d2a3d1556da9235c0943dfea9b5
@@ -5,11 +5,46 @@ module Stripe
5
5
  # For internal use only. Does not provide a stable API and may be broken
6
6
  # with future non-major changes.
7
7
  class RequestParams
8
+ class << self
9
+ # Override the object instantiation flow in Ruby in order to track explicitly set keys
10
+ # V2 APIs accept null values on the backend. However, we do not want to set a key to nil
11
+ # if the user has not explicitly set them to nil
12
+ # TODO(major): https://go/j/DEVSDK-2990
13
+ def new(**kwargs)
14
+ instance = allocate
15
+ # Track explicitly set keys for V2 classes only
16
+ instance.instance_variable_set(:@_explicitly_set_keys, kwargs.keys.to_set) if name&.start_with?("Stripe::V2::")
17
+ instance.send(:initialize, **kwargs)
18
+ instance
19
+ end
20
+
21
+ # Override attr_accessor to create setters that track explicitly set keys for V2 classes
22
+ def attr_accessor(*names)
23
+ names.each do |name|
24
+ # Define getter
25
+ define_method(name) { instance_variable_get("@#{name}") }
26
+
27
+ # Define setter that tracks the key as explicitly set
28
+ define_method("#{name}=") do |value|
29
+ @_explicitly_set_keys&.add(name)
30
+ instance_variable_set("@#{name}", value)
31
+ end
32
+ end
33
+ end
34
+ end
35
+
8
36
  def to_h
9
37
  instance_variables.each_with_object({}) do |var, hash|
38
+ # _explicitly_set_keys is set as an instance variable.
39
+ # Ignore the var if it is _explicitly_set_keys itself.
40
+ next if var == :@_explicitly_set_keys
41
+
10
42
  key = var.to_s.delete("@").to_sym
11
43
  value = instance_variable_get(var)
12
44
 
45
+ # For V2 classes, only include keys that were explicitly set
46
+ next if @_explicitly_set_keys && !@_explicitly_set_keys.include?(key)
47
+
13
48
  hash[key] = if value.is_a?(RequestParams)
14
49
  value.to_h
15
50
  # Check if value is an array and contains RequestParams objects
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stripe
4
- VERSION = "18.4.0-alpha.5"
4
+ VERSION = "18.4.0-alpha.6"
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: 18.4.0.pre.alpha.5
4
+ version: 18.4.0.pre.alpha.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-02-19 00:00:00.000000000 Z
11
+ date: 2026-02-23 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.