moov_ruby 26.1.5 → 26.4.0.pre.dev.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 +4 -4
- data/lib/crystalline/metadata_fields.rb +14 -20
- data/lib/crystalline/module.rb +10 -96
- data/lib/crystalline/types.rb +0 -79
- data/lib/moov/models/components/accounttype.rb +2 -0
- data/lib/moov/models/components/accountverificationstatus.rb +2 -0
- data/lib/moov/models/components/achcreditsamedaypaymentmethod_paymentmethodtype.rb +2 -0
- data/lib/moov/models/components/achcreditstandardpaymentmethod_paymentmethodtype.rb +2 -0
- data/lib/moov/models/components/achdebitcollectpaymentmethod_paymentmethodtype.rb +2 -0
- data/lib/moov/models/components/achdebitfundpaymentmethod_paymentmethodtype.rb +2 -0
- data/lib/moov/models/components/achreturncode.rb +2 -0
- data/lib/moov/models/components/achtransactionstatus.rb +2 -0
- data/lib/moov/models/components/applepaypaymentmethod_paymentmethodtype.rb +2 -0
- data/lib/moov/models/components/applicationscope.rb +2 -0
- data/lib/moov/models/components/bankaccountholdertype.rb +2 -0
- data/lib/moov/models/components/bankaccountstatus.rb +2 -0
- data/lib/moov/models/components/bankaccountstatusreason.rb +2 -0
- data/lib/moov/models/components/bankaccounttype.rb +2 -0
- data/lib/moov/models/components/bankaccountverificationmethod.rb +2 -0
- data/lib/moov/models/components/bankaccountverificationstatus.rb +2 -0
- data/lib/moov/models/components/bankaccountwaitfor.rb +2 -0
- data/lib/moov/models/components/businesspresence.rb +2 -0
- data/lib/moov/models/components/businesstype.rb +2 -0
- data/lib/moov/models/components/calltoaction.rb +2 -0
- data/lib/moov/models/components/cancellationstatus.rb +2 -0
- data/lib/moov/models/components/capabilityid.rb +2 -0
- data/lib/moov/models/components/capabilitystatus.rb +2 -0
- data/lib/moov/models/components/cardacquiringmodel.rb +2 -0
- data/lib/moov/models/components/cardbrand.rb +2 -0
- data/lib/moov/models/components/cardissuingnetwork.rb +2 -0
- data/lib/moov/models/components/cardpaymentpaymentmethod_paymentmethodtype.rb +2 -0
- data/lib/moov/models/components/cardpresentpaymentpaymentmethod_paymentmethodtype.rb +2 -0
- data/lib/moov/models/components/cardtransactionfailurecode.rb +2 -0
- data/lib/moov/models/components/cardtransactionstatus.rb +2 -0
- data/lib/moov/models/components/cardtype.rb +2 -0
- data/lib/moov/models/components/cardupdatereason.rb +2 -0
- data/lib/moov/models/components/cardverificationresult.rb +2 -0
- data/lib/moov/models/components/collectionpaymentmethodtype.rb +2 -0
- data/lib/moov/models/components/createaccounttype.rb +2 -0
- data/lib/moov/models/components/createpaymentlinklineitem.rb +2 -6
- data/lib/moov/models/components/createpaymentlinklineitemoption.rb +1 -4
- data/lib/moov/models/components/createscheduledtransferlineitem.rb +1 -2
- data/lib/moov/models/components/createtransferlineitem.rb +1 -2
- data/lib/moov/models/components/debitholdperiod.rb +2 -0
- data/lib/moov/models/components/disbursementpaymentmethodtype.rb +2 -0
- data/lib/moov/models/components/disputephase.rb +2 -0
- data/lib/moov/models/components/disputestatus.rb +2 -0
- data/lib/moov/models/components/documenttype.rb +2 -0
- data/lib/moov/models/components/domesticpullfromcard.rb +2 -0
- data/lib/moov/models/components/domesticpushtocard.rb +2 -0
- data/lib/moov/models/components/entrymode.rb +2 -0
- data/lib/moov/models/components/evidencetype.rb +2 -0
- data/lib/moov/models/components/feecategory.rb +2 -0
- data/lib/moov/models/components/feemodel.rb +2 -0
- data/lib/moov/models/components/feeplanagreementstatus.rb +2 -0
- data/lib/moov/models/components/filepurpose.rb +2 -0
- data/lib/moov/models/components/filestatus.rb +2 -0
- data/lib/moov/models/components/fulfillmentmethod.rb +2 -0
- data/lib/moov/models/components/fulfillmenttimeframe.rb +2 -0
- data/lib/moov/models/components/generatedby.rb +2 -6
- data/lib/moov/models/components/generatedby.rbi +0 -2
- data/lib/moov/models/components/geographicreach.rb +2 -0
- data/lib/moov/models/components/granttype.rb +2 -0
- data/lib/moov/models/components/imagemetadata.rb +1 -1
- data/lib/moov/models/components/instantbankcreditpaymentmethod_paymentmethodtype.rb +2 -0
- data/lib/moov/models/components/invoicestatus.rb +2 -0
- data/lib/moov/models/components/issuedcardauthorizationeventresult.rb +2 -0
- data/lib/moov/models/components/issuedcardeventtype.rb +2 -0
- data/lib/moov/models/components/issuedcardformfactor.rb +2 -0
- data/lib/moov/models/components/issuedcardstate.rb +2 -0
- data/lib/moov/models/components/issuingauthorizationstatus.rb +2 -0
- data/lib/moov/models/components/issuingintervallimit.rb +2 -0
- data/lib/moov/models/components/kind.rb +2 -0
- data/lib/moov/models/components/linkcardwaitfor.rb +2 -0
- data/lib/moov/models/components/microdepositstatus.rb +2 -0
- data/lib/moov/models/components/mode.rb +2 -0
- data/lib/moov/models/components/monthlyvolumerange.rb +2 -0
- data/lib/moov/models/components/moovwalletpaymentmethod_paymentmethodtype.rb +2 -0
- data/lib/moov/models/components/occurrencestatus.rb +2 -0
- data/lib/moov/models/components/paymentlinkstatus.rb +2 -0
- data/lib/moov/models/components/paymentlinktype.rb +2 -0
- data/lib/moov/models/components/paymentmethodtype.rb +2 -0
- data/lib/moov/models/components/pendinglitigation.rb +2 -0
- data/lib/moov/models/components/primaryregulator.rb +2 -0
- data/lib/moov/models/components/pullfromcardpaymentmethod_paymentmethodtype.rb +2 -0
- data/lib/moov/models/components/pushtocardpaymentmethod_paymentmethodtype.rb +2 -0
- data/lib/moov/models/components/receiptkind.rb +2 -0
- data/lib/moov/models/components/refundcardstatus.rb +2 -0
- data/lib/moov/models/components/refundpolicy.rb +2 -0
- data/lib/moov/models/components/refundstatus.rb +2 -0
- data/lib/moov/models/components/requirementerrorcode.rb +2 -0
- data/lib/moov/models/components/requirementid.rb +2 -0
- data/lib/moov/models/components/returnpolicytype.rb +2 -0
- data/lib/moov/models/components/rtpcreditpaymentmethod_paymentmethodtype.rb +2 -0
- data/lib/moov/models/components/rtpfailurecode.rb +2 -0
- data/lib/moov/models/components/rtprejectioncode.rb +2 -0
- data/lib/moov/models/components/rtptransactionstatus.rb +2 -0
- data/lib/moov/models/components/seccode.rb +2 -0
- data/lib/moov/models/components/status.rb +2 -0
- data/lib/moov/models/components/submissionintent.rb +2 -0
- data/lib/moov/models/components/sweepconfigstatus.rb +2 -0
- data/lib/moov/models/components/sweepstatus.rb +2 -0
- data/lib/moov/models/components/terminalapplicationplatform.rb +2 -0
- data/lib/moov/models/components/terminalapplicationstatus.rb +2 -0
- data/lib/moov/models/components/ticketstatus.rb +2 -0
- data/lib/moov/models/components/token_type_hint.rb +2 -0
- data/lib/moov/models/components/tokentype.rb +2 -0
- data/lib/moov/models/components/transactionsource.rb +2 -0
- data/lib/moov/models/components/transferdestination.rb +5 -5
- data/lib/moov/models/components/transferfailurereason.rb +2 -0
- data/lib/moov/models/components/transferoptions.rb +3 -3
- data/lib/moov/models/components/transferparty.rb +2 -0
- data/lib/moov/models/components/transfersource.rb +7 -7
- data/lib/moov/models/components/transferstatus.rb +2 -0
- data/lib/moov/models/components/transferwaitfor.rb +2 -0
- data/lib/moov/models/components/underwritingstatus.rb +2 -0
- data/lib/moov/models/components/updateissuedcardstate.rb +2 -0
- data/lib/moov/models/components/updateticketstatus.rb +2 -0
- data/lib/moov/models/components/use.rb +2 -0
- data/lib/moov/models/components/verificationstatus.rb +2 -0
- data/lib/moov/models/components/verificationstatusdetail.rb +2 -0
- data/lib/moov/models/components/walletstatus.rb +2 -0
- data/lib/moov/models/components/wallettransactionsourcetype.rb +2 -0
- data/lib/moov/models/components/wallettransactionstatus.rb +2 -0
- data/lib/moov/models/components/wallettransactiontype.rb +2 -0
- data/lib/moov/models/components/wallettype.rb +2 -0
- data/lib/moov/models/components/webhookdatatransferstatus.rb +2 -0
- data/lib/moov/models/components/webhookeventtype.rb +2 -0
- data/lib/moov/models/components/webhookstatus.rb +2 -0
- data/lib/moov/models/components.rb +0 -31
- data/lib/moov/models/operations/createtransfer_request.rb +2 -2
- data/lib/moov/models/operations/getscheduledoccurrence_request.rb +4 -4
- data/lib/moov/models/operations/hydrate.rb +2 -0
- data/lib/moov/sdkconfiguration.rb +4 -4
- data/lib/moov/utils/url.rb +1 -1
- data/lib/moov/utils/utils.rb +0 -12
- metadata +6 -69
- data/lib/crystalline/enum.rbi +0 -17
- data/lib/moov/models/components/achcreditsamedaytransferpaymentmethod.rb +0 -40
- data/lib/moov/models/components/achcreditsamedaytransferpaymentmethod.rbi +0 -17
- data/lib/moov/models/components/achcreditsamedaytransferpaymentmethod_paymentmethodtype.rb +0 -18
- data/lib/moov/models/components/achcreditsamedaytransferpaymentmethod_paymentmethodtype.rbi +0 -11
- data/lib/moov/models/components/achcreditstandardtransferpaymentmethod.rb +0 -40
- data/lib/moov/models/components/achcreditstandardtransferpaymentmethod.rbi +0 -17
- data/lib/moov/models/components/achcreditstandardtransferpaymentmethod_paymentmethodtype.rb +0 -18
- data/lib/moov/models/components/achcreditstandardtransferpaymentmethod_paymentmethodtype.rbi +0 -11
- data/lib/moov/models/components/achdebitcollecttransferpaymentmethod.rb +0 -40
- data/lib/moov/models/components/achdebitcollecttransferpaymentmethod.rbi +0 -17
- data/lib/moov/models/components/achdebitcollecttransferpaymentmethod_paymentmethodtype.rb +0 -18
- data/lib/moov/models/components/achdebitcollecttransferpaymentmethod_paymentmethodtype.rbi +0 -11
- data/lib/moov/models/components/achdebitfundtransferpaymentmethod.rb +0 -40
- data/lib/moov/models/components/achdebitfundtransferpaymentmethod.rbi +0 -17
- data/lib/moov/models/components/achdebitfundtransferpaymentmethod_paymentmethodtype.rb +0 -18
- data/lib/moov/models/components/achdebitfundtransferpaymentmethod_paymentmethodtype.rbi +0 -11
- data/lib/moov/models/components/applepaytransferpaymentmethod.rb +0 -40
- data/lib/moov/models/components/applepaytransferpaymentmethod.rbi +0 -17
- data/lib/moov/models/components/applepaytransferpaymentmethod_paymentmethodtype.rb +0 -18
- data/lib/moov/models/components/applepaytransferpaymentmethod_paymentmethodtype.rbi +0 -11
- data/lib/moov/models/components/cardpaymenttransferpaymentmethod.rb +0 -40
- data/lib/moov/models/components/cardpaymenttransferpaymentmethod.rbi +0 -17
- data/lib/moov/models/components/cardpaymenttransferpaymentmethod_paymentmethodtype.rb +0 -18
- data/lib/moov/models/components/cardpaymenttransferpaymentmethod_paymentmethodtype.rbi +0 -11
- data/lib/moov/models/components/cardpresentpaymenttransferpaymentmethod.rb +0 -40
- data/lib/moov/models/components/cardpresentpaymenttransferpaymentmethod.rbi +0 -17
- data/lib/moov/models/components/cardpresentpaymenttransferpaymentmethod_paymentmethodtype.rb +0 -18
- data/lib/moov/models/components/cardpresentpaymenttransferpaymentmethod_paymentmethodtype.rbi +0 -11
- data/lib/moov/models/components/instantbankcredittransferpaymentmethod.rb +0 -40
- data/lib/moov/models/components/instantbankcredittransferpaymentmethod.rbi +0 -17
- data/lib/moov/models/components/instantbankcredittransferpaymentmethod_paymentmethodtype.rb +0 -18
- data/lib/moov/models/components/instantbankcredittransferpaymentmethod_paymentmethodtype.rbi +0 -11
- data/lib/moov/models/components/moovwallettransferpaymentmethod.rb +0 -40
- data/lib/moov/models/components/moovwallettransferpaymentmethod.rbi +0 -17
- data/lib/moov/models/components/moovwallettransferpaymentmethod_paymentmethodtype.rb +0 -18
- data/lib/moov/models/components/moovwallettransferpaymentmethod_paymentmethodtype.rbi +0 -11
- data/lib/moov/models/components/pullfromcardtransferpaymentmethod.rb +0 -40
- data/lib/moov/models/components/pullfromcardtransferpaymentmethod.rbi +0 -17
- data/lib/moov/models/components/pullfromcardtransferpaymentmethod_paymentmethodtype.rb +0 -18
- data/lib/moov/models/components/pullfromcardtransferpaymentmethod_paymentmethodtype.rbi +0 -11
- data/lib/moov/models/components/pushtocardtransferpaymentmethod.rb +0 -40
- data/lib/moov/models/components/pushtocardtransferpaymentmethod.rbi +0 -17
- data/lib/moov/models/components/pushtocardtransferpaymentmethod_paymentmethodtype.rb +0 -18
- data/lib/moov/models/components/pushtocardtransferpaymentmethod_paymentmethodtype.rbi +0 -11
- data/lib/moov/models/components/rtpcredittransferpaymentmethod.rb +0 -40
- data/lib/moov/models/components/rtpcredittransferpaymentmethod.rbi +0 -17
- data/lib/moov/models/components/rtpcredittransferpaymentmethod_paymentmethodtype.rb +0 -18
- data/lib/moov/models/components/rtpcredittransferpaymentmethod_paymentmethodtype.rbi +0 -11
- data/lib/moov/models/components/transferentrymode.rb +0 -18
- data/lib/moov/models/components/transferentrymode.rbi +0 -11
- data/lib/moov/models/components/transferpaymentmethod.rb +0 -27
- data/lib/moov/models/components/transferpaymentmethod.rbi +0 -11
- data/lib/moov/models/components/transferpaymentmethodsbankaccount.rb +0 -70
- data/lib/moov/models/components/transferpaymentmethodsbankaccount.rbi +0 -31
- data/lib/moov/models/components/transferpaymentmethodscard.rb +0 -98
- data/lib/moov/models/components/transferpaymentmethodscard.rbi +0 -45
- data/lib/moov/models/components/transferpaymentmethodswallet.rb +0 -42
- data/lib/moov/models/components/transferpaymentmethodswallet.rbi +0 -17
- data/lib/moov/models/components/transferpaymentmethodtype.rb +0 -29
- data/lib/moov/models/components/transferpaymentmethodtype.rbi +0 -11
- data/lib/moov/models/components/transferterminalcard.rb +0 -78
- data/lib/moov/models/components/transferterminalcard.rbi +0 -35
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3922dff26009d88f0b7e2edb3da490053e8e1c2a7e452ff3fbd86ccbb910378c
|
|
4
|
+
data.tar.gz: c470415c9e71f3d2ac59c33685276a0a006f82cc837d276f9cd40f6470f52320
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fdc24fd4cee8041772c731fdb780a470c83330b3bff69a1a3d9801e118730af157406bca4e99e4f20ba1ba5c78c4483ee7339a0d93c5f30df0358a6896023a73
|
|
7
|
+
data.tar.gz: 01c272e8bedfdced428277c3b6ed8fb97d86fc68dc21c4917a8375bed669b9ed9a85b7eb0f14787951590e80e1061e8a900cddd6ea1f573022578234285d50fc
|
|
@@ -84,9 +84,7 @@ module Crystalline
|
|
|
84
84
|
# If field is nilable, and the value is not in the dict, just move to the next field
|
|
85
85
|
next if value.nil?
|
|
86
86
|
|
|
87
|
-
if
|
|
88
|
-
to_build[key] = field_type.parse(value)
|
|
89
|
-
elsif Crystalline::Utils.arr? field_type
|
|
87
|
+
if Crystalline::Utils.arr? field_type
|
|
90
88
|
inner_type = Crystalline::Utils.arr_of(field_type)
|
|
91
89
|
unmarshalled_array = value.map { |f| unmarshal_single(inner_type, f, format_metadata) }
|
|
92
90
|
to_build[key] = unmarshalled_array
|
|
@@ -114,21 +112,17 @@ module Crystalline
|
|
|
114
112
|
union_types = Crystalline::Utils.get_union_types(field_type)
|
|
115
113
|
union_types = union_types.sort_by { |klass| Crystalline.non_nilable_attr_count(klass) }
|
|
116
114
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
next
|
|
127
|
-
rescue KeyError
|
|
128
|
-
next
|
|
129
|
-
end
|
|
130
|
-
break
|
|
115
|
+
union_types.each do |union_type|
|
|
116
|
+
begin
|
|
117
|
+
to_build[key] = Crystalline.unmarshal_json(value, union_type)
|
|
118
|
+
rescue TypeError
|
|
119
|
+
next
|
|
120
|
+
rescue NoMethodError
|
|
121
|
+
next
|
|
122
|
+
rescue KeyError
|
|
123
|
+
next
|
|
131
124
|
end
|
|
125
|
+
break
|
|
132
126
|
end
|
|
133
127
|
end
|
|
134
128
|
elsif field_type.instance_of?(Class) && field_type.include?(::Crystalline::MetadataFields)
|
|
@@ -188,10 +182,10 @@ module Crystalline
|
|
|
188
182
|
next if f.nil? && !required
|
|
189
183
|
result[key] = nil if f.nil? && required
|
|
190
184
|
|
|
191
|
-
if f.is_a?
|
|
185
|
+
if f.is_a? Array
|
|
192
186
|
result[key] = f.map { |o| marshal_single(o) }
|
|
193
|
-
elsif f.is_a?
|
|
194
|
-
result[key] = f.
|
|
187
|
+
elsif f.is_a? Hash
|
|
188
|
+
result[key] = f.map { |k, v| [k, marshal_single(v)] }
|
|
195
189
|
else
|
|
196
190
|
result[key] = marshal_single(f)
|
|
197
191
|
end
|
data/lib/crystalline/module.rb
CHANGED
|
@@ -4,11 +4,6 @@
|
|
|
4
4
|
# frozen_string_literal: true
|
|
5
5
|
|
|
6
6
|
module Crystalline
|
|
7
|
-
@union_strategy = :left_to_right
|
|
8
|
-
|
|
9
|
-
class << self
|
|
10
|
-
attr_accessor :union_strategy
|
|
11
|
-
end
|
|
12
7
|
|
|
13
8
|
def self.to_dict(complex)
|
|
14
9
|
if complex.is_a? Array
|
|
@@ -34,18 +29,21 @@ module Crystalline
|
|
|
34
29
|
if Crystalline::Utils.nilable? type
|
|
35
30
|
type = Crystalline::Utils.nilable_of type
|
|
36
31
|
end
|
|
37
|
-
if type.
|
|
38
|
-
type.parse(data)
|
|
39
|
-
elsif type.instance_of?(Class) && type.include?(::Crystalline::MetadataFields)
|
|
32
|
+
if type.instance_of?(Class) && type.include?(::Crystalline::MetadataFields)
|
|
40
33
|
type.from_dict(data)
|
|
41
34
|
elsif Crystalline::Utils.union? type
|
|
42
35
|
union_types = Crystalline::Utils.get_union_types(type)
|
|
43
36
|
union_types = union_types.sort_by { |klass| Crystalline.non_nilable_attr_count(klass) }
|
|
44
37
|
|
|
45
|
-
|
|
46
|
-
Crystalline.
|
|
47
|
-
|
|
48
|
-
|
|
38
|
+
union_types.each do |union_type|
|
|
39
|
+
unmarshalled_val = Crystalline.unmarshal_json(data, union_type)
|
|
40
|
+
return unmarshalled_val
|
|
41
|
+
rescue TypeError
|
|
42
|
+
next
|
|
43
|
+
rescue NoMethodError
|
|
44
|
+
next
|
|
45
|
+
rescue KeyError
|
|
46
|
+
next
|
|
49
47
|
end
|
|
50
48
|
elsif Crystalline::Utils.arr? type
|
|
51
49
|
data.map { |v| Crystalline.unmarshal_json(v, Crystalline::Utils.arr_of(type)) }
|
|
@@ -57,8 +55,6 @@ module Crystalline
|
|
|
57
55
|
Crystalline::Utils.to_boolean(data)
|
|
58
56
|
elsif type.is_a?(Class) && type < T::Enum
|
|
59
57
|
type.deserialize(data)
|
|
60
|
-
elsif type.is_a?(Class) && type.respond_to?(:enums) && type.respond_to?(:deserialize)
|
|
61
|
-
type.deserialize(data)
|
|
62
58
|
else
|
|
63
59
|
data
|
|
64
60
|
end
|
|
@@ -78,88 +74,6 @@ module Crystalline
|
|
|
78
74
|
end
|
|
79
75
|
end
|
|
80
76
|
|
|
81
|
-
def self.unmarshal_union_left_to_right(data, union_types)
|
|
82
|
-
union_types.each do |union_type|
|
|
83
|
-
return Crystalline.unmarshal_json(data, union_type)
|
|
84
|
-
rescue TypeError
|
|
85
|
-
next
|
|
86
|
-
rescue NoMethodError
|
|
87
|
-
next
|
|
88
|
-
rescue KeyError
|
|
89
|
-
next
|
|
90
|
-
end
|
|
91
|
-
nil
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
def self.unmarshal_union_populated_fields(data, union_types)
|
|
95
|
-
best_value = nil
|
|
96
|
-
best_matched = -1
|
|
97
|
-
best_inexact = 0
|
|
98
|
-
best_unmatched = 0
|
|
99
|
-
|
|
100
|
-
union_types.each do |union_type|
|
|
101
|
-
value = Crystalline.unmarshal_json(data, union_type)
|
|
102
|
-
matched, inexact, unmatched = count_matched_fields(value, data)
|
|
103
|
-
|
|
104
|
-
if best_value.nil? ||
|
|
105
|
-
matched > best_matched ||
|
|
106
|
-
(matched == best_matched && inexact < best_inexact) ||
|
|
107
|
-
(matched == best_matched && inexact == best_inexact && unmatched < best_unmatched)
|
|
108
|
-
best_value = value
|
|
109
|
-
best_matched = matched
|
|
110
|
-
best_inexact = inexact
|
|
111
|
-
best_unmatched = unmatched
|
|
112
|
-
end
|
|
113
|
-
rescue TypeError
|
|
114
|
-
next
|
|
115
|
-
rescue NoMethodError
|
|
116
|
-
next
|
|
117
|
-
rescue KeyError
|
|
118
|
-
next
|
|
119
|
-
end
|
|
120
|
-
best_value
|
|
121
|
-
end
|
|
122
|
-
|
|
123
|
-
def self.count_matched_fields(value, raw_data)
|
|
124
|
-
matched = 0
|
|
125
|
-
inexact = 0
|
|
126
|
-
unmatched = 0
|
|
127
|
-
|
|
128
|
-
if value.is_a?(Crystalline::Unknown)
|
|
129
|
-
return [0, 0, 0]
|
|
130
|
-
elsif value.class.include?(::Crystalline::MetadataFields)
|
|
131
|
-
value.fields.each do |field|
|
|
132
|
-
format_metadata = field.metadata.fetch(:format_json, {})
|
|
133
|
-
lookup = format_metadata.fetch(:letter_case, nil)&.call
|
|
134
|
-
field_val = value.send(field.name)
|
|
135
|
-
|
|
136
|
-
if raw_data.is_a?(::Hash) && lookup && raw_data.key?(lookup)
|
|
137
|
-
if field_val.class.include?(::Crystalline::MetadataFields) && raw_data[lookup].is_a?(::Hash)
|
|
138
|
-
nested_matched, nested_inexact, nested_unmatched = count_matched_fields(field_val, raw_data[lookup])
|
|
139
|
-
matched += nested_matched
|
|
140
|
-
inexact += nested_inexact
|
|
141
|
-
unmatched += nested_unmatched
|
|
142
|
-
else
|
|
143
|
-
matched += 1
|
|
144
|
-
if field_val.respond_to?(:known?) && !field_val.known?
|
|
145
|
-
inexact += 1
|
|
146
|
-
end
|
|
147
|
-
end
|
|
148
|
-
elsif !::Crystalline::Utils.nilable?(field.type)
|
|
149
|
-
unmatched += 1
|
|
150
|
-
end
|
|
151
|
-
end
|
|
152
|
-
elsif value.is_a?(::Array)
|
|
153
|
-
matched = value.length
|
|
154
|
-
elsif value.is_a?(::Hash)
|
|
155
|
-
matched = value.length
|
|
156
|
-
else
|
|
157
|
-
matched = 1
|
|
158
|
-
end
|
|
159
|
-
|
|
160
|
-
[matched, inexact, unmatched]
|
|
161
|
-
end
|
|
162
|
-
|
|
163
77
|
def self.non_nilable_attr_count(klass)
|
|
164
78
|
# somewhat sane sort ordering for Union deserialization.
|
|
165
79
|
# All Crystalline objects return the number of non-nilable fields
|
data/lib/crystalline/types.rb
CHANGED
|
@@ -40,58 +40,6 @@ module Crystalline
|
|
|
40
40
|
class Boolean
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
-
# Wraps an unrecognized payload from an open discriminated union.
|
|
44
|
-
# Produced when the discriminator value is missing, unknown, or schema validation fails.
|
|
45
|
-
class Unknown
|
|
46
|
-
attr_reader :raw
|
|
47
|
-
|
|
48
|
-
def initialize(raw:)
|
|
49
|
-
@raw = raw
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def unknown?
|
|
53
|
-
true
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
# Forward-compatible discriminated union parser.
|
|
58
|
-
# Known discriminator values are deserialized to their mapped types.
|
|
59
|
-
# Unknown or invalid payloads are captured as Crystalline::Unknown.
|
|
60
|
-
class DiscriminatedUnion
|
|
61
|
-
attr_reader :discriminator, :variants
|
|
62
|
-
|
|
63
|
-
def initialize(discriminator, variants)
|
|
64
|
-
@discriminator = discriminator
|
|
65
|
-
@variants = variants
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
def parse(payload)
|
|
69
|
-
unless payload.is_a?(::Hash)
|
|
70
|
-
return Unknown.new(raw: payload)
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
disc_value = payload[@discriminator]
|
|
74
|
-
unless disc_value.is_a?(::String)
|
|
75
|
-
return Unknown.new(raw: payload)
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
variant_type = @variants[disc_value]
|
|
79
|
-
unless variant_type
|
|
80
|
-
return Unknown.new(raw: payload)
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
begin
|
|
84
|
-
Crystalline.unmarshal_json(payload, variant_type)
|
|
85
|
-
rescue StandardError
|
|
86
|
-
Unknown.new(raw: payload)
|
|
87
|
-
end
|
|
88
|
-
end
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
def self.unknown?(value)
|
|
92
|
-
value.is_a?(Unknown)
|
|
93
|
-
end
|
|
94
|
-
|
|
95
43
|
module Enum
|
|
96
44
|
def self.included(base)
|
|
97
45
|
base.extend(ClassMethods)
|
|
@@ -119,19 +67,9 @@ module Crystalline
|
|
|
119
67
|
end
|
|
120
68
|
end
|
|
121
69
|
|
|
122
|
-
def open!
|
|
123
|
-
@open = true
|
|
124
|
-
end
|
|
125
|
-
|
|
126
|
-
def open?
|
|
127
|
-
@open == true
|
|
128
|
-
end
|
|
129
|
-
|
|
130
70
|
def deserialize(val)
|
|
131
71
|
if @mapping.include? val
|
|
132
72
|
@mapping[val]
|
|
133
|
-
elsif open?
|
|
134
|
-
new(val)
|
|
135
73
|
else
|
|
136
74
|
raise "Invalid value for enum: #{val}"
|
|
137
75
|
end
|
|
@@ -141,22 +79,5 @@ module Crystalline
|
|
|
141
79
|
def serialize
|
|
142
80
|
@val
|
|
143
81
|
end
|
|
144
|
-
|
|
145
|
-
def known?
|
|
146
|
-
self.class.instance_variable_get(:@mapping)&.value?(self) || false
|
|
147
|
-
end
|
|
148
|
-
|
|
149
|
-
def ==(other)
|
|
150
|
-
other = other.serialize if other.is_a?(self.class)
|
|
151
|
-
@val == other
|
|
152
|
-
end
|
|
153
|
-
|
|
154
|
-
def eql?(other)
|
|
155
|
-
self == other
|
|
156
|
-
end
|
|
157
|
-
|
|
158
|
-
def hash
|
|
159
|
-
@val.hash
|
|
160
|
-
end
|
|
161
82
|
end
|
|
162
83
|
end
|
|
@@ -9,6 +9,8 @@ module Moov
|
|
|
9
9
|
module Components
|
|
10
10
|
# BankAccountStatusReason - The reason the bank account status changed to the current value.
|
|
11
11
|
class BankAccountStatusReason < T::Enum
|
|
12
|
+
|
|
13
|
+
|
|
12
14
|
enums do
|
|
13
15
|
BANK_ACCOUNT_CREATED = new('bank-account-created')
|
|
14
16
|
VERIFICATION_INITIATED = new('verification-initiated')
|
|
@@ -9,6 +9,8 @@ module Moov
|
|
|
9
9
|
module Components
|
|
10
10
|
# BusinessType - The type of entity represented by this business.
|
|
11
11
|
class BusinessType < T::Enum
|
|
12
|
+
|
|
13
|
+
|
|
12
14
|
enums do
|
|
13
15
|
SOLE_PROPRIETORSHIP = new('soleProprietorship')
|
|
14
16
|
UNINCORPORATED_ASSOCIATION = new('unincorporatedAssociation')
|
|
@@ -11,6 +11,8 @@ module Moov
|
|
|
11
11
|
#
|
|
12
12
|
# The `production-app`, `platform.production-app`, and / or `platform.wallet-transfers` capabilities might appear in your list. These are read-only capabilities that Moov requests and uses for account verification purposes. These capabilities remains active with your account and require no additional action.
|
|
13
13
|
class CapabilityID < T::Enum
|
|
14
|
+
|
|
15
|
+
|
|
14
16
|
enums do
|
|
15
17
|
TRANSFERS = new('transfers')
|
|
16
18
|
SEND_FUNDS = new('send-funds')
|