Class: Io::Flow::V0::Models::TaxDutyQuoteSimpleLevyValue
- Inherits:
-
TaxDutyQuoteLevyValue
- Object
- TaxDutyQuoteLevyValue
- Io::Flow::V0::Models::TaxDutyQuoteSimpleLevyValue
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Value of a levy (tax or duty) with no additional detail.
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#amount_refundable_on_return ⇒ Object
readonly
Returns the value of attribute amount_refundable_on_return.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#rate ⇒ Object
readonly
Returns the value of attribute rate.
-
#zero_levy_reason ⇒ Object
readonly
Returns the value of attribute zero_levy_reason.
Attributes inherited from TaxDutyQuoteLevyValue
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ TaxDutyQuoteSimpleLevyValue
constructor
A new instance of TaxDutyQuoteSimpleLevyValue.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from TaxDutyQuoteLevyValue
Constructor Details
#initialize(incoming = {}) ⇒ TaxDutyQuoteSimpleLevyValue
Returns a new instance of TaxDutyQuoteSimpleLevyValue.
70121 70122 70123 70124 70125 70126 70127 70128 70129 70130 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70121 def initialize(incoming={}) super(:discriminator => TaxDutyQuoteLevyValue::Types::TAX_DUTY_QUOTE_SIMPLE_LEVY_VALUE) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:amount, :rate, :description, :amount_refundable_on_return], 'TaxDutyQuoteSimpleLevyValue') @amount = HttpClient::Preconditions.assert_class('amount', HttpClient::Helper.to_big_decimal(opts.delete(:amount)), BigDecimal) @rate = HttpClient::Preconditions.assert_class('rate', HttpClient::Helper.to_big_decimal(opts.delete(:rate)), BigDecimal) @description = HttpClient::Preconditions.assert_class('description', opts.delete(:description), String) @zero_levy_reason = (x = opts.delete(:zero_levy_reason); x.nil? ? nil : HttpClient::Preconditions.assert_class('zero_levy_reason', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::ZeroLevyReasonCode) ? x : ::Io::Flow::V0::Models::ZeroLevyReasonCode.apply(x)) }) @amount_refundable_on_return = HttpClient::Preconditions.assert_class('amount_refundable_on_return', HttpClient::Helper.to_big_decimal(opts.delete(:amount_refundable_on_return)), BigDecimal) end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
70119 70120 70121 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70119 def amount @amount end |
#amount_refundable_on_return ⇒ Object (readonly)
Returns the value of attribute amount_refundable_on_return.
70119 70120 70121 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70119 def amount_refundable_on_return @amount_refundable_on_return end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
70119 70120 70121 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70119 def description @description end |
#rate ⇒ Object (readonly)
Returns the value of attribute rate.
70119 70120 70121 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70119 def rate @rate end |
#zero_levy_reason ⇒ Object (readonly)
Returns the value of attribute zero_levy_reason.
70119 70120 70121 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70119 def zero_levy_reason @zero_levy_reason end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
70136 70137 70138 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70136 def copy(incoming={}) TaxDutyQuoteSimpleLevyValue.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
70140 70141 70142 70143 70144 70145 70146 70147 70148 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70140 def subtype_to_hash { :amount => amount.to_f.to_s, :rate => rate.to_f.to_s, :description => description, :zero_levy_reason => zero_levy_reason.nil? ? nil : zero_levy_reason.map { |o| o.value }, :amount_refundable_on_return => amount_refundable_on_return.to_f.to_s } end |
#to_json ⇒ Object
70132 70133 70134 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70132 def to_json JSON.dump(to_hash) end |