Class: Io::Flow::V0::Models::AllocationLineSummaryLineItem

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

Overview

A simplified view on order financial details. Represents a single line on an order.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ AllocationLineSummaryLineItem

Returns a new instance of AllocationLineSummaryLineItem.



30254
30255
30256
30257
30258
30259
30260
30261
30262
30263
30264
30265
30266
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30254

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:item_number, :subtotal, :discount, :duties, :tax, :tax_subsidy, :duties_subsidy, :total], 'AllocationLineSummaryLineItem')
  @item_number = HttpClient::Preconditions.assert_class('item_number', opts.delete(:item_number), String)
  @line_number = (x = opts.delete(:line_number); x.nil? ? nil : HttpClient::Preconditions.assert_class('line_number', x, String))
  @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.



30252
30253
30254
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30252

def discount
  @discount
end

#dutiesObject (readonly)

Returns the value of attribute duties.



30252
30253
30254
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30252

def duties
  @duties
end

#duties_subsidyObject (readonly)

Returns the value of attribute duties_subsidy.



30252
30253
30254
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30252

def duties_subsidy
  @duties_subsidy
end

#item_numberObject (readonly)

Returns the value of attribute item_number.



30252
30253
30254
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30252

def item_number
  @item_number
end

#line_numberObject (readonly)

Returns the value of attribute line_number.



30252
30253
30254
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30252

def line_number
  @line_number
end

#subtotalObject (readonly)

Returns the value of attribute subtotal.



30252
30253
30254
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30252

def subtotal
  @subtotal
end

#taxObject (readonly)

Returns the value of attribute tax.



30252
30253
30254
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30252

def tax
  @tax
end

#tax_subsidyObject (readonly)

Returns the value of attribute tax_subsidy.



30252
30253
30254
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30252

def tax_subsidy
  @tax_subsidy
end

#totalObject (readonly)

Returns the value of attribute total.



30252
30253
30254
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30252

def total
  @total
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



30272
30273
30274
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30272

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

#to_hashObject



30276
30277
30278
30279
30280
30281
30282
30283
30284
30285
30286
30287
30288
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30276

def to_hash
  {
    :item_number => item_number,
    :line_number => line_number,
    :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



30268
30269
30270
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30268

def to_json
  JSON.dump(to_hash)
end