Class: Io::Flow::V0::Models::PaymentMethodSummary
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::PaymentMethodSummary
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Direct Known Subclasses
PaymentMethodSummaryAfterpay, PaymentMethodSummaryApplepay, PaymentMethodSummaryBancontact, PaymentMethodSummaryCard, PaymentMethodSummaryGooglepay, PaymentMethodSummaryIdeal, PaymentMethodSummaryKlarna, PaymentMethodSummaryPaypal, PaymentMethodSummarySofort, PaymentMethodSummaryUndefinedType
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 = {}) ⇒ PaymentMethodSummary
constructor
A new instance of PaymentMethodSummary.
- #subtype_to_hash ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ PaymentMethodSummary
Returns a new instance of PaymentMethodSummary.
14091 14092 14093 14094 14095 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14091 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:type], 'PaymentMethodSummary') @type = HttpClient::Preconditions.assert_class('type', opts.delete(:type), String) end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
14089 14090 14091 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14089 def type @type end |
Class Method Details
.from_json(hash) ⇒ Object
14105 14106 14107 14108 14109 14110 14111 14112 14113 14114 14115 14116 14117 14118 14119 14120 14121 14122 14123 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14105 def PaymentMethodSummary.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_summary] requires a field named 'type'" end case discriminator when Types::PAYMENT_METHOD_SUMMARY_CARD; PaymentMethodSummaryCard.new(hash) when Types::PAYMENT_METHOD_SUMMARY_KLARNA; PaymentMethodSummaryKlarna.new(hash) when Types::PAYMENT_METHOD_SUMMARY_AFTERPAY; PaymentMethodSummaryAfterpay.new(hash) when Types::PAYMENT_METHOD_SUMMARY_APPLEPAY; PaymentMethodSummaryApplepay.new(hash) when Types::PAYMENT_METHOD_SUMMARY_GOOGLEPAY; PaymentMethodSummaryGooglepay.new(hash) when Types::PAYMENT_METHOD_SUMMARY_PAYPAL; PaymentMethodSummaryPaypal.new(hash) when Types::PAYMENT_METHOD_SUMMARY_IDEAL; PaymentMethodSummaryIdeal.new(hash) when Types::PAYMENT_METHOD_SUMMARY_SOFORT; PaymentMethodSummarySofort.new(hash) when Types::PAYMENT_METHOD_SUMMARY_BANCONTACT; PaymentMethodSummaryBancontact.new(hash) else PaymentMethodSummaryUndefinedType.new(:type => discriminator) end end |
Instance Method Details
#subtype_to_hash ⇒ Object
14097 14098 14099 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14097 def subtype_to_hash raise 'Cannot serialize an instance of payment_method_summary directly - must use one of the specific types: payment_method_summary_card, payment_method_summary_klarna, payment_method_summary_afterpay, payment_method_summary_applepay, payment_method_summary_googlepay, payment_method_summary_paypal, payment_method_summary_ideal, payment_method_summary_sofort, payment_method_summary_bancontact' end |
#to_hash ⇒ Object
14101 14102 14103 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14101 def to_hash subtype_to_hash.merge(:type => @type) end |