Class: Io::Flow::V0::Models::TaxDutyQuoteValues
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::TaxDutyQuoteValues
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#duty ⇒ Object
readonly
Returns the value of attribute duty.
-
#fees ⇒ Object
readonly
Returns the value of attribute fees.
-
#price ⇒ Object
readonly
Returns the value of attribute price.
-
#tax ⇒ Object
readonly
Returns the value of attribute tax.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ TaxDutyQuoteValues
constructor
A new instance of TaxDutyQuoteValues.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ TaxDutyQuoteValues
Returns a new instance of TaxDutyQuoteValues.
70218 70219 70220 70221 70222 70223 70224 70225 70226 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70218 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:price, :duty, :tax, :fees, :total], 'TaxDutyQuoteValues') @price = HttpClient::Preconditions.assert_class('price', HttpClient::Helper.to_big_decimal(opts.delete(:price)), BigDecimal) @duty = (x = opts.delete(:duty); x.is_a?(::Io::Flow::V0::Models::TaxDutyQuoteSimpleLevyValue) ? x : ::Io::Flow::V0::Models::TaxDutyQuoteSimpleLevyValue.new(x)) @tax = (x = opts.delete(:tax); x.is_a?(::Io::Flow::V0::Models::TaxDutyQuoteSimpleLevyValue) ? x : ::Io::Flow::V0::Models::TaxDutyQuoteSimpleLevyValue.new(x)) @fees = (x = opts.delete(:fees); x.is_a?(::Io::Flow::V0::Models::TaxDutyQuoteFeeValue) ? x : ::Io::Flow::V0::Models::TaxDutyQuoteFeeValue.new(x)) @total = HttpClient::Preconditions.assert_class('total', HttpClient::Helper.to_big_decimal(opts.delete(:total)), BigDecimal) end |
Instance Attribute Details
#duty ⇒ Object (readonly)
Returns the value of attribute duty.
70216 70217 70218 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70216 def duty @duty end |
#fees ⇒ Object (readonly)
Returns the value of attribute fees.
70216 70217 70218 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70216 def fees @fees end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
70216 70217 70218 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70216 def price @price end |
#tax ⇒ Object (readonly)
Returns the value of attribute tax.
70216 70217 70218 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70216 def tax @tax end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
70216 70217 70218 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70216 def total @total end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
70232 70233 70234 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70232 def copy(incoming={}) TaxDutyQuoteValues.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
70236 70237 70238 70239 70240 70241 70242 70243 70244 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70236 def to_hash { :price => price.to_f.to_s, :duty => duty.to_hash, :tax => tax.to_hash, :fees => fees.to_hash, :total => total.to_f.to_s } end |
#to_json ⇒ Object
70228 70229 70230 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70228 def to_json JSON.dump(to_hash) end |