class Io::Flow::V0::Models::PaymentMethodData
Attributes
type[R]
Public Class Methods
from_json(hash)
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 13776 def PaymentMethodData.from_json(hash) HttpClient::Preconditions.assert_class('hash', hash, Hash) discriminator = HttpClient::Helper.symbolize_keys(hash)[:type].to_s.strip if discriminator.empty? raise "Union type[payment_method_data] requires a field named 'type'" end case discriminator when Types::PAYMENT_METHOD_DATA_INIT_KLARNA; PaymentMethodDataInitKlarna.new(hash) when Types::PAYMENT_METHOD_DATA_INIT_AFTERPAY; PaymentMethodDataInitAfterpay.new(hash) when Types::PAYMENT_METHOD_DATA_INIT_APPLEPAY; PaymentMethodDataInitApplepay.new(hash) when Types::PAYMENT_METHOD_DATA_INIT_GOOGLEPAY; PaymentMethodDataInitGooglepay.new(hash) when Types::PAYMENT_METHOD_DATA_INIT_PAYPAL; PaymentMethodDataInitPaypal.new(hash) when Types::PAYMENT_METHOD_DATA_INIT_IDEAL; PaymentMethodDataInitIdeal.new(hash) when Types::PAYMENT_METHOD_DATA_INIT_SOFORT; PaymentMethodDataInitSofort.new(hash) when Types::PAYMENT_METHOD_DATA_INIT_BANCONTACT; PaymentMethodDataInitBancontact.new(hash) when Types::PAYMENT_METHOD_DATA_VALIDATE_APPLEPAY; PaymentMethodDataValidateApplepay.new(hash) when Types::PAYMENT_METHOD_DATA_AUTHORIZE_CARD; PaymentMethodDataAuthorizeCard.new(hash) when Types::PAYMENT_METHOD_DATA_AUTHORIZE_GOOGLEPAY; PaymentMethodDataAuthorizeGooglepay.new(hash) when Types::PAYMENT_METHOD_DATA_AUTHORIZE_APPLEPAY; PaymentMethodDataAuthorizeApplepay.new(hash) when Types::PAYMENT_METHOD_DATA_AUTHORIZE_PAYPAL; PaymentMethodDataAuthorizePaypal.new(hash) when Types::PAYMENT_METHOD_DATA_AUTHORIZE_KLARNA; PaymentMethodDataAuthorizeKlarna.new(hash) when Types::PAYMENT_METHOD_DATA_SELECTED_PAYMENT_OPTION; PaymentMethodDataSelectedPaymentOption.new(hash) when Types::PAYMENT_METHOD_DATA_COMPLETE_AUTHORIZATION_CARD; PaymentMethodDataCompleteAuthorizationCard.new(hash) else PaymentMethodDataUndefinedType.new(:type => discriminator) end end
new(incoming={})
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 13762 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:type], 'PaymentMethodData') @type = HttpClient::Preconditions.assert_class('type', opts.delete(:type), String) end
Public Instance Methods
subtype_to_hash()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 13768 def subtype_to_hash raise 'Cannot serialize an instance of payment_method_data directly - must use one of the specific types: payment_method_data_init_klarna, payment_method_data_init_afterpay, payment_method_data_init_applepay, payment_method_data_init_googlepay, payment_method_data_init_paypal, payment_method_data_init_ideal, payment_method_data_init_sofort, payment_method_data_init_bancontact, payment_method_data_validate_applepay, payment_method_data_authorize_card, payment_method_data_authorize_googlepay, payment_method_data_authorize_applepay, payment_method_data_authorize_paypal, payment_method_data_authorize_klarna, payment_method_data_selected_payment_option, payment_method_data_complete_authorization_card' end
to_hash()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 13772 def to_hash subtype_to_hash.merge(:type => @type) end