Class: Io::Flow::V0::Models::PaymentMethodCard
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::PaymentMethodCard
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Direct Known Subclasses
PaymentMethodCardPciDetails, PaymentMethodCardToken, PaymentMethodCardUndefinedType
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 = {}) ⇒ PaymentMethodCard
constructor
A new instance of PaymentMethodCard.
- #subtype_to_hash ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ PaymentMethodCard
Returns a new instance of PaymentMethodCard.
13686 13687 13688 13689 13690 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13686 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:type], 'PaymentMethodCard') @type = HttpClient::Preconditions.assert_class('type', opts.delete(:type), String) end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
13684 13685 13686 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13684 def type @type end |
Class Method Details
.from_json(hash) ⇒ Object
13700 13701 13702 13703 13704 13705 13706 13707 13708 13709 13710 13711 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13700 def PaymentMethodCard.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_card] requires a field named 'type'" end case discriminator when Types::PAYMENT_METHOD_CARD_PCI_DETAILS; PaymentMethodCardPciDetails.new(hash) when Types::PAYMENT_METHOD_CARD_TOKEN; PaymentMethodCardToken.new(hash) else PaymentMethodCardUndefinedType.new(:type => discriminator) end end |
Instance Method Details
#subtype_to_hash ⇒ Object
13692 13693 13694 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13692 def subtype_to_hash raise 'Cannot serialize an instance of payment_method_card directly - must use one of the specific types: payment_method_card_pci_details, payment_method_card_token' end |
#to_hash ⇒ Object
13696 13697 13698 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13696 def to_hash subtype_to_hash.merge(:type => @type) end |