Class: Io::Flow::V0::Models::RefundOrderSummaryAmounts

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

Detailed examples of amount to refund following common ecommerce use cases.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ RefundOrderSummaryAmounts

Returns a new instance of RefundOrderSummaryAmounts.



23259
23260
23261
23262
23263
23264
23265
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23259

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:balance], 'RefundOrderSummaryAmounts')
  @balance = HttpClient::Preconditions.assert_class('balance', HttpClient::Helper.to_big_decimal(opts.delete(:balance)), BigDecimal)
  @balance_excluding_shipping = (x = opts.delete(:balance_excluding_shipping); x.nil? ? nil : HttpClient::Preconditions.assert_class('balance_excluding_shipping', HttpClient::Helper.to_big_decimal(x), BigDecimal))
  @shipping = (x = opts.delete(:shipping); x.nil? ? nil : HttpClient::Preconditions.assert_class('shipping', HttpClient::Helper.to_big_decimal(x), BigDecimal))
end

Instance Attribute Details

#balanceObject (readonly)

Returns the value of attribute balance.



23257
23258
23259
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23257

def balance
  @balance
end

#balance_excluding_shippingObject (readonly)

Returns the value of attribute balance_excluding_shipping.



23257
23258
23259
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23257

def balance_excluding_shipping
  @balance_excluding_shipping
end

#shippingObject (readonly)

Returns the value of attribute shipping.



23257
23258
23259
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23257

def shipping
  @shipping
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



23271
23272
23273
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23271

def copy(incoming={})
  RefundOrderSummaryAmounts.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



23275
23276
23277
23278
23279
23280
23281
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23275

def to_hash
  {
    :balance => balance,
    :balance_excluding_shipping => balance_excluding_shipping,
    :shipping => shipping
  }
end

#to_jsonObject



23267
23268
23269
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23267

def to_json
  JSON.dump(to_hash)
end