Class: Spina::Shop::InvoicePresenter

Inherits:
Object
  • Object
show all
Defined in:
app/presenters/spina/shop/invoice_presenter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(invoice, view_context) ⇒ InvoicePresenter

Returns a new instance of InvoicePresenter.



8
9
10
11
# File 'app/presenters/spina/shop/invoice_presenter.rb', line 8

def initialize(invoice, view_context)
  @invoice = invoice
  @view_context = view_context
end

Instance Attribute Details

#invoiceObject

Returns the value of attribute invoice.



3
4
5
# File 'app/presenters/spina/shop/invoice_presenter.rb', line 3

def invoice
  @invoice
end

#view_contextObject

Returns the value of attribute view_context.



3
4
5
# File 'app/presenters/spina/shop/invoice_presenter.rb', line 3

def view_context
  @view_context
end

Instance Method Details

#order_numberObject



21
22
23
# File 'app/presenters/spina/shop/invoice_presenter.rb', line 21

def order_number
  invoice.order.try(:number)
end

#payment_methodObject



25
26
27
# File 'app/presenters/spina/shop/invoice_presenter.rb', line 25

def payment_method
  invoice.order.try(:payment_method)
end

#sub_totalObject



13
14
15
# File 'app/presenters/spina/shop/invoice_presenter.rb', line 13

def sub_total
  view_context.number_to_currency(invoice.sub_total)
end

#totalObject



17
18
19
# File 'app/presenters/spina/shop/invoice_presenter.rb', line 17

def total
  view_context.number_to_currency(invoice.total)
end