Class: Io::Flow::V0::Models::PaymentForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::PaymentForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Represents the data needed to initiate an online payment
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 = {}) ⇒ PaymentForm
constructor
A new instance of PaymentForm.
- #subtype_to_hash ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ PaymentForm
Returns a new instance of PaymentForm.
7248 7249 7250 7251 7252 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7248 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:discriminator], 'PaymentForm') @discriminator = HttpClient::Preconditions.assert_class('discriminator', opts.delete(:discriminator), String) end |
Instance Attribute Details
#discriminator ⇒ Object (readonly)
Returns the value of attribute discriminator.
7246 7247 7248 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7246 def discriminator @discriminator end |
Class Method Details
.from_json(hash) ⇒ Object
7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7262 def PaymentForm.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_form] requires a field named 'discriminator'" end case discriminator when Types::MERCHANT_OF_RECORD_PAYMENT_FORM; MerchantOfRecordPaymentForm.new(hash) else PaymentFormUndefinedType.new(:discriminator => discriminator) end end |
Instance Method Details
#subtype_to_hash ⇒ Object
7254 7255 7256 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7254 def subtype_to_hash raise 'Cannot serialize an instance of payment_form directly - must use one of the specific types: merchant_of_record_payment_form' end |
#to_hash ⇒ Object
7258 7259 7260 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7258 def to_hash subtype_to_hash.merge(:discriminator => @discriminator) end |