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.
9735 9736 9737 9738 9739 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9735 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.
9733 9734 9735 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9733 def type @type end |
Class Method Details
.from_json(hash) ⇒ Object
9749 9750 9751 9752 9753 9754 9755 9756 9757 9758 9759 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9749 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
9741 9742 9743 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9741 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
9745 9746 9747 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9745 def to_hash subtype_to_hash.merge(:type => @type) end |