stripe 15.6.0.pre.alpha.1 → 15.6.0.pre.alpha.2
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/API_VERSION +1 -1
- data/CHANGELOG.md +6 -0
- data/OPENAPI_VERSION +1 -1
- data/VERSION +1 -1
- data/lib/stripe/resources/account.rb +443 -0
- data/lib/stripe/resources/account_link.rb +8 -0
- data/lib/stripe/resources/account_notice.rb +24 -0
- data/lib/stripe/resources/account_session.rb +435 -10
- data/lib/stripe/resources/apple_pay_domain.rb +8 -0
- data/lib/stripe/resources/application.rb +8 -0
- data/lib/stripe/resources/application_fee.rb +16 -0
- data/lib/stripe/resources/application_fee_refund.rb +8 -0
- data/lib/stripe/resources/apps/secret.rb +16 -0
- data/lib/stripe/resources/balance.rb +159 -0
- data/lib/stripe/resources/balance_settings.rb +40 -0
- data/lib/stripe/resources/balance_transaction.rb +16 -0
- data/lib/stripe/resources/bank_account.rb +40 -0
- data/lib/stripe/resources/billing/alert.rb +75 -0
- data/lib/stripe/resources/billing/alert_triggered.rb +8 -0
- data/lib/stripe/resources/billing/credit_balance_summary.rb +80 -0
- data/lib/stripe/resources/billing/credit_balance_transaction.rb +107 -0
- data/lib/stripe/resources/billing/credit_grant.rb +72 -0
- data/lib/stripe/resources/billing/meter.rb +45 -0
- data/lib/stripe/resources/billing/meter_event.rb +8 -0
- data/lib/stripe/resources/billing/meter_event_adjustment.rb +16 -0
- data/lib/stripe/resources/billing/meter_event_summary.rb +8 -0
- data/lib/stripe/resources/billing/meter_usage.rb +8 -0
- data/lib/stripe/resources/billing/meter_usage_row.rb +8 -0
- data/lib/stripe/resources/billing_portal/configuration.rb +122 -0
- data/lib/stripe/resources/billing_portal/session.rb +101 -0
- data/lib/stripe/resources/capability.rb +56 -0
- data/lib/stripe/resources/capital/financing_offer.rb +24 -0
- data/lib/stripe/resources/capital/financing_summary.rb +24 -0
- data/lib/stripe/resources/capital/financing_transaction.rb +24 -0
- data/lib/stripe/resources/card.rb +16 -0
- data/lib/stripe/resources/cash_balance.rb +16 -0
- data/lib/stripe/resources/charge.rb +1052 -16
- data/lib/stripe/resources/checkout/session.rb +950 -0
- data/lib/stripe/resources/climate/order.rb +32 -0
- data/lib/stripe/resources/climate/product.rb +16 -0
- data/lib/stripe/resources/climate/supplier.rb +16 -0
- data/lib/stripe/resources/confirmation_token.rb +960 -38
- data/lib/stripe/resources/connect_collection_transfer.rb +8 -0
- data/lib/stripe/resources/country_spec.rb +32 -0
- data/lib/stripe/resources/coupon.rb +36 -0
- data/lib/stripe/resources/credit_note.rb +70 -0
- data/lib/stripe/resources/credit_note_line_item.rb +53 -0
- data/lib/stripe/resources/customer.rb +77 -0
- data/lib/stripe/resources/customer_balance_transaction.rb +8 -0
- data/lib/stripe/resources/customer_cash_balance_transaction.rb +108 -0
- data/lib/stripe/resources/customer_session.rb +52 -0
- data/lib/stripe/resources/discount.rb +8 -0
- data/lib/stripe/resources/dispute.rb +166 -0
- data/lib/stripe/resources/entitlements/active_entitlement.rb +8 -0
- data/lib/stripe/resources/entitlements/active_entitlement_summary.rb +8 -0
- data/lib/stripe/resources/entitlements/feature.rb +8 -0
- data/lib/stripe/resources/ephemeral_key.rb +8 -0
- data/lib/stripe/resources/event.rb +56 -0
- data/lib/stripe/resources/exchange_rate.rb +8 -0
- data/lib/stripe/resources/file.rb +8 -0
- data/lib/stripe/resources/file_link.rb +8 -0
- data/lib/stripe/resources/financial_connections/account.rb +79 -0
- data/lib/stripe/resources/financial_connections/account_inferred_balance.rb +8 -0
- data/lib/stripe/resources/financial_connections/account_owner.rb +8 -0
- data/lib/stripe/resources/financial_connections/account_ownership.rb +8 -0
- data/lib/stripe/resources/financial_connections/institution.rb +53 -0
- data/lib/stripe/resources/financial_connections/session.rb +63 -1
- data/lib/stripe/resources/financial_connections/transaction.rb +16 -0
- data/lib/stripe/resources/forwarding/request.rb +52 -0
- data/lib/stripe/resources/funding_instructions.rb +193 -0
- data/lib/stripe/resources/fx_quote.rb +48 -0
- data/lib/stripe/resources/identity/verification_report.rb +166 -1
- data/lib/stripe/resources/identity/verification_session.rb +126 -1
- data/lib/stripe/resources/invoice.rb +441 -3
- data/lib/stripe/resources/invoice_item.rb +88 -0
- data/lib/stripe/resources/invoice_line_item.rb +186 -0
- data/lib/stripe/resources/invoice_payment.rb +24 -0
- data/lib/stripe/resources/invoice_rendering_template.rb +8 -0
- data/lib/stripe/resources/issuing/authorization.rb +177 -0
- data/lib/stripe/resources/issuing/card.rb +96 -0
- data/lib/stripe/resources/issuing/cardholder.rb +110 -0
- data/lib/stripe/resources/issuing/credit_underwriting_record.rb +82 -0
- data/lib/stripe/resources/issuing/dispute.rb +97 -0
- data/lib/stripe/resources/issuing/dispute_settlement_detail.rb +16 -0
- data/lib/stripe/resources/issuing/fraud_liability_debit.rb +8 -0
- data/lib/stripe/resources/issuing/personalization_design.rb +36 -0
- data/lib/stripe/resources/issuing/physical_bundle.rb +16 -0
- data/lib/stripe/resources/issuing/settlement.rb +8 -0
- data/lib/stripe/resources/issuing/token.rb +61 -0
- data/lib/stripe/resources/issuing/transaction.rb +151 -0
- data/lib/stripe/resources/line_item.rb +54 -0
- data/lib/stripe/resources/login_link.rb +8 -0
- data/lib/stripe/resources/mandate.rb +242 -11
- data/lib/stripe/resources/margin.rb +8 -0
- data/lib/stripe/resources/order.rb +348 -0
- data/lib/stripe/resources/payment_attempt_record.rb +890 -11
- data/lib/stripe/resources/payment_intent.rb +1405 -3
- data/lib/stripe/resources/payment_intent_amount_details_line_item.rb +56 -0
- data/lib/stripe/resources/payment_link.rb +337 -0
- data/lib/stripe/resources/payment_method.rb +884 -38
- data/lib/stripe/resources/payment_method_configuration.rb +961 -0
- data/lib/stripe/resources/payment_method_domain.rb +111 -0
- data/lib/stripe/resources/payment_record.rb +890 -11
- data/lib/stripe/resources/payout.rb +16 -0
- data/lib/stripe/resources/person.rb +180 -0
- data/lib/stripe/resources/plan.rb +24 -0
- data/lib/stripe/resources/price.rb +79 -0
- data/lib/stripe/resources/privacy/redaction_job.rb +16 -0
- data/lib/stripe/resources/privacy/redaction_job_validation_error.rb +16 -0
- data/lib/stripe/resources/product.rb +27 -0
- data/lib/stripe/resources/product_feature.rb +8 -0
- data/lib/stripe/resources/promotion_code.rb +24 -0
- data/lib/stripe/resources/quote.rb +432 -0
- data/lib/stripe/resources/quote_line.rb +247 -0
- data/lib/stripe/resources/quote_preview_invoice.rb +450 -3
- data/lib/stripe/resources/quote_preview_subscription_schedule.rb +323 -0
- data/lib/stripe/resources/radar/early_fraud_warning.rb +8 -0
- data/lib/stripe/resources/radar/value_list.rb +8 -0
- data/lib/stripe/resources/radar/value_list_item.rb +8 -0
- data/lib/stripe/resources/refund.rb +380 -19
- data/lib/stripe/resources/reporting/report_run.rb +16 -0
- data/lib/stripe/resources/reporting/report_type.rb +8 -0
- data/lib/stripe/resources/reserve_transaction.rb +8 -0
- data/lib/stripe/resources/reversal.rb +8 -0
- data/lib/stripe/resources/review.rb +24 -0
- data/lib/stripe/resources/setup_attempt.rb +331 -20
- data/lib/stripe/resources/setup_intent.rb +293 -2
- data/lib/stripe/resources/shipping_rate.rb +48 -0
- data/lib/stripe/resources/sigma/scheduled_query_run.rb +16 -0
- data/lib/stripe/resources/source.rb +274 -0
- data/lib/stripe/resources/source_mandate_notification.rb +32 -0
- data/lib/stripe/resources/source_transaction.rb +54 -0
- data/lib/stripe/resources/subscription.rb +318 -3
- data/lib/stripe/resources/subscription_item.rb +24 -0
- data/lib/stripe/resources/subscription_schedule.rb +314 -0
- data/lib/stripe/resources/tax/association.rb +32 -0
- data/lib/stripe/resources/tax/calculation.rb +109 -0
- data/lib/stripe/resources/tax/calculation_line_item.rb +32 -0
- data/lib/stripe/resources/tax/form.rb +107 -0
- data/lib/stripe/resources/tax/registration.rb +1232 -0
- data/lib/stripe/resources/tax/settings.rb +61 -1
- data/lib/stripe/resources/tax/transaction.rb +93 -0
- data/lib/stripe/resources/tax/transaction_line_item.rb +16 -0
- data/lib/stripe/resources/tax_code.rb +8 -0
- data/lib/stripe/resources/tax_deducted_at_source.rb +8 -0
- data/lib/stripe/resources/tax_id.rb +24 -0
- data/lib/stripe/resources/tax_rate.rb +16 -0
- data/lib/stripe/resources/terminal/configuration.rb +299 -0
- data/lib/stripe/resources/terminal/connection_token.rb +8 -0
- data/lib/stripe/resources/terminal/location.rb +16 -0
- data/lib/stripe/resources/terminal/onboarding_link.rb +24 -0
- data/lib/stripe/resources/terminal/reader.rb +241 -0
- data/lib/stripe/resources/terminal/reader_collected_data.rb +16 -0
- data/lib/stripe/resources/test_helpers/test_clock.rb +24 -0
- data/lib/stripe/resources/token.rb +8 -0
- data/lib/stripe/resources/topup.rb +8 -0
- data/lib/stripe/resources/transfer.rb +8 -0
- data/lib/stripe/resources/treasury/credit_reversal.rb +16 -0
- data/lib/stripe/resources/treasury/debit_reversal.rb +24 -0
- data/lib/stripe/resources/treasury/financial_account.rb +61 -0
- data/lib/stripe/resources/treasury/financial_account_features.rb +192 -0
- data/lib/stripe/resources/treasury/inbound_transfer.rb +69 -0
- data/lib/stripe/resources/treasury/outbound_payment.rb +106 -0
- data/lib/stripe/resources/treasury/outbound_transfer.rb +114 -0
- data/lib/stripe/resources/treasury/received_credit.rb +97 -0
- data/lib/stripe/resources/treasury/received_debit.rb +89 -0
- data/lib/stripe/resources/treasury/transaction.rb +36 -0
- data/lib/stripe/resources/treasury/transaction_entry.rb +24 -0
- data/lib/stripe/resources/v2/billing/bill_setting.rb +40 -0
- data/lib/stripe/resources/v2/billing/bill_setting_version.rb +40 -0
- data/lib/stripe/resources/v2/billing/cadence.rb +141 -0
- data/lib/stripe/resources/v2/billing/collection_setting.rb +150 -2
- data/lib/stripe/resources/v2/billing/collection_setting_version.rb +150 -2
- data/lib/stripe/resources/v2/billing/custom_pricing_unit.rb +8 -0
- data/lib/stripe/resources/v2/billing/intent.rb +27 -0
- data/lib/stripe/resources/v2/billing/intent_action.rb +195 -0
- data/lib/stripe/resources/v2/billing/license_fee.rb +24 -0
- data/lib/stripe/resources/v2/billing/license_fee_subscription.rb +8 -0
- data/lib/stripe/resources/v2/billing/license_fee_version.rb +24 -0
- data/lib/stripe/resources/v2/billing/licensed_item.rb +16 -0
- data/lib/stripe/resources/v2/billing/meter_event.rb +8 -0
- data/lib/stripe/resources/v2/billing/meter_event_adjustment.rb +16 -0
- data/lib/stripe/resources/v2/billing/meter_event_session.rb +8 -0
- data/lib/stripe/resources/v2/billing/metered_item.rb +27 -0
- data/lib/stripe/resources/v2/billing/pricing_plan.rb +8 -0
- data/lib/stripe/resources/v2/billing/pricing_plan_component.rb +36 -0
- data/lib/stripe/resources/v2/billing/pricing_plan_subscription.rb +27 -0
- data/lib/stripe/resources/v2/billing/pricing_plan_version.rb +8 -0
- data/lib/stripe/resources/v2/billing/profile.rb +8 -0
- data/lib/stripe/resources/v2/billing/rate_card.rb +8 -0
- data/lib/stripe/resources/v2/billing/rate_card_rate.rb +36 -0
- data/lib/stripe/resources/v2/billing/rate_card_subscription.rb +27 -0
- data/lib/stripe/resources/v2/billing/rate_card_version.rb +8 -0
- data/lib/stripe/resources/v2/billing/service_action.rb +115 -0
- data/lib/stripe/resources/v2/core/account.rb +1900 -0
- data/lib/stripe/resources/v2/core/account_link.rb +51 -0
- data/lib/stripe/resources/v2/core/claimable_sandbox.rb +24 -0
- data/lib/stripe/resources/v2/core/person.rb +201 -0
- data/lib/stripe/resources/v2/core/vault/gb_bank_account.rb +40 -0
- data/lib/stripe/resources/v2/core/vault/us_bank_account.rb +8 -0
- data/lib/stripe/resources/v2/event.rb +24 -0
- data/lib/stripe/resources/v2/event_destination.rb +44 -0
- data/lib/stripe/resources/v2/financial_address_credit_simulation.rb +8 -0
- data/lib/stripe/resources/v2/financial_address_generated_microdeposits.rb +8 -0
- data/lib/stripe/resources/v2/money_management/adjustment.rb +16 -0
- data/lib/stripe/resources/v2/money_management/financial_account.rb +61 -0
- data/lib/stripe/resources/v2/money_management/financial_address.rb +32 -0
- data/lib/stripe/resources/v2/money_management/inbound_transfer.rb +90 -3
- data/lib/stripe/resources/v2/money_management/outbound_payment.rb +88 -0
- data/lib/stripe/resources/v2/money_management/outbound_payment_quote.rb +62 -0
- data/lib/stripe/resources/v2/money_management/outbound_setup_intent.rb +24 -0
- data/lib/stripe/resources/v2/money_management/outbound_transfer.rb +79 -0
- data/lib/stripe/resources/v2/money_management/payout_method.rb +32 -0
- data/lib/stripe/resources/v2/money_management/payout_methods_bank_account_spec.rb +32 -0
- data/lib/stripe/resources/v2/money_management/received_credit.rb +77 -0
- data/lib/stripe/resources/v2/money_management/received_debit.rb +52 -0
- data/lib/stripe/resources/v2/money_management/transaction.rb +36 -0
- data/lib/stripe/resources/v2/money_management/transaction_entry.rb +35 -0
- data/lib/stripe/resources/v2/payments/off_session_payment.rb +24 -0
- data/lib/stripe/resources/v2/reporting/report.rb +52 -0
- data/lib/stripe/resources/v2/reporting/report_run.rb +69 -0
- data/lib/stripe/resources/v2/tax/automatic_rule.rb +8 -0
- data/lib/stripe/resources/webhook_endpoint.rb +8 -0
- data/lib/stripe/stripe_object.rb +25 -1
- data/lib/stripe/util.rb +9 -5
- data/lib/stripe/version.rb +1 -1
- data/rbi/stripe.rbi +280174 -0
- metadata +3 -2
@@ -16,16 +16,40 @@ module Stripe
|
|
16
16
|
class EnumDetails < Stripe::StripeObject
|
17
17
|
# Allowed values of the enum.
|
18
18
|
attr_reader :allowed_values
|
19
|
+
|
20
|
+
def self.inner_class_types
|
21
|
+
@inner_class_types = {}
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.field_remappings
|
25
|
+
@field_remappings = {}
|
26
|
+
end
|
19
27
|
end
|
20
28
|
# Data type of the elements in the array.
|
21
29
|
attr_reader :element_type
|
22
30
|
# Details about enum elements in the array.
|
23
31
|
attr_reader :enum_details
|
32
|
+
|
33
|
+
def self.inner_class_types
|
34
|
+
@inner_class_types = { enum_details: EnumDetails }
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.field_remappings
|
38
|
+
@field_remappings = {}
|
39
|
+
end
|
24
40
|
end
|
25
41
|
|
26
42
|
class EnumDetails < Stripe::StripeObject
|
27
43
|
# Allowed values of the enum.
|
28
44
|
attr_reader :allowed_values
|
45
|
+
|
46
|
+
def self.inner_class_types
|
47
|
+
@inner_class_types = {}
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.field_remappings
|
51
|
+
@field_remappings = {}
|
52
|
+
end
|
29
53
|
end
|
30
54
|
|
31
55
|
class TimestampDetails < Stripe::StripeObject
|
@@ -33,6 +57,14 @@ module Stripe
|
|
33
57
|
attr_reader :max
|
34
58
|
# Minimum permitted timestamp which can be requested.
|
35
59
|
attr_reader :min
|
60
|
+
|
61
|
+
def self.inner_class_types
|
62
|
+
@inner_class_types = {}
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.field_remappings
|
66
|
+
@field_remappings = {}
|
67
|
+
end
|
36
68
|
end
|
37
69
|
# For array parameters, provides details about the array elements.
|
38
70
|
attr_reader :array_details
|
@@ -46,6 +78,18 @@ module Stripe
|
|
46
78
|
attr_reader :timestamp_details
|
47
79
|
# The data type of the parameter.
|
48
80
|
attr_reader :type
|
81
|
+
|
82
|
+
def self.inner_class_types
|
83
|
+
@inner_class_types = {
|
84
|
+
array_details: ArrayDetails,
|
85
|
+
enum_details: EnumDetails,
|
86
|
+
timestamp_details: TimestampDetails,
|
87
|
+
}
|
88
|
+
end
|
89
|
+
|
90
|
+
def self.field_remappings
|
91
|
+
@field_remappings = {}
|
92
|
+
end
|
49
93
|
end
|
50
94
|
# The unique identifier of the `Report` object.
|
51
95
|
attr_reader :id
|
@@ -58,6 +102,14 @@ module Stripe
|
|
58
102
|
attr_reader :parameters
|
59
103
|
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
|
60
104
|
attr_reader :livemode
|
105
|
+
|
106
|
+
def self.inner_class_types
|
107
|
+
@inner_class_types = { parameters: Parameters }
|
108
|
+
end
|
109
|
+
|
110
|
+
def self.field_remappings
|
111
|
+
@field_remappings = {}
|
112
|
+
end
|
61
113
|
end
|
62
114
|
end
|
63
115
|
end
|
@@ -17,6 +17,14 @@ module Stripe
|
|
17
17
|
class ArrayValue < Stripe::StripeObject
|
18
18
|
# The list of string values in the array.
|
19
19
|
attr_reader :items
|
20
|
+
|
21
|
+
def self.inner_class_types
|
22
|
+
@inner_class_types = {}
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.field_remappings
|
26
|
+
@field_remappings = {}
|
27
|
+
end
|
20
28
|
end
|
21
29
|
# Parameter with an array data type.
|
22
30
|
attr_reader :array_value
|
@@ -24,6 +32,14 @@ module Stripe
|
|
24
32
|
attr_reader :string_value
|
25
33
|
# Parameter with a timestamp data type.
|
26
34
|
attr_reader :timestamp_value
|
35
|
+
|
36
|
+
def self.inner_class_types
|
37
|
+
@inner_class_types = { array_value: ArrayValue }
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.field_remappings
|
41
|
+
@field_remappings = {}
|
42
|
+
end
|
27
43
|
end
|
28
44
|
|
29
45
|
class Result < Stripe::StripeObject
|
@@ -33,6 +49,14 @@ module Stripe
|
|
33
49
|
attr_reader :expires_at
|
34
50
|
# The URL that can be used for accessing the file.
|
35
51
|
attr_reader :url
|
52
|
+
|
53
|
+
def self.inner_class_types
|
54
|
+
@inner_class_types = {}
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.field_remappings
|
58
|
+
@field_remappings = {}
|
59
|
+
end
|
36
60
|
end
|
37
61
|
# The content type of the file.
|
38
62
|
attr_reader :content_type
|
@@ -40,18 +64,42 @@ module Stripe
|
|
40
64
|
attr_reader :download_url
|
41
65
|
# The total size of the file in bytes.
|
42
66
|
attr_reader :size
|
67
|
+
|
68
|
+
def self.inner_class_types
|
69
|
+
@inner_class_types = { download_url: DownloadUrl }
|
70
|
+
end
|
71
|
+
|
72
|
+
def self.field_remappings
|
73
|
+
@field_remappings = {}
|
74
|
+
end
|
43
75
|
end
|
44
76
|
# Contains metadata about the file produced by the `ReportRun`, including
|
45
77
|
# its content type, size, and a URL to download its contents.
|
46
78
|
attr_reader :file
|
47
79
|
# The type of the `ReportRun` result.
|
48
80
|
attr_reader :type
|
81
|
+
|
82
|
+
def self.inner_class_types
|
83
|
+
@inner_class_types = { file: File }
|
84
|
+
end
|
85
|
+
|
86
|
+
def self.field_remappings
|
87
|
+
@field_remappings = {}
|
88
|
+
end
|
49
89
|
end
|
50
90
|
|
51
91
|
class ResultOptions < Stripe::StripeObject
|
52
92
|
# If set, the generated report file will be compressed into a ZIP folder.
|
53
93
|
# This is useful for reducing file size and download time for large reports.
|
54
94
|
attr_reader :compress_file
|
95
|
+
|
96
|
+
def self.inner_class_types
|
97
|
+
@inner_class_types = {}
|
98
|
+
end
|
99
|
+
|
100
|
+
def self.field_remappings
|
101
|
+
@field_remappings = {}
|
102
|
+
end
|
55
103
|
end
|
56
104
|
|
57
105
|
class StatusDetails < Stripe::StripeObject
|
@@ -59,6 +107,14 @@ module Stripe
|
|
59
107
|
attr_reader :error_code
|
60
108
|
# Error message with additional details about the failure.
|
61
109
|
attr_reader :error_message
|
110
|
+
|
111
|
+
def self.inner_class_types
|
112
|
+
@inner_class_types = {}
|
113
|
+
end
|
114
|
+
|
115
|
+
def self.field_remappings
|
116
|
+
@field_remappings = {}
|
117
|
+
end
|
62
118
|
end
|
63
119
|
# Time at which the object was created.
|
64
120
|
attr_reader :created
|
@@ -83,6 +139,19 @@ module Stripe
|
|
83
139
|
attr_reader :status_details
|
84
140
|
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
|
85
141
|
attr_reader :livemode
|
142
|
+
|
143
|
+
def self.inner_class_types
|
144
|
+
@inner_class_types = {
|
145
|
+
report_parameters: ReportParameters,
|
146
|
+
result: Result,
|
147
|
+
result_options: ResultOptions,
|
148
|
+
status_details: StatusDetails,
|
149
|
+
}
|
150
|
+
end
|
151
|
+
|
152
|
+
def self.field_remappings
|
153
|
+
@field_remappings = {}
|
154
|
+
end
|
86
155
|
end
|
87
156
|
end
|
88
157
|
end
|
@@ -25,6 +25,14 @@ module Stripe
|
|
25
25
|
attr_reader :tax_code
|
26
26
|
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
|
27
27
|
attr_reader :livemode
|
28
|
+
|
29
|
+
def self.inner_class_types
|
30
|
+
@inner_class_types = {}
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.field_remappings
|
34
|
+
@field_remappings = {}
|
35
|
+
end
|
28
36
|
end
|
29
37
|
end
|
30
38
|
end
|
data/lib/stripe/stripe_object.rb
CHANGED
@@ -154,12 +154,22 @@ module Stripe
|
|
154
154
|
def update_attributes(values, opts = {}, dirty: true)
|
155
155
|
values.each do |k, v|
|
156
156
|
add_accessors([k], values) unless metaclass.method_defined?(k.to_sym)
|
157
|
-
@values[k] =
|
157
|
+
@values[k] = convert_value_with_inner_types(k, v, opts)
|
158
158
|
dirty_value!(@values[k]) if dirty
|
159
159
|
@unsaved_values.add(k)
|
160
160
|
end
|
161
161
|
end
|
162
162
|
|
163
|
+
private def convert_value_with_inner_types(key, value, opts)
|
164
|
+
inner_class = _get_inner_class_type(key)
|
165
|
+
|
166
|
+
if inner_class
|
167
|
+
Util.convert_to_stripe_object(value, opts, api_mode: @api_mode, requestor: @requestor, klass: inner_class)
|
168
|
+
else
|
169
|
+
Util.convert_to_stripe_object(value, opts, api_mode: @api_mode, requestor: @requestor)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
163
173
|
def [](key)
|
164
174
|
@values[key.to_sym]
|
165
175
|
end
|
@@ -620,5 +630,19 @@ module Stripe
|
|
620
630
|
update[k] = ""
|
621
631
|
end
|
622
632
|
end
|
633
|
+
|
634
|
+
# Instance methods to get inner class types
|
635
|
+
def _get_inner_class_type(field_name)
|
636
|
+
self.class.inner_class_types[field_name.to_sym]
|
637
|
+
end
|
638
|
+
|
639
|
+
# Class methods for inner class types, similar to Python's implementation
|
640
|
+
def self.inner_class_types
|
641
|
+
@inner_class_types ||= {}
|
642
|
+
end
|
643
|
+
|
644
|
+
def self.field_remappings
|
645
|
+
@field_remappings ||= {}
|
646
|
+
end
|
623
647
|
end
|
624
648
|
end
|
data/lib/stripe/util.rb
CHANGED
@@ -99,8 +99,8 @@ module Stripe
|
|
99
99
|
# will be reused on subsequent API calls.
|
100
100
|
# * +opts+ - Options for +StripeObject+ like an API key that will be reused
|
101
101
|
# on subsequent API calls.
|
102
|
-
def self.convert_to_stripe_object(data, opts = {}, api_mode: :v1, requestor: nil)
|
103
|
-
convert_to_stripe_object_with_params(data, {}, opts, api_mode: api_mode, requestor: requestor)
|
102
|
+
def self.convert_to_stripe_object(data, opts = {}, api_mode: :v1, requestor: nil, klass: nil)
|
103
|
+
convert_to_stripe_object_with_params(data, {}, opts, api_mode: api_mode, requestor: requestor, klass: klass)
|
104
104
|
end
|
105
105
|
|
106
106
|
# Converts a hash of fields or an array of hashes into a +StripeObject+ or
|
@@ -124,13 +124,14 @@ module Stripe
|
|
124
124
|
opts = {},
|
125
125
|
last_response = nil,
|
126
126
|
api_mode: :v1,
|
127
|
-
requestor: nil
|
127
|
+
requestor: nil,
|
128
|
+
klass: nil
|
128
129
|
)
|
129
130
|
opts = normalize_opts(opts)
|
130
131
|
|
131
132
|
case data
|
132
133
|
when Array
|
133
|
-
data.map { |i| convert_to_stripe_object(i, opts, api_mode: api_mode, requestor: requestor) }
|
134
|
+
data.map { |i| convert_to_stripe_object(i, opts, api_mode: api_mode, requestor: requestor, klass: klass) }
|
134
135
|
when Hash
|
135
136
|
# TODO: This is a terrible hack.
|
136
137
|
# Waiting on https://jira.corp.stripe.com/browse/API_SERVICES-3167 to add
|
@@ -143,7 +144,10 @@ module Stripe
|
|
143
144
|
# to generic StripeObject
|
144
145
|
object_type = data[:type] || data["type"]
|
145
146
|
object_name = data[:object] || data["object"]
|
146
|
-
object_class = if
|
147
|
+
object_class = if klass
|
148
|
+
# Use the provided class for inner types
|
149
|
+
klass
|
150
|
+
elsif api_mode == :v2
|
147
151
|
if object_name == "v2.core.event" && thin_event_classes.key?(object_type)
|
148
152
|
thin_event_classes.fetch(object_type)
|
149
153
|
else
|
data/lib/stripe/version.rb
CHANGED