Class: Io::Flow::V0::Models::DeviceDetails
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::DeviceDetails
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Direct Known Subclasses
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 = {}) ⇒ DeviceDetails
constructor
A new instance of DeviceDetails.
- #subtype_to_hash ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ DeviceDetails
Returns a new instance of DeviceDetails.
10616 10617 10618 10619 10620 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10616 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:type], 'DeviceDetails') @type = HttpClient::Preconditions.assert_class('type', opts.delete(:type), String) end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
10614 10615 10616 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10614 def type @type end |
Class Method Details
.from_json(hash) ⇒ Object
10630 10631 10632 10633 10634 10635 10636 10637 10638 10639 10640 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10630 def DeviceDetails.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[device_details] requires a field named 'type'" end case discriminator when Types::DEVICE_DETAILS_BROWSER; DeviceDetailsBrowser.new(hash) else DeviceDetailsUndefinedType.new(:type => discriminator) end end |
Instance Method Details
#subtype_to_hash ⇒ Object
10622 10623 10624 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10622 def subtype_to_hash raise 'Cannot serialize an instance of device_details directly - must use one of the specific types: device_details_browser' end |
#to_hash ⇒ Object
10626 10627 10628 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10626 def to_hash subtype_to_hash.merge(:type => @type) end |