Class: Io::Flow::V0::Models::PaymentMethodData
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::PaymentMethodData
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Direct Known Subclasses
PaymentMethodDataAuthorizeApplepay, PaymentMethodDataAuthorizeCard, PaymentMethodDataAuthorizeGooglepay, PaymentMethodDataAuthorizePaypal, PaymentMethodDataCompleteAuthorizationCard, PaymentMethodDataInitAfterpay, PaymentMethodDataInitApplepay, PaymentMethodDataInitGooglepay, PaymentMethodDataInitIdeal, PaymentMethodDataInitKlarna, PaymentMethodDataInitPaypal, PaymentMethodDataUndefinedType, PaymentMethodDataValidateApplepay
Defined Under Namespace
Modules: Types
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(incoming = {}) ⇒ PaymentMethodData
constructor
A new instance of PaymentMethodData.
- #subtype_to_hash ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ PaymentMethodData
Returns a new instance of PaymentMethodData.
12453 12454 12455 12456 12457 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12453 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 |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
12451 12452 12453 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12451 def type @type end |
Class Method Details
.from_json(hash) ⇒ Object
12467 12468 12469 12470 12471 12472 12473 12474 12475 12476 12477 12478 12479 12480 12481 12482 12483 12484 12485 12486 12487 12488 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12467 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_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_COMPLETE_AUTHORIZATION_CARD; PaymentMethodDataCompleteAuthorizationCard.new(hash) else PaymentMethodDataUndefinedType.new(:type => discriminator) end end |
Instance Method Details
#subtype_to_hash ⇒ Object
12459 12460 12461 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12459 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_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_complete_authorization_card' end |
#to_hash ⇒ Object
12463 12464 12465 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12463 def to_hash subtype_to_hash.merge(:type => @type) end |