Sha256: 520118568a65fd927b02ececc06eaf543ad79c05ab22a898f8969454b3b796a6
Contents?: true
Size: 851 Bytes
Versions: 117
Compression:
Stored size: 851 Bytes
Contents
# frozen_string_literal: true require_dependency "renalware/letters" require "fileutils" module Renalware module Letters # Used for example in a host app like renalware-kch to generate a PDF letter for saving to # the electronic public register class SavePdfLetterToFileJob < ApplicationJob queue_as :pdf_generation queue_with_priority 1 def perform(letter:, file_path:) file_path = Pathname(file_path) create_folder_if_not_exists(file_path) File.open(file_path, "wb") { |file| file << pdf_data_for(letter) } end def pdf_data_for(letter) letter = Renalware::Letters::LetterPresenter.new(letter) Renalware::Letters::PdfRenderer.call(letter) end def create_folder_if_not_exists(path) FileUtils.mkdir_p(path.dirname) end end end end
Version data entries
117 entries across 117 versions & 1 rubygems