Class: Io::Flow::V0::Models::OrderInformation
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::OrderInformation
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Direct Known Subclasses
OrderInformationDetails, OrderInformationFlow, OrderInformationUndefinedType
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 = {}) ⇒ OrderInformation
constructor
A new instance of OrderInformation.
- #subtype_to_hash ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ OrderInformation
Returns a new instance of OrderInformation.
13058 13059 13060 13061 13062 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13058 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:type], 'OrderInformation') @type = HttpClient::Preconditions.assert_class('type', opts.delete(:type), String) end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
13056 13057 13058 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13056 def type @type end |
Class Method Details
.from_json(hash) ⇒ Object
13072 13073 13074 13075 13076 13077 13078 13079 13080 13081 13082 13083 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13072 def OrderInformation.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[order_information] requires a field named 'type'" end case discriminator when Types::ORDER_INFORMATION_FLOW; OrderInformationFlow.new(hash) when Types::ORDER_INFORMATION_DETAILS; OrderInformationDetails.new(hash) else OrderInformationUndefinedType.new(:type => discriminator) end end |
Instance Method Details
#subtype_to_hash ⇒ Object
13064 13065 13066 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13064 def subtype_to_hash raise 'Cannot serialize an instance of order_information directly - must use one of the specific types: order_information_flow, order_information_details' end |
#to_hash ⇒ Object
13068 13069 13070 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13068 def to_hash subtype_to_hash.merge(:type => @type) end |