Class: Io::Flow::V0::Models::OrderRefundSummaryAmounts
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::OrderRefundSummaryAmounts
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Detailed examples of amount to refund following common e-commerce use cases.
Instance Attribute Summary collapse
-
#balance ⇒ Object
readonly
Returns the value of attribute balance.
-
#discount ⇒ Object
readonly
Returns the value of attribute discount.
-
#duty ⇒ Object
readonly
Returns the value of attribute duty.
-
#item_subtotal ⇒ Object
readonly
Returns the value of attribute item_subtotal.
-
#refund_total ⇒ Object
readonly
Returns the value of attribute refund_total.
-
#shipping ⇒ Object
readonly
Returns the value of attribute shipping.
-
#vat ⇒ Object
readonly
Returns the value of attribute vat.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ OrderRefundSummaryAmounts
constructor
A new instance of OrderRefundSummaryAmounts.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ OrderRefundSummaryAmounts
Returns a new instance of OrderRefundSummaryAmounts.
53698 53699 53700 53701 53702 53703 53704 53705 53706 53707 53708 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53698 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:balance, :item_subtotal, :refund_total, :shipping, :vat, :duty], 'OrderRefundSummaryAmounts') @balance = HttpClient::Preconditions.assert_class('balance', HttpClient::Helper.to_big_decimal(opts.delete(:balance)), BigDecimal) @item_subtotal = HttpClient::Preconditions.assert_class('item_subtotal', HttpClient::Helper.to_big_decimal(opts.delete(:item_subtotal)), BigDecimal) @discount = (x = opts.delete(:discount); x.nil? ? nil : HttpClient::Preconditions.assert_class('discount', HttpClient::Helper.to_big_decimal(x), BigDecimal)) @refund_total = HttpClient::Preconditions.assert_class('refund_total', HttpClient::Helper.to_big_decimal(opts.delete(:refund_total)), BigDecimal) @shipping = HttpClient::Preconditions.assert_class('shipping', HttpClient::Helper.to_big_decimal(opts.delete(:shipping)), BigDecimal) @vat = HttpClient::Preconditions.assert_class('vat', HttpClient::Helper.to_big_decimal(opts.delete(:vat)), BigDecimal) @duty = HttpClient::Preconditions.assert_class('duty', HttpClient::Helper.to_big_decimal(opts.delete(:duty)), BigDecimal) end |
Instance Attribute Details
#balance ⇒ Object (readonly)
Returns the value of attribute balance.
53696 53697 53698 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53696 def balance @balance end |
#discount ⇒ Object (readonly)
Returns the value of attribute discount.
53696 53697 53698 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53696 def discount @discount end |
#duty ⇒ Object (readonly)
Returns the value of attribute duty.
53696 53697 53698 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53696 def duty @duty end |
#item_subtotal ⇒ Object (readonly)
Returns the value of attribute item_subtotal.
53696 53697 53698 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53696 def item_subtotal @item_subtotal end |
#refund_total ⇒ Object (readonly)
Returns the value of attribute refund_total.
53696 53697 53698 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53696 def refund_total @refund_total end |
#shipping ⇒ Object (readonly)
Returns the value of attribute shipping.
53696 53697 53698 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53696 def shipping @shipping end |
#vat ⇒ Object (readonly)
Returns the value of attribute vat.
53696 53697 53698 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53696 def vat @vat end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
53714 53715 53716 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53714 def copy(incoming={}) OrderRefundSummaryAmounts.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
53718 53719 53720 53721 53722 53723 53724 53725 53726 53727 53728 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53718 def to_hash { :balance => balance.to_f.to_s, :item_subtotal => item_subtotal.to_f.to_s, :discount => discount.to_f.to_s, :refund_total => refund_total.to_f.to_s, :shipping => shipping.to_f.to_s, :vat => vat.to_f.to_s, :duty => duty.to_f.to_s } end |
#to_json ⇒ Object
53710 53711 53712 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53710 def to_json JSON.dump(to_hash) end |