class SampleCardGeneratorLocal def initialize(process) @process = process end def call # SampleCard::DataFormatter.new(@process).call group_sample_cards_pdf = CombinePDF.new SampleIdCard.where(employer_name: @process.employer_name).each do |card| url = SampleCard::JasperUrlGenerator.new(@process, card.family_id).call puts url card_pdf = SampleCard::JasperPdfGenerator.new(url).call group_sample_cards_pdf << card_pdf end todays_date = DateTime.current.strftime('%Y%m%d%H%M%S') group_sample_cards_pdf.save("tmp/#{@process.employer_name}_sample_cards_#{todays_date}.pdf") group_sample_cards_pdf end end