Class: Io::Flow::V0::Models::OrderPriceDetails
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::OrderPriceDetails
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Represents the price details for the entire order.
Instance Attribute Summary collapse
-
#adjustments ⇒ Object
readonly
Returns the value of attribute adjustments.
-
#discounts ⇒ Object
readonly
Returns the value of attribute discounts.
-
#duty ⇒ Object
readonly
Returns the value of attribute duty.
-
#insurance ⇒ Object
readonly
Returns the value of attribute insurance.
-
#shipping ⇒ Object
readonly
Returns the value of attribute shipping.
-
#subtotal ⇒ Object
readonly
Returns the value of attribute subtotal.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
-
#vat ⇒ Object
readonly
Returns the value of attribute vat.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ OrderPriceDetails
constructor
A new instance of OrderPriceDetails.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ OrderPriceDetails
Returns a new instance of OrderPriceDetails.
13098 13099 13100 13101 13102 13103 13104 13105 13106 13107 13108 13109 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13098 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:subtotal, :vat, :duty, :shipping, :insurance, :discounts, :adjustments, :total], 'OrderPriceDetails') @subtotal = (x = opts.delete(:subtotal); x.is_a?(::Io::Flow::V0::Models::OrderPriceDetail) ? x : ::Io::Flow::V0::Models::OrderPriceDetail.new(x)) @vat = (x = opts.delete(:vat); x.is_a?(::Io::Flow::V0::Models::OrderPriceDetail) ? x : ::Io::Flow::V0::Models::OrderPriceDetail.new(x)) @duty = (x = opts.delete(:duty); x.is_a?(::Io::Flow::V0::Models::OrderPriceDetail) ? x : ::Io::Flow::V0::Models::OrderPriceDetail.new(x)) @shipping = (x = opts.delete(:shipping); x.is_a?(::Io::Flow::V0::Models::OrderPriceDetail) ? x : ::Io::Flow::V0::Models::OrderPriceDetail.new(x)) @insurance = (x = opts.delete(:insurance); x.is_a?(::Io::Flow::V0::Models::OrderPriceDetail) ? x : ::Io::Flow::V0::Models::OrderPriceDetail.new(x)) @discounts = (x = opts.delete(:discounts); x.is_a?(::Io::Flow::V0::Models::OrderPriceDetail) ? x : ::Io::Flow::V0::Models::OrderPriceDetail.new(x)) @adjustments = (x = opts.delete(:adjustments); x.is_a?(::Io::Flow::V0::Models::OrderPriceDetail) ? x : ::Io::Flow::V0::Models::OrderPriceDetail.new(x)) @total = (x = opts.delete(:total); x.is_a?(::Io::Flow::V0::Models::PriceWithBase) ? x : ::Io::Flow::V0::Models::PriceWithBase.new(x)) end |
Instance Attribute Details
#adjustments ⇒ Object (readonly)
Returns the value of attribute adjustments.
13096 13097 13098 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13096 def adjustments @adjustments end |
#discounts ⇒ Object (readonly)
Returns the value of attribute discounts.
13096 13097 13098 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13096 def discounts @discounts end |
#duty ⇒ Object (readonly)
Returns the value of attribute duty.
13096 13097 13098 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13096 def duty @duty end |
#insurance ⇒ Object (readonly)
Returns the value of attribute insurance.
13096 13097 13098 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13096 def insurance @insurance end |
#shipping ⇒ Object (readonly)
Returns the value of attribute shipping.
13096 13097 13098 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13096 def shipping @shipping end |
#subtotal ⇒ Object (readonly)
Returns the value of attribute subtotal.
13096 13097 13098 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13096 def subtotal @subtotal end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
13096 13097 13098 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13096 def total @total end |
#vat ⇒ Object (readonly)
Returns the value of attribute vat.
13096 13097 13098 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13096 def vat @vat end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
13115 13116 13117 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13115 def copy(incoming={}) OrderPriceDetails.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
13119 13120 13121 13122 13123 13124 13125 13126 13127 13128 13129 13130 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13119 def to_hash { :subtotal => subtotal.to_hash, :vat => vat.to_hash, :duty => duty.to_hash, :shipping => shipping.to_hash, :insurance => insurance.to_hash, :discounts => discounts.to_hash, :adjustments => adjustments.to_hash, :total => total.to_hash } end |
#to_json ⇒ Object
13111 13112 13113 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13111 def to_json JSON.dump(to_hash) end |