Class: Io::Flow::V0::Models::QueryFilter
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::QueryFilter
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Direct Known Subclasses
QueryFilterStructured, QueryFilterUndefinedType, QueryFilterUnstructured
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 = {}) ⇒ QueryFilter
constructor
A new instance of QueryFilter.
- #subtype_to_hash ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ QueryFilter
Returns a new instance of QueryFilter.
14659 14660 14661 14662 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14659 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) @discriminator = HttpClient::Preconditions.assert_class('discriminator', opts.delete(:discriminator) || 'query_filter_structured', String) end |
Instance Attribute Details
#discriminator ⇒ Object (readonly)
Returns the value of attribute discriminator.
14657 14658 14659 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14657 def discriminator @discriminator end |
Class Method Details
.from_json(hash) ⇒ Object
14672 14673 14674 14675 14676 14677 14678 14679 14680 14681 14682 14683 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14672 def QueryFilter.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[query_filter] requires a field named 'discriminator'" end case discriminator when Types::QUERY_FILTER_STRUCTURED; QueryFilterStructured.new(hash) when Types::QUERY_FILTER_UNSTRUCTURED; QueryFilterUnstructured.new(hash) else QueryFilterUndefinedType.new(:discriminator => discriminator) end end |
Instance Method Details
#subtype_to_hash ⇒ Object
14664 14665 14666 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14664 def subtype_to_hash raise 'Cannot serialize an instance of query_filter directly - must use one of the specific types: query_filter_structured, query_filter_unstructured' end |
#to_hash ⇒ Object
14668 14669 14670 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14668 def to_hash subtype_to_hash.merge(:discriminator => @discriminator) end |