Class: Io::Flow::V0::Models::OrderQuoteSummaryShipping

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 = {}) ⇒ OrderQuoteSummaryShipping

Returns a new instance of OrderQuoteSummaryShipping.



53502
53503
53504
53505
53506
53507
53508
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53502

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:total], 'OrderQuoteSummaryShipping')
  @total = (x = opts.delete(:total); x.is_a?(::Io::Flow::V0::Models::OrderQuotePrice) ? x : ::Io::Flow::V0::Models::OrderQuotePrice.from_json(x))
  @freight = (x = opts.delete(:freight); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::OrderQuoteSummaryShippingFreight) ? x : ::Io::Flow::V0::Models::OrderQuoteSummaryShippingFreight.new(x)))
  @surcharges = (x = opts.delete(:surcharges); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::OrderQuoteSummaryShippingSurcharges) ? x : ::Io::Flow::V0::Models::OrderQuoteSummaryShippingSurcharges.new(x)))
end

Instance Attribute Details

#freightObject (readonly)

Returns the value of attribute freight.



53500
53501
53502
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53500

def freight
  @freight
end

#surchargesObject (readonly)

Returns the value of attribute surcharges.



53500
53501
53502
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53500

def surcharges
  @surcharges
end

#totalObject (readonly)

Returns the value of attribute total.



53500
53501
53502
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53500

def total
  @total
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



53514
53515
53516
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53514

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

#to_hashObject



53518
53519
53520
53521
53522
53523
53524
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53518

def to_hash
  {
    :total => total.to_hash,
    :freight => freight.nil? ? nil : freight.to_hash,
    :surcharges => surcharges.nil? ? nil : surcharges.to_hash
  }
end

#to_jsonObject



53510
53511
53512
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53510

def to_json
  JSON.dump(to_hash)
end