Class: Payday::Invoice

Inherits:
Object
  • Object
show all
Includes:
Invoiceable
Defined in:
lib/payday/invoice.rb

Overview

Basically just an invoice. Stick a ton of line items in it, add some details, and then render it out!

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Invoiceable

#each_detail, #overdue?, #paid?, #refunded?, #render_pdf, #render_pdf_to_file, #shipping, #subtotal, #tax, #total

Constructor Details

#initialize(options = {}) ⇒ Invoice

Returns a new instance of Invoice.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/payday/invoice.rb', line 9

def initialize(options =  {})
  self.invoice_number = options[:invoice_number] || nil
  self.bill_to = options[:bill_to] || nil
  self.ship_to = options[:ship_to] || nil
  self.notes = options[:notes] || nil
  self.line_items = options[:line_items] || []
  self.shipping_rate = options[:shipping_rate] || nil
  self.shipping_description = options[:shipping_description] || nil
  self.tax_rate = options[:tax_rate] || nil
  self.tax_description = options[:tax_description] || nil
  self.due_at = options[:due_at] || nil
  self.paid_at = options[:paid_at] || nil
  self.refunded_at = options[:refunded_at] || nil
  self.currency = options[:currency] || nil
  self.invoice_details = options[:invoice_details] || []
  self.invoice_date = options[:invoice_date] || nil
end

Instance Attribute Details

#bill_toObject

Returns the value of attribute bill_to.



6
7
8
# File 'lib/payday/invoice.rb', line 6

def bill_to
  @bill_to
end

#currencyObject

Returns the value of attribute currency.



6
7
8
# File 'lib/payday/invoice.rb', line 6

def currency
  @currency
end

#due_atObject

Returns the value of attribute due_at.



6
7
8
# File 'lib/payday/invoice.rb', line 6

def due_at
  @due_at
end

#invoice_dateObject

Returns the value of attribute invoice_date.



6
7
8
# File 'lib/payday/invoice.rb', line 6

def invoice_date
  @invoice_date
end

#invoice_detailsObject

Returns the value of attribute invoice_details.



6
7
8
# File 'lib/payday/invoice.rb', line 6

def invoice_details
  @invoice_details
end

#invoice_numberObject

Returns the value of attribute invoice_number.



6
7
8
# File 'lib/payday/invoice.rb', line 6

def invoice_number
  @invoice_number
end

#line_itemsObject

Returns the value of attribute line_items.



6
7
8
# File 'lib/payday/invoice.rb', line 6

def line_items
  @line_items
end

#notesObject

Returns the value of attribute notes.



6
7
8
# File 'lib/payday/invoice.rb', line 6

def notes
  @notes
end

Returns the value of attribute paid_at.



6
7
8
# File 'lib/payday/invoice.rb', line 6

def paid_at
  @paid_at
end

#refunded_atObject

Returns the value of attribute refunded_at.



6
7
8
# File 'lib/payday/invoice.rb', line 6

def refunded_at
  @refunded_at
end

#ship_toObject

Returns the value of attribute ship_to.



6
7
8
# File 'lib/payday/invoice.rb', line 6

def ship_to
  @ship_to
end

#shipping_descriptionObject

Returns the value of attribute shipping_description.



6
7
8
# File 'lib/payday/invoice.rb', line 6

def shipping_description
  @shipping_description
end

#shipping_rateObject

Returns the value of attribute shipping_rate.



6
7
8
# File 'lib/payday/invoice.rb', line 6

def shipping_rate
  @shipping_rate
end

#tax_descriptionObject

Returns the value of attribute tax_description.



6
7
8
# File 'lib/payday/invoice.rb', line 6

def tax_description
  @tax_description
end

#tax_rateObject

Returns the value of attribute tax_rate.



6
7
8
# File 'lib/payday/invoice.rb', line 6

def tax_rate
  @tax_rate
end