Class: Io::Flow::V0::Models::TaxSetting
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::TaxSetting
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Direct Known Subclasses
AvalaraTaxCsvSetting, AvalaraTaxSetting, TaxSettingUndefinedType
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 = {}) ⇒ TaxSetting
constructor
A new instance of TaxSetting.
- #subtype_to_hash ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ TaxSetting
Returns a new instance of TaxSetting.
15808 15809 15810 15811 15812 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15808 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:discriminator], 'TaxSetting') @discriminator = HttpClient::Preconditions.assert_class('discriminator', opts.delete(:discriminator), String) end |
Instance Attribute Details
#discriminator ⇒ Object (readonly)
Returns the value of attribute discriminator.
15806 15807 15808 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15806 def discriminator @discriminator end |
Class Method Details
.from_json(hash) ⇒ Object
15822 15823 15824 15825 15826 15827 15828 15829 15830 15831 15832 15833 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15822 def TaxSetting.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[tax_setting] requires a field named 'discriminator'" end case discriminator when Types::AVALARA_TAX_SETTING; AvalaraTaxSetting.new(hash) when Types::AVALARA_TAX_CSV_SETTING; AvalaraTaxCsvSetting.new(hash) else TaxSettingUndefinedType.new(:discriminator => discriminator) end end |
Instance Method Details
#subtype_to_hash ⇒ Object
15814 15815 15816 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15814 def subtype_to_hash raise 'Cannot serialize an instance of tax_setting directly - must use one of the specific types: avalara_tax_setting, avalara_tax_csv_setting' end |
#to_hash ⇒ Object
15818 15819 15820 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15818 def to_hash subtype_to_hash.merge(:discriminator => @discriminator) end |