class Sunnyside::PrivateClient

Attributes

file[R]
post_date[R]

Public Class Methods

new(file, post_date) click to toggle source
# File lib/sunnyside/reports/private.rb, line 20
def initialize(file, post_date)
  @file      = file
  @post_date = post_date
end

Public Instance Methods

create_doc(client) click to toggle source
# File lib/sunnyside/reports/private.rb, line 29
def create_doc(client)
  Prawn::Document.generate("#{DRIVE}/sunnyside-files/pdf-reports/private/#{client}-#{post_date}.PDF", :skip_page_creation => true) { |pdf| 
    selected_pages(client).each { |page| pdf.start_new_page(:template => file, :template_page => page) }
  }
  puts "file #{client}-#{post_date}.PDF created in #{DRIVE}/sunnyside-files/pdf-reports/private" 
end
selected_pages(name) click to toggle source
# File lib/sunnyside/reports/private.rb, line 25
def selected_pages(name)
  PDF::Reader.new(file).pages.select { |page| page.text.include?(name) && page.text.include?('Client Copy') }.map { |page| page.number }
end