Class: Dorsale::BillingMachine::Quotation::Copy
- Defined in:
- app/services/dorsale/billing_machine/quotation/copy.rb
Instance Attribute Summary collapse
-
#copy ⇒ Object
Returns the value of attribute copy.
-
#quotation ⇒ Object
Returns the value of attribute quotation.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(quotation) ⇒ Copy
constructor
A new instance of Copy.
Methods inherited from Service
Constructor Details
#initialize(quotation) ⇒ Copy
Returns a new instance of Copy.
4 5 6 |
# File 'app/services/dorsale/billing_machine/quotation/copy.rb', line 4 def initialize(quotation) @quotation = quotation end |
Instance Attribute Details
#copy ⇒ Object
Returns the value of attribute copy.
2 3 4 |
# File 'app/services/dorsale/billing_machine/quotation/copy.rb', line 2 def copy @copy end |
#quotation ⇒ Object
Returns the value of attribute quotation.
2 3 4 |
# File 'app/services/dorsale/billing_machine/quotation/copy.rb', line 2 def quotation @quotation end |
Instance Method Details
#call ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/services/dorsale/billing_machine/quotation/copy.rb', line 8 def call @copy = quotation.dup @quotation.lines.each do |line| @copy.lines << line.dup end @copy.unique_index = nil @copy.created_at = nil @copy.updated_at = nil @copy.date = Time.zone.now.to_date @copy.state = ::Dorsale::BillingMachine::Quotation::STATES.first @copy.save! @quotation..each do || = .dup .attachable = @copy .file = File.open(.file.path) .save! end @copy end |