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.
8395 8396 8397 8398 8399 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8395 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.
8393 8394 8395 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8393 def discriminator @discriminator end |
Class Method Details
.from_json(hash) ⇒ Object
8409 8410 8411 8412 8413 8414 8415 8416 8417 8418 8419 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8409 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
8401 8402 8403 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8401 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
8405 8406 8407 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8405 def to_hash subtype_to_hash.merge(:discriminator => @discriminator) end |