Class: Io::Flow::V0::Models::Deminimis
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::Deminimis
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
De Minimis describes the country specific rules for exactly how tax and duties are calculated, as well as any exemptions that apply. See en.wikipedia.org/wiki/De_minimis for more information.
Direct Known Subclasses
Defined Under Namespace
Modules: Types
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(incoming = {}) ⇒ Deminimis
constructor
A new instance of Deminimis.
- #subtype_to_hash ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ Deminimis
Returns a new instance of Deminimis.
3964 3965 3966 3967 3968 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3964 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:name], 'Deminimis') @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String) end |
Class Method Details
.from_json(hash) ⇒ Object
3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3978 def Deminimis.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[deminimis] requires a field named 'discriminator'" end case discriminator when Types::DEMINIMIS_SIMPLE; DeminimisSimple.new(hash) when Types::DEMINIMIS_PER_ITEM; DeminimisPerItem.new(hash) else DeminimisUndefinedType.new(:name => discriminator) end end |
Instance Method Details
#subtype_to_hash ⇒ Object
3970 3971 3972 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3970 def subtype_to_hash raise 'Cannot serialize an instance of deminimis directly - must use one of the specific types: deminimis_simple, deminimis_per_item' end |
#to_hash ⇒ Object
3974 3975 3976 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3974 def to_hash subtype_to_hash.merge(:discriminator => @name) end |