Class: Io::Flow::V0::Models::OrderQuoteSummaryItems

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

Returns a new instance of OrderQuoteSummaryItems.



47501
47502
47503
47504
47505
47506
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47501

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:lines, :total], 'OrderQuoteSummaryItems')
  @lines = HttpClient::Preconditions.assert_class('lines', opts.delete(:lines), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::OrderQuoteLine) ? x : ::Io::Flow::V0::Models::OrderQuoteLine.new(x)) }
  @total = (x = opts.delete(:total); x.is_a?(::Io::Flow::V0::Models::OrderQuotePrice) ? x : ::Io::Flow::V0::Models::OrderQuotePrice.from_json(x))
end

Instance Attribute Details

#linesObject (readonly)

Returns the value of attribute lines.



47499
47500
47501
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47499

def lines
  @lines
end

#totalObject (readonly)

Returns the value of attribute total.



47499
47500
47501
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47499

def total
  @total
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



47512
47513
47514
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47512

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

#to_hashObject



47516
47517
47518
47519
47520
47521
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47516

def to_hash
  {
    :lines => lines.map { |o| o.to_hash },
    :total => total.to_hash
  }
end

#to_jsonObject



47508
47509
47510
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47508

def to_json
  JSON.dump(to_hash)
end