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.
30210 30211 30212 30213 30214 30215 30216 30217 30218 30219 30220 30221 30222 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30210 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.
30208 30209 30210 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30208 def discount @discount end |
#duties ⇒ Object (readonly)
Returns the value of attribute duties.
30208 30209 30210 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30208 def duties @duties end |
#duties_subsidy ⇒ Object (readonly)
Returns the value of attribute duties_subsidy.
30208 30209 30210 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30208 def duties_subsidy @duties_subsidy end |
#line_items ⇒ Object (readonly)
Returns the value of attribute line_items.
30208 30209 30210 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30208 def line_items @line_items end |
#shipping ⇒ Object (readonly)
Returns the value of attribute shipping.
30208 30209 30210 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30208 def shipping @shipping end |
#subtotal ⇒ Object (readonly)
Returns the value of attribute subtotal.
30208 30209 30210 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30208 def subtotal @subtotal end |
#tax ⇒ Object (readonly)
Returns the value of attribute tax.
30208 30209 30210 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30208 def tax @tax end |
#tax_subsidy ⇒ Object (readonly)
Returns the value of attribute tax_subsidy.
30208 30209 30210 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30208 def tax_subsidy @tax_subsidy end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
30208 30209 30210 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30208 def total @total end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
30228 30229 30230 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30228 def copy(incoming={}) AllocationLineSummary.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
30232 30233 30234 30235 30236 30237 30238 30239 30240 30241 30242 30243 30244 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30232 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
30224 30225 30226 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30224 def to_json JSON.dump(to_hash) end |