class Io::Flow::V0::Models::DeminimisSimple
De Minimis for most common example which includes a value threshold and rules on what components are used in the duty calculation
Attributes
components[R]
currency[R]
minimum[R]
value[R]
Public Class Methods
new(incoming={})
click to toggle source
Calls superclass method
Io::Flow::V0::Models::Deminimis::new
# File lib/flow_commerce/flow_api_v0_client.rb, line 39454 def initialize(incoming={}) super(:discriminator => Deminimis::Types::DEMINIMIS_SIMPLE) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:currency, :components], 'DeminimisSimple') @value = (x = opts.delete(:value); x.nil? ? nil : HttpClient::Preconditions.assert_class('value', HttpClient::Helper.to_big_decimal(x), BigDecimal)) @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String) @components = HttpClient::Preconditions.assert_class('components', opts.delete(:components), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::LevyComponent) ? x : ::Io::Flow::V0::Models::LevyComponent.apply(x)) } @minimum = (x = opts.delete(:minimum); x.nil? ? nil : HttpClient::Preconditions.assert_class('minimum', HttpClient::Helper.to_big_decimal(x), BigDecimal)) end
Public Instance Methods
copy(incoming={})
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 39468 def copy(incoming={}) DeminimisSimple.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end
subtype_to_hash()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 39472 def subtype_to_hash { :value => value.to_f.to_s, :currency => currency, :components => components.map { |o| o.value }, :minimum => minimum.to_f.to_s } end
to_json()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 39464 def to_json JSON.dump(to_hash) end