Class: Io::Flow::V0::Models::MerchantApplication
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::MerchantApplication
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Direct Known Subclasses
MerchantApplicationUndefinedType, ShopifyMerchantApplication
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 = {}) ⇒ MerchantApplication
constructor
A new instance of MerchantApplication.
- #subtype_to_hash ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ MerchantApplication
Returns a new instance of MerchantApplication.
12680 12681 12682 12683 12684 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12680 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:discriminator], 'MerchantApplication') @discriminator = HttpClient::Preconditions.assert_class('discriminator', opts.delete(:discriminator), String) end |
Instance Attribute Details
#discriminator ⇒ Object (readonly)
Returns the value of attribute discriminator.
12678 12679 12680 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12678 def discriminator @discriminator end |
Class Method Details
.from_json(hash) ⇒ Object
12694 12695 12696 12697 12698 12699 12700 12701 12702 12703 12704 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12694 def MerchantApplication.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[merchant_application] requires a field named 'discriminator'" end case discriminator when Types::SHOPIFY_MERCHANT_APPLICATION; ShopifyMerchantApplication.new(hash) else MerchantApplicationUndefinedType.new(:discriminator => discriminator) end end |
Instance Method Details
#subtype_to_hash ⇒ Object
12686 12687 12688 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12686 def subtype_to_hash raise 'Cannot serialize an instance of merchant_application directly - must use one of the specific types: shopify_merchant_application' end |
#to_hash ⇒ Object
12690 12691 12692 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12690 def to_hash subtype_to_hash.merge(:discriminator => @discriminator) end |