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 +4 -4
- data/lib/stripe/request_params.rb +35 -0
- data/lib/stripe/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2401c7a043ebd47ce50478f3504d47b3d4f87858b2ff59b7609ce9433b3afd79
|
|
4
|
+
data.tar.gz: 85edd7ba11d395b79b7b26391083aa1b6c5a92db930b3893535d3f7f31e3cee4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
data/lib/stripe/version.rb
CHANGED
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.
|
|
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-
|
|
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.
|