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.



53474
53475
53476
53477
53478
53479
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53474

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.



53472
53473
53474
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53472

def lines
  @lines
end

#totalObject (readonly)

Returns the value of attribute total.



53472
53473
53474
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53472

def total
  @total
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



53485
53486
53487
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53485

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

#to_hashObject



53489
53490
53491
53492
53493
53494
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53489

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

#to_jsonObject



53481
53482
53483
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 53481

def to_json
  JSON.dump(to_hash)
end