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.



53410
53411
53412
53413
53414
53415
53416
53417
53418
53419
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53410

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.



53408
53409
53410
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53408

def balance
  @balance
end

#dutyObject (readonly)

Returns the value of attribute duty.



53408
53409
53410
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53408

def duty
  @duty
end

#itemsObject (readonly)

Returns the value of attribute items.



53408
53409
53410
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53408

def items
  @items
end

#shippingObject (readonly)

Returns the value of attribute shipping.



53408
53409
53410
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53408

def shipping
  @shipping
end

#taxObject (readonly)

Returns the value of attribute tax.



53408
53409
53410
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53408

def tax
  @tax
end

#totalObject (readonly)

Returns the value of attribute total.



53408
53409
53410
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53408

def total
  @total
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



53425
53426
53427
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53425

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

#to_hashObject



53429
53430
53431
53432
53433
53434
53435
53436
53437
53438
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53429

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



53421
53422
53423
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53421

def to_json
  JSON.dump(to_hash)
end