Class: Io::Flow::V0::Models::OrderNumberGenerator
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::OrderNumberGenerator
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Direct Known Subclasses
OrderNumberGeneratorHexadecimal, OrderNumberGeneratorPrefixSuffix, OrderNumberGeneratorUndefinedType, OrderNumberGeneratorUuid
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 = {}) ⇒ OrderNumberGenerator
constructor
A new instance of OrderNumberGenerator.
- #subtype_to_hash ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ OrderNumberGenerator
Returns a new instance of OrderNumberGenerator.
13121 13122 13123 13124 13125 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13121 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:discriminator], 'OrderNumberGenerator') @discriminator = HttpClient::Preconditions.assert_class('discriminator', opts.delete(:discriminator), String) end |
Instance Attribute Details
#discriminator ⇒ Object (readonly)
Returns the value of attribute discriminator.
13119 13120 13121 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13119 def discriminator @discriminator end |
Class Method Details
.from_json(hash) ⇒ Object
13135 13136 13137 13138 13139 13140 13141 13142 13143 13144 13145 13146 13147 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13135 def OrderNumberGenerator.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[order_number_generator] requires a field named 'discriminator'" end case discriminator when Types::ORDER_NUMBER_GENERATOR_UUID; OrderNumberGeneratorUuid.new(hash) when Types::ORDER_NUMBER_GENERATOR_HEXADECIMAL; OrderNumberGeneratorHexadecimal.new(hash) when Types::ORDER_NUMBER_GENERATOR_PREFIX_SUFFIX; OrderNumberGeneratorPrefixSuffix.new(hash) else OrderNumberGeneratorUndefinedType.new(:discriminator => discriminator) end end |
Instance Method Details
#subtype_to_hash ⇒ Object
13127 13128 13129 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13127 def subtype_to_hash raise 'Cannot serialize an instance of order_number_generator directly - must use one of the specific types: order_number_generator_uuid, order_number_generator_hexadecimal, order_number_generator_prefix_suffix' end |
#to_hash ⇒ Object
13131 13132 13133 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13131 def to_hash subtype_to_hash.merge(:discriminator => @discriminator) end |