Class: Dorsale::BillingMachine::PdfFileGenerator

Inherits:
Service
  • Object
show all
Defined in:
app/services/dorsale/billing_machine/pdf_file_generator.rb

Defined Under Namespace

Classes: StringIO

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Service

call

Constructor Details

#initialize(document) ⇒ PdfFileGenerator

Returns a new instance of PdfFileGenerator.



4
5
6
7
8
9
10
11
# File 'app/services/dorsale/billing_machine/pdf_file_generator.rb', line 4

def initialize(document)
  # I have no idea why I need to do that,
  # if I don't do that, CarrierWare do not stores the file.
  # The reload() method don't work either.
  # The problem appears only on server, not in console.
  # I think CarrierWave do not work anymore after first save.
  @document = document.class.find(document.id)
end

Instance Attribute Details

#documentObject (readonly)

Returns the value of attribute document.



2
3
4
# File 'app/services/dorsale/billing_machine/pdf_file_generator.rb', line 2

def document
  @document
end

Instance Method Details

#callObject



13
14
15
# File 'app/services/dorsale/billing_machine/pdf_file_generator.rb', line 13

def call
  document.update!(pdf_file: file)
end