Class: Quote::LetterPdfGeneratorLegacy

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

Overview

Service object: letter pdf generator (LEGACY pre-modernization layout).
Preserved verbatim so we can fall back / compare if the modernized
Quote::LetterPdfGenerator needs to be reverted. Not wired into any caller.

Defined Under Namespace

Classes: Result

Constant Summary collapse

BRAND_COLOR =

Brand color.

'd4690e'.freeze

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 Attribute Summary

Attributes inherited from BaseService

#options

Instance Method Summary collapse

Methods inherited from BaseService

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

Constructor Details

This class inherits a constructor from BaseService

Instance Method Details

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

Renders the quote letter PDF.

Parameters:

  • quote (Quote)

    quote to render

  • options (Hash) (defaults to: {})

    rendering options (see #normalize_options)

Options Hash (options):

  • :show_line_items (Boolean)

    render per-room line items (default true)

  • :show_suggested_services (Boolean)

    render SmartInstall/SmartGuide sections (default true)

  • :show_suggested_add_ons (Boolean)

    render the add-ons table (default true)

  • :show_ordering_information (Boolean)

    render ordering info (default true)

  • :suggested_items (Array)

    suggested items grouped by room configuration

  • :suggested_services (Array)

    suggested service line items

  • :show_room_summary (Boolean)

    render the room summary page (default false)

  • :condensed_text (Boolean)

    use condensed copy (default false)

  • :show_discount_breakdown (Boolean)

    itemize discounts (default false)

  • :proforma_invoice (Boolean)

    render as a pro forma invoice (default false)

  • :include_addendums (Boolean)

    append addendums (default false)

Returns:

  • (Result)

    generated PDF string and the source quote



34
35
36
37
38
39
40
41
42
# File 'app/services/quote/letter_pdf_generator_legacy.rb', line 34

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