Class: Pdf::Document::ReturnInstructions
- Inherits:
-
BaseService
- Object
- BaseService
- Pdf::Document::ReturnInstructions
- Includes:
- Base
- Defined in:
- app/services/pdf/document/return_instructions.rb
Defined Under Namespace
Classes: Result
Constant Summary
Constants included from Base
Base::FONT, Base::NIMBUS_SANS_PATH, Base::NIMBUS_SANS_PATH_BOLD, Base::WY_LOGO_PATH
Instance Method Summary collapse
Instance Method Details
#call(rma, options = {}) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/services/pdf/document/return_instructions.rb', line 7 def call(rma, = {}) combined_pdf = PdfCombinator.new combined_pdf << generate_instructions_pdf(rma) rma.return_labels.each do |upload| combined_pdf << PdfCombinator.load(upload..path) end result_hsh = { rma: rma, options: , file_name: rma.instructions_file_name } if [:output_to_file] path = [:output_to_file_path] || File.join(Rails.application.config.x.temp_storage_path.to_s, result_hsh[:file_name]) combined_pdf.save(path) result_hsh[:pdf_file_path] = path else result_hsh[:pdf_data] = combined_pdf.to_pdf end Result.new(**result_hsh) end |