Class: Quote::LetterPdfGenerator

Inherits:
BaseService show all
Includes:
Pdf::Base
Defined in:
app/services/quote/letter_pdf_generator.rb

Defined Under Namespace

Classes: Result

Constant Summary collapse

BRAND_COLOR =
'd4690e'

Constants included from Pdf::Base

Pdf::Base::FONT, Pdf::Base::NIMBUS_SANS_PATH, Pdf::Base::NIMBUS_SANS_PATH_BOLD, Pdf::Base::WY_LOGO_PATH

Instance Method Summary collapse

Methods inherited from BaseService

#initialize, #log_debug, #log_error, #log_info, #log_warning, #logger, #options, #tagged_logger

Constructor Details

This class inherits a constructor from BaseService

Instance Method Details

#process(quote, options = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'app/services/quote/letter_pdf_generator.rb', line 10

def process(quote, options = {})
  opts = normalize_options(options)
  composer = build_composer
  draw_body(composer, quote, opts)
  insert_headers_and_footers(composer, quote, opts)
  io = StringIO.new
  composer.write(io, optimize: true)
  Result.new(pdf: io.string, quote: quote)
end