Class: Io::Flow::V0::Models::PaymentMethodStoredDetailsCard
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::PaymentMethodStoredDetailsCard
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Direct Known Subclasses
PaymentMethodStoredDetailsCardInitial, PaymentMethodStoredDetailsCardSubsequent, PaymentMethodStoredDetailsCardUndefinedType
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 = {}) ⇒ PaymentMethodStoredDetailsCard
constructor
A new instance of PaymentMethodStoredDetailsCard.
- #subtype_to_hash ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ PaymentMethodStoredDetailsCard
Returns a new instance of PaymentMethodStoredDetailsCard.
14022 14023 14024 14025 14026 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14022 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:type], 'PaymentMethodStoredDetailsCard') @type = HttpClient::Preconditions.assert_class('type', opts.delete(:type), String) end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
14020 14021 14022 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14020 def type @type end |
Class Method Details
.from_json(hash) ⇒ Object
14036 14037 14038 14039 14040 14041 14042 14043 14044 14045 14046 14047 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14036 def PaymentMethodStoredDetailsCard.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_stored_details_card] requires a field named 'type'" end case discriminator when Types::PAYMENT_METHOD_STORED_DETAILS_CARD_INITIAL; PaymentMethodStoredDetailsCardInitial.new(hash) when Types::PAYMENT_METHOD_STORED_DETAILS_CARD_SUBSEQUENT; PaymentMethodStoredDetailsCardSubsequent.new(hash) else PaymentMethodStoredDetailsCardUndefinedType.new(:type => discriminator) end end |
Instance Method Details
#subtype_to_hash ⇒ Object
14028 14029 14030 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14028 def subtype_to_hash raise 'Cannot serialize an instance of payment_method_stored_details_card directly - must use one of the specific types: payment_method_stored_details_card_initial, payment_method_stored_details_card_subsequent' end |
#to_hash ⇒ Object
14032 14033 14034 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14032 def to_hash subtype_to_hash.merge(:type => @type) end |