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 e-commerce use cases.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ RefundOrderSummaryAmounts

Returns a new instance of RefundOrderSummaryAmounts.



47245
47246
47247
47248
47249
47250
47251
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47245

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.



47243
47244
47245
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47243

def balance
  @balance
end

#balance_excluding_shippingObject (readonly)

Returns the value of attribute balance_excluding_shipping.



47243
47244
47245
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47243

def balance_excluding_shipping
  @balance_excluding_shipping
end

#shippingObject (readonly)

Returns the value of attribute shipping.



47243
47244
47245
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47243

def shipping
  @shipping
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



47257
47258
47259
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47257

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

#to_hashObject



47261
47262
47263
47264
47265
47266
47267
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47261

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

#to_jsonObject



47253
47254
47255
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47253

def to_json
  JSON.dump(to_hash)
end