Class: Io::Flow::V0::Models::DeminimisPerItem
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
De Minimis per item describes rules which require minimum and/or maximum values per item
Instance Attribute Summary collapse
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#maximum ⇒ Object
readonly
Returns the value of attribute maximum.
-
#minimum ⇒ Object
readonly
Returns the value of attribute minimum.
Attributes inherited from Deminimis
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ DeminimisPerItem
constructor
A new instance of DeminimisPerItem.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from Deminimis
Constructor Details
#initialize(incoming = {}) ⇒ DeminimisPerItem
Returns a new instance of DeminimisPerItem.
30049 30050 30051 30052 30053 30054 30055 30056 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30049 def initialize(incoming={}) super(:discriminator => Deminimis::Types::DEMINIMIS_PER_ITEM) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:currency], 'DeminimisPerItem') @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String) @minimum = (x = opts.delete(:minimum); x.nil? ? nil : HttpClient::Preconditions.assert_class('minimum', HttpClient::Helper.to_big_decimal(x), BigDecimal)) @maximum = (x = opts.delete(:maximum); x.nil? ? nil : HttpClient::Preconditions.assert_class('maximum', HttpClient::Helper.to_big_decimal(x), BigDecimal)) end |
Instance Attribute Details
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
30047 30048 30049 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30047 def currency @currency end |
#maximum ⇒ Object (readonly)
Returns the value of attribute maximum.
30047 30048 30049 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30047 def maximum @maximum end |
#minimum ⇒ Object (readonly)
Returns the value of attribute minimum.
30047 30048 30049 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30047 def minimum @minimum end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
30062 30063 30064 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30062 def copy(incoming={}) DeminimisPerItem.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
30066 30067 30068 30069 30070 30071 30072 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30066 def subtype_to_hash { :currency => currency, :minimum => minimum.to_f.to_s, :maximum => maximum.to_f.to_s } end |
#to_json ⇒ Object
30058 30059 30060 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30058 def to_json JSON.dump(to_hash) end |