Class: VertexClient::Response::QuotationFallback

Inherits:
Quotation
  • Object
show all
Defined in:
lib/vertex_client/responses/quotation_fallback.rb

Instance Method Summary collapse

Methods inherited from Quotation

#line_items

Constructor Details

#initialize(payload) ⇒ QuotationFallback

Returns a new instance of QuotationFallback.



5
6
7
# File 'lib/vertex_client/responses/quotation_fallback.rb', line 5

def initialize(payload)
  @body = payload.body
end

Instance Method Details

#subtotalObject



9
10
11
# File 'lib/vertex_client/responses/quotation_fallback.rb', line 9

def subtotal
  @subtotal || line_items.sum(&:price)
end

#totalObject



17
18
19
# File 'lib/vertex_client/responses/quotation_fallback.rb', line 17

def total
  @total ||= subtotal + total_tax
end

#total_taxObject



13
14
15
# File 'lib/vertex_client/responses/quotation_fallback.rb', line 13

def total_tax
  @total_tax ||= line_items.sum(&:total_tax).floor(2)
end