Class: Io::Flow::V0::Models::PaymentSourceForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::PaymentSourceForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Direct Known Subclasses
Defined Under Namespace
Modules: Types
Instance Attribute Summary collapse
-
#discriminator ⇒ Object
readonly
Returns the value of attribute discriminator.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(incoming = {}) ⇒ PaymentSourceForm
constructor
A new instance of PaymentSourceForm.
- #subtype_to_hash ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ PaymentSourceForm
Returns a new instance of PaymentSourceForm.
14346 14347 14348 14349 14350 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14346 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:discriminator], 'PaymentSourceForm') @discriminator = HttpClient::Preconditions.assert_class('discriminator', opts.delete(:discriminator), String) end |
Instance Attribute Details
#discriminator ⇒ Object (readonly)
Returns the value of attribute discriminator.
14344 14345 14346 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14344 def discriminator @discriminator end |
Class Method Details
.from_json(hash) ⇒ Object
14360 14361 14362 14363 14364 14365 14366 14367 14368 14369 14370 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14360 def PaymentSourceForm.from_json(hash) HttpClient::Preconditions.assert_class('hash', hash, Hash) discriminator = HttpClient::Helper.symbolize_keys(hash)[:discriminator].to_s.strip if discriminator.empty? raise "Union type[payment_source_form] requires a field named 'discriminator'" end case discriminator when Types::CARD_PAYMENT_SOURCE_FORM; CardPaymentSourceForm.new(hash) else PaymentSourceFormUndefinedType.new(:discriminator => discriminator) end end |
Instance Method Details
#subtype_to_hash ⇒ Object
14352 14353 14354 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14352 def subtype_to_hash raise 'Cannot serialize an instance of payment_source_form directly - must use one of the specific types: card_payment_source_form' end |
#to_hash ⇒ Object
14356 14357 14358 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14356 def to_hash subtype_to_hash.merge(:discriminator => @discriminator) end |