Class: Io::Flow::V0::Models::PaymentCaptureOption
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::PaymentCaptureOption
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Direct Known Subclasses
PaymentCaptureOptionAutomaticImmediate, PaymentCaptureOptionManual, PaymentCaptureOptionUndefinedType
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 = {}) ⇒ PaymentCaptureOption
constructor
A new instance of PaymentCaptureOption.
- #subtype_to_hash ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ PaymentCaptureOption
Returns a new instance of PaymentCaptureOption.
13563 13564 13565 13566 13567 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13563 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:type], 'PaymentCaptureOption') @type = HttpClient::Preconditions.assert_class('type', opts.delete(:type), String) end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
13561 13562 13563 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13561 def type @type end |
Class Method Details
.from_json(hash) ⇒ Object
13577 13578 13579 13580 13581 13582 13583 13584 13585 13586 13587 13588 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13577 def PaymentCaptureOption.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_capture_option] requires a field named 'type'" end case discriminator when Types::PAYMENT_CAPTURE_OPTION_AUTOMATIC_IMMEDIATE; PaymentCaptureOptionAutomaticImmediate.new(hash) when Types::PAYMENT_CAPTURE_OPTION_MANUAL; PaymentCaptureOptionManual.new(hash) else PaymentCaptureOptionUndefinedType.new(:type => discriminator) end end |
Instance Method Details
#subtype_to_hash ⇒ Object
13569 13570 13571 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13569 def subtype_to_hash raise 'Cannot serialize an instance of payment_capture_option directly - must use one of the specific types: payment_capture_option_automatic_immediate, payment_capture_option_manual' end |
#to_hash ⇒ Object
13573 13574 13575 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13573 def to_hash subtype_to_hash.merge(:type => @type) end |