Class: Io::Flow::V0::Models::CheckoutTokenForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::CheckoutTokenForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Direct Known Subclasses
CheckoutTokenFormUndefinedType, CheckoutTokenOrderForm, CheckoutTokenReferenceForm
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 = {}) ⇒ CheckoutTokenForm
constructor
A new instance of CheckoutTokenForm.
- #subtype_to_hash ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ CheckoutTokenForm
Returns a new instance of CheckoutTokenForm.
10233 10234 10235 10236 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10233 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) @discriminator = HttpClient::Preconditions.assert_class('discriminator', opts.delete(:discriminator) || 'checkout_token_reference_form', String) end |
Instance Attribute Details
#discriminator ⇒ Object (readonly)
Returns the value of attribute discriminator.
10231 10232 10233 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10231 def discriminator @discriminator end |
Class Method Details
.from_json(hash) ⇒ Object
10246 10247 10248 10249 10250 10251 10252 10253 10254 10255 10256 10257 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10246 def CheckoutTokenForm.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[checkout_token_form] requires a field named 'discriminator'" end case discriminator when Types::CHECKOUT_TOKEN_ORDER_FORM; CheckoutTokenOrderForm.new(hash) when Types::CHECKOUT_TOKEN_REFERENCE_FORM; CheckoutTokenReferenceForm.new(hash) else CheckoutTokenFormUndefinedType.new(:discriminator => discriminator) end end |
Instance Method Details
#subtype_to_hash ⇒ Object
10238 10239 10240 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10238 def subtype_to_hash raise 'Cannot serialize an instance of checkout_token_form directly - must use one of the specific types: checkout_token_order_form, checkout_token_reference_form' end |
#to_hash ⇒ Object
10242 10243 10244 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10242 def to_hash subtype_to_hash.merge(:discriminator => @discriminator) end |