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
Returns a new instance of HintForm.
8385 8386 8387 8388 8389 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8385 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.
8383 8384 8385 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8383 def discriminator @discriminator end |
Class Method Details
.from_json(hash) ⇒ Object
8399 8400 8401 8402 8403 8404 8405 8406 8407 8408 8409 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8399 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
8391 8392 8393 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8391 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
8395 8396 8397 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8395 def to_hash subtype_to_hash.merge(:discriminator => @discriminator) end |