Class: Dorsale::BillingMachine::Invoice::Copy
- Defined in:
- app/services/dorsale/billing_machine/invoice/copy.rb
Instance Attribute Summary collapse
-
#copy ⇒ Object
Returns the value of attribute copy.
-
#invoice ⇒ Object
Returns the value of attribute invoice.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(invoice) ⇒ Copy
constructor
A new instance of Copy.
Methods inherited from Service
Constructor Details
#initialize(invoice) ⇒ Copy
Returns a new instance of Copy.
4 5 6 |
# File 'app/services/dorsale/billing_machine/invoice/copy.rb', line 4 def initialize(invoice) @invoice = invoice end |
Instance Attribute Details
#copy ⇒ Object
Returns the value of attribute copy.
2 3 4 |
# File 'app/services/dorsale/billing_machine/invoice/copy.rb', line 2 def copy @copy end |
#invoice ⇒ Object
Returns the value of attribute invoice.
2 3 4 |
# File 'app/services/dorsale/billing_machine/invoice/copy.rb', line 2 def invoice @invoice end |
Instance Method Details
#call ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/services/dorsale/billing_machine/invoice/copy.rb', line 8 def call @copy = invoice.dup @invoice.lines.each do |line| @copy.lines << line.dup end @copy.date = Time.zone.now.to_date @copy.due_date = Time.zone.now.to_date + 30.days @copy.unique_index = nil @copy.paid = false @copy end |