class Io::Flow::V0::Models::OrderSummary
The order summary is a view of the order summary object with the order prices flattened to keys.
Attributes
adjustment[R]
attributes[R]
discount[R]
duty[R]
identifiers[R]
insurance[R]
lines[R]
number[R]
shipping[R]
subtotal[R]
surcharges[R]
tax[R]
total[R]
Public Class Methods
new(incoming={})
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 54212 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:number, :subtotal, :total, :lines], 'OrderSummary') @number = HttpClient::Preconditions.assert_class('number', opts.delete(:number), String) @subtotal = (x = opts.delete(:subtotal); x.is_a?(::Io::Flow::V0::Models::OrderSummaryPriceDetail) ? x : ::Io::Flow::V0::Models::OrderSummaryPriceDetail.new(x)) @shipping = (x = opts.delete(:shipping); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::OrderSummaryPriceDetail) ? x : ::Io::Flow::V0::Models::OrderSummaryPriceDetail.new(x))) @tax = (x = opts.delete(:tax); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::OrderSummaryPriceDetail) ? x : ::Io::Flow::V0::Models::OrderSummaryPriceDetail.new(x))) @duty = (x = opts.delete(:duty); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::OrderSummaryPriceDetail) ? x : ::Io::Flow::V0::Models::OrderSummaryPriceDetail.new(x))) @insurance = (x = opts.delete(:insurance); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::OrderSummaryPriceDetail) ? x : ::Io::Flow::V0::Models::OrderSummaryPriceDetail.new(x))) @discount = (x = opts.delete(:discount); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::OrderSummaryPriceDetail) ? x : ::Io::Flow::V0::Models::OrderSummaryPriceDetail.new(x))) @surcharges = (x = opts.delete(:surcharges); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::OrderSummaryPriceDetail) ? x : ::Io::Flow::V0::Models::OrderSummaryPriceDetail.new(x))) @adjustment = (x = opts.delete(:adjustment); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::OrderSummaryPriceDetail) ? x : ::Io::Flow::V0::Models::OrderSummaryPriceDetail.new(x))) @total = (x = opts.delete(:total); x.is_a?(::Io::Flow::V0::Models::OrderSummaryPriceDetail) ? x : ::Io::Flow::V0::Models::OrderSummaryPriceDetail.new(x)) @lines = HttpClient::Preconditions.assert_class('lines', opts.delete(:lines), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::OrderSummaryLineItem) ? x : ::Io::Flow::V0::Models::OrderSummaryLineItem.new(x)) } @identifiers = (x = opts.delete(:identifiers); x.nil? ? nil : HttpClient::Preconditions.assert_class('identifiers', x, Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('identifiers', d[1], String); h }) @attributes = (x = opts.delete(:attributes); x.nil? ? nil : HttpClient::Preconditions.assert_class('attributes', x, Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h }) end
Public Instance Methods
copy(incoming={})
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 54234 def copy(incoming={}) OrderSummary.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end
to_hash()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 54238 def to_hash { :number => number, :subtotal => subtotal.to_hash, :shipping => shipping.nil? ? nil : shipping.to_hash, :tax => tax.nil? ? nil : tax.to_hash, :duty => duty.nil? ? nil : duty.to_hash, :insurance => insurance.nil? ? nil : insurance.to_hash, :discount => discount.nil? ? nil : discount.to_hash, :surcharges => surcharges.nil? ? nil : surcharges.to_hash, :adjustment => adjustment.nil? ? nil : adjustment.to_hash, :total => total.to_hash, :lines => lines.map { |o| o.to_hash }, :identifiers => identifiers.nil? ? nil : identifiers, :attributes => attributes.nil? ? nil : attributes } end
to_json()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 54230 def to_json JSON.dump(to_hash) end