Class: Io::Flow::V0::Models::HintForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::HintForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Describes types of forms that can be used to assign an HS code based on product data.
Direct Known Subclasses
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 = {}) ⇒ HintForm
constructor
A new instance of HintForm.
- #subtype_to_hash ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ HintForm
6830 6831 6832 6833 6834 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6830 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:discriminator], 'HintForm') @discriminator = HttpClient::Preconditions.assert_class('discriminator', opts.delete(:discriminator), String) end |
Instance Attribute Details
#discriminator ⇒ Object (readonly)
Returns the value of attribute discriminator.
6828 6829 6830 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6828 def discriminator @discriminator end |
Class Method Details
.from_json(hash) ⇒ Object
6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6844 def HintForm.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[hint_form] requires a field named 'discriminator'" end case discriminator when Types::PHRASE_HINT_FORM; PhraseHintForm.new(hash) else HintFormUndefinedType.new(:discriminator => discriminator) end end |
Instance Method Details
#subtype_to_hash ⇒ Object
6836 6837 6838 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6836 def subtype_to_hash raise 'Cannot serialize an instance of hint_form directly - must use one of the specific types: phrase_hint_form' end |
#to_hash ⇒ Object
6840 6841 6842 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6840 def to_hash subtype_to_hash.merge(:discriminator => @discriminator) end |