Class: Io::Flow::V0::Models::AllocationLineSummary
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::AllocationLineSummary
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
A line-based view of order financials.
Instance Attribute Summary collapse
-
#discount ⇒ Object
readonly
Returns the value of attribute discount.
-
#duties ⇒ Object
readonly
Returns the value of attribute duties.
-
#duties_subsidy ⇒ Object
readonly
Returns the value of attribute duties_subsidy.
-
#line_items ⇒ Object
readonly
Returns the value of attribute line_items.
-
#shipping ⇒ Object
readonly
Returns the value of attribute shipping.
-
#subtotal ⇒ Object
readonly
Returns the value of attribute subtotal.
-
#tax ⇒ Object
readonly
Returns the value of attribute tax.
-
#tax_subsidy ⇒ Object
readonly
Returns the value of attribute tax_subsidy.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ AllocationLineSummary
constructor
A new instance of AllocationLineSummary.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ AllocationLineSummary
Returns a new instance of AllocationLineSummary.
28006 28007 28008 28009 28010 28011 28012 28013 28014 28015 28016 28017 28018 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28006 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:line_items, :shipping, :subtotal, :discount, :duties, :tax, :tax_subsidy, :duties_subsidy, :total], 'AllocationLineSummary') @line_items = HttpClient::Preconditions.assert_class('line_items', opts.delete(:line_items), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::AllocationLineSummaryLineItem) ? x : ::Io::Flow::V0::Models::AllocationLineSummaryLineItem.new(x)) } @shipping = (x = opts.delete(:shipping); x.is_a?(::Io::Flow::V0::Models::AllocationLineSummaryShipping) ? x : ::Io::Flow::V0::Models::AllocationLineSummaryShipping.new(x)) @subtotal = (x = opts.delete(:subtotal); x.is_a?(::Io::Flow::V0::Models::MoneyWithBase) ? x : ::Io::Flow::V0::Models::MoneyWithBase.new(x)) @discount = (x = opts.delete(:discount); x.is_a?(::Io::Flow::V0::Models::MoneyWithBase) ? x : ::Io::Flow::V0::Models::MoneyWithBase.new(x)) @duties = (x = opts.delete(:duties); x.is_a?(::Io::Flow::V0::Models::MoneyWithBase) ? x : ::Io::Flow::V0::Models::MoneyWithBase.new(x)) @tax = (x = opts.delete(:tax); x.is_a?(::Io::Flow::V0::Models::MoneyWithBase) ? x : ::Io::Flow::V0::Models::MoneyWithBase.new(x)) @tax_subsidy = (x = opts.delete(:tax_subsidy); x.is_a?(::Io::Flow::V0::Models::MoneyWithBase) ? x : ::Io::Flow::V0::Models::MoneyWithBase.new(x)) @duties_subsidy = (x = opts.delete(:duties_subsidy); x.is_a?(::Io::Flow::V0::Models::MoneyWithBase) ? x : ::Io::Flow::V0::Models::MoneyWithBase.new(x)) @total = (x = opts.delete(:total); x.is_a?(::Io::Flow::V0::Models::MoneyWithBase) ? x : ::Io::Flow::V0::Models::MoneyWithBase.new(x)) end |
Instance Attribute Details
#discount ⇒ Object (readonly)
Returns the value of attribute discount.
28004 28005 28006 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28004 def discount @discount end |
#duties ⇒ Object (readonly)
Returns the value of attribute duties.
28004 28005 28006 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28004 def duties @duties end |
#duties_subsidy ⇒ Object (readonly)
Returns the value of attribute duties_subsidy.
28004 28005 28006 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28004 def duties_subsidy @duties_subsidy end |
#line_items ⇒ Object (readonly)
Returns the value of attribute line_items.
28004 28005 28006 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28004 def line_items @line_items end |
#shipping ⇒ Object (readonly)
Returns the value of attribute shipping.
28004 28005 28006 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28004 def shipping @shipping end |
#subtotal ⇒ Object (readonly)
Returns the value of attribute subtotal.
28004 28005 28006 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28004 def subtotal @subtotal end |
#tax ⇒ Object (readonly)
Returns the value of attribute tax.
28004 28005 28006 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28004 def tax @tax end |
#tax_subsidy ⇒ Object (readonly)
Returns the value of attribute tax_subsidy.
28004 28005 28006 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28004 def tax_subsidy @tax_subsidy end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
28004 28005 28006 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28004 def total @total end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
28024 28025 28026 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28024 def copy(incoming={}) AllocationLineSummary.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
28028 28029 28030 28031 28032 28033 28034 28035 28036 28037 28038 28039 28040 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28028 def to_hash { :line_items => line_items.map { |o| o.to_hash }, :shipping => shipping.to_hash, :subtotal => subtotal.to_hash, :discount => discount.to_hash, :duties => duties.to_hash, :tax => tax.to_hash, :tax_subsidy => tax_subsidy.to_hash, :duties_subsidy => duties_subsidy.to_hash, :total => total.to_hash } end |
#to_json ⇒ Object
28020 28021 28022 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28020 def to_json JSON.dump(to_hash) end |