Class: Io::Flow::V0::Models::OrderQuoteSummary

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ OrderQuoteSummary

Returns a new instance of OrderQuoteSummary.



47437
47438
47439
47440
47441
47442
47443
47444
47445
47446
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47437

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:items, :total, :balance], 'OrderQuoteSummary')
  @items = (x = opts.delete(:items); x.is_a?(::Io::Flow::V0::Models::OrderQuoteSummaryItems) ? x : ::Io::Flow::V0::Models::OrderQuoteSummaryItems.new(x))
  @shipping = (x = opts.delete(:shipping); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::OrderQuoteSummaryShipping) ? x : ::Io::Flow::V0::Models::OrderQuoteSummaryShipping.new(x)))
  @tax = (x = opts.delete(:tax); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::OrderQuoteSummaryTax) ? x : ::Io::Flow::V0::Models::OrderQuoteSummaryTax.new(x)))
  @duty = (x = opts.delete(:duty); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::OrderQuoteSummaryDuty) ? x : ::Io::Flow::V0::Models::OrderQuoteSummaryDuty.new(x)))
  @total = (x = opts.delete(:total); x.is_a?(::Io::Flow::V0::Models::OrderQuoteSummaryTotal) ? x : ::Io::Flow::V0::Models::OrderQuoteSummaryTotal.new(x))
  @balance = (x = opts.delete(:balance); x.is_a?(::Io::Flow::V0::Models::OrderQuotePrice) ? x : ::Io::Flow::V0::Models::OrderQuotePrice.from_json(x))
end

Instance Attribute Details

#balanceObject (readonly)

Returns the value of attribute balance.



47435
47436
47437
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47435

def balance
  @balance
end

#dutyObject (readonly)

Returns the value of attribute duty.



47435
47436
47437
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47435

def duty
  @duty
end

#itemsObject (readonly)

Returns the value of attribute items.



47435
47436
47437
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47435

def items
  @items
end

#shippingObject (readonly)

Returns the value of attribute shipping.



47435
47436
47437
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47435

def shipping
  @shipping
end

#taxObject (readonly)

Returns the value of attribute tax.



47435
47436
47437
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47435

def tax
  @tax
end

#totalObject (readonly)

Returns the value of attribute total.



47435
47436
47437
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47435

def total
  @total
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



47452
47453
47454
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47452

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

#to_hashObject



47456
47457
47458
47459
47460
47461
47462
47463
47464
47465
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47456

def to_hash
  {
    :items => items.to_hash,
    :shipping => shipping.nil? ? nil : shipping.to_hash,
    :tax => tax.nil? ? nil : tax.to_hash,
    :duty => duty.nil? ? nil : duty.to_hash,
    :total => total.to_hash,
    :balance => balance.to_hash
  }
end

#to_jsonObject



47448
47449
47450
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47448

def to_json
  JSON.dump(to_hash)
end