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



26517
26518
26519
26520
26521
26522
26523
26524
26525
26526
26527
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26517

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.



26515
26516
26517
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26515

def discount
  @discount
end

#dutiesObject (readonly)

Returns the value of attribute duties.



26515
26516
26517
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26515

def duties
  @duties
end

#duties_subsidyObject (readonly)

Returns the value of attribute duties_subsidy.



26515
26516
26517
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26515

def duties_subsidy
  @duties_subsidy
end

#subtotalObject (readonly)

Returns the value of attribute subtotal.



26515
26516
26517
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26515

def subtotal
  @subtotal
end

#taxObject (readonly)

Returns the value of attribute tax.



26515
26516
26517
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26515

def tax
  @tax
end

#tax_subsidyObject (readonly)

Returns the value of attribute tax_subsidy.



26515
26516
26517
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26515

def tax_subsidy
  @tax_subsidy
end

#totalObject (readonly)

Returns the value of attribute total.



26515
26516
26517
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26515

def total
  @total
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



26533
26534
26535
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26533

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

#to_hashObject



26537
26538
26539
26540
26541
26542
26543
26544
26545
26546
26547
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26537

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



26529
26530
26531
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26529

def to_json
  JSON.dump(to_hash)
end