Class: Io::Flow::V0::Models::ShopifyCartAddForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ShopifyCartAddForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Direct Known Subclasses
ShopifyCartAddFormUndefinedType, ShopifyCartAddMultipleForm, ShopifyCartAddSingleForm
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 = {}) ⇒ ShopifyCartAddForm
constructor
A new instance of ShopifyCartAddForm.
- #subtype_to_hash ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ShopifyCartAddForm
Returns a new instance of ShopifyCartAddForm.
15627 15628 15629 15630 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15627 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) @discriminator = HttpClient::Preconditions.assert_class('discriminator', opts.delete(:discriminator) || 'shopify_cart_add_single_form', String) end |
Instance Attribute Details
#discriminator ⇒ Object (readonly)
Returns the value of attribute discriminator.
15625 15626 15627 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15625 def discriminator @discriminator end |
Class Method Details
.from_json(hash) ⇒ Object
15640 15641 15642 15643 15644 15645 15646 15647 15648 15649 15650 15651 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15640 def ShopifyCartAddForm.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[shopify_cart_add_form] requires a field named 'discriminator'" end case discriminator when Types::SHOPIFY_CART_ADD_SINGLE_FORM; ShopifyCartAddSingleForm.new(hash) when Types::SHOPIFY_CART_ADD_MULTIPLE_FORM; ShopifyCartAddMultipleForm.new(hash) else ShopifyCartAddFormUndefinedType.new(:discriminator => discriminator) end end |
Instance Method Details
#subtype_to_hash ⇒ Object
15632 15633 15634 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15632 def subtype_to_hash raise 'Cannot serialize an instance of shopify_cart_add_form directly - must use one of the specific types: shopify_cart_add_single_form, shopify_cart_add_multiple_form' end |
#to_hash ⇒ Object
15636 15637 15638 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15636 def to_hash subtype_to_hash.merge(:discriminator => @discriminator) end |