Class: Io::Flow::V0::Models::AllocationLineSummaryShipping

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

Overview

A simplified view on order financial details. Represents the shipping details for an order.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ AllocationLineSummaryShipping

Returns a new instance of AllocationLineSummaryShipping.



30298
30299
30300
30301
30302
30303
30304
30305
30306
30307
30308
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30298

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:subtotal, :discount, :duties, :tax, :tax_subsidy, :duties_subsidy, :total], 'AllocationLineSummaryShipping')
  @subtotal = (x = opts.delete(:subtotal); x.is_a?(::Io::Flow::V0::Models::MoneyWithBase) ? x : ::Io::Flow::V0::Models::MoneyWithBase.new(x))
  @discount = (x = opts.delete(:discount); x.is_a?(::Io::Flow::V0::Models::MoneyWithBase) ? x : ::Io::Flow::V0::Models::MoneyWithBase.new(x))
  @duties = (x = opts.delete(:duties); x.is_a?(::Io::Flow::V0::Models::MoneyWithBase) ? x : ::Io::Flow::V0::Models::MoneyWithBase.new(x))
  @tax = (x = opts.delete(:tax); x.is_a?(::Io::Flow::V0::Models::MoneyWithBase) ? x : ::Io::Flow::V0::Models::MoneyWithBase.new(x))
  @tax_subsidy = (x = opts.delete(:tax_subsidy); x.is_a?(::Io::Flow::V0::Models::MoneyWithBase) ? x : ::Io::Flow::V0::Models::MoneyWithBase.new(x))
  @duties_subsidy = (x = opts.delete(:duties_subsidy); x.is_a?(::Io::Flow::V0::Models::MoneyWithBase) ? x : ::Io::Flow::V0::Models::MoneyWithBase.new(x))
  @total = (x = opts.delete(:total); x.is_a?(::Io::Flow::V0::Models::MoneyWithBase) ? x : ::Io::Flow::V0::Models::MoneyWithBase.new(x))
end

Instance Attribute Details

#discountObject (readonly)

Returns the value of attribute discount.



30296
30297
30298
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30296

def discount
  @discount
end

#dutiesObject (readonly)

Returns the value of attribute duties.



30296
30297
30298
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30296

def duties
  @duties
end

#duties_subsidyObject (readonly)

Returns the value of attribute duties_subsidy.



30296
30297
30298
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30296

def duties_subsidy
  @duties_subsidy
end

#subtotalObject (readonly)

Returns the value of attribute subtotal.



30296
30297
30298
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30296

def subtotal
  @subtotal
end

#taxObject (readonly)

Returns the value of attribute tax.



30296
30297
30298
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30296

def tax
  @tax
end

#tax_subsidyObject (readonly)

Returns the value of attribute tax_subsidy.



30296
30297
30298
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30296

def tax_subsidy
  @tax_subsidy
end

#totalObject (readonly)

Returns the value of attribute total.



30296
30297
30298
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30296

def total
  @total
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



30314
30315
30316
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30314

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

#to_hashObject



30318
30319
30320
30321
30322
30323
30324
30325
30326
30327
30328
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30318

def to_hash
  {
    :subtotal => subtotal.to_hash,
    :discount => discount.to_hash,
    :duties => duties.to_hash,
    :tax => tax.to_hash,
    :tax_subsidy => tax_subsidy.to_hash,
    :duties_subsidy => duties_subsidy.to_hash,
    :total => total.to_hash
  }
end

#to_jsonObject



30310
30311
30312
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30310

def to_json
  JSON.dump(to_hash)
end