Class: Pdf::Label::Speedee

Inherits:
BaseService
  • Object
show all
Includes:
Base
Defined in:
app/services/pdf/label/speedee.rb

Overview

Service object: speedee.

Defined Under Namespace

Classes: Result

Constant Summary collapse

LOGO_PATH =

Filesystem/URL path for logo.

Rails.root.join("data/images/spee-dee-logo-316x318.png").to_s.freeze
PAGE_W =

Label: 4 in wide × 6 in tall (portrait)

(4.0 * 72)
PAGE_H =

432 pt

(6.0 * 72)

Constants included from Base

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

Instance Method Summary collapse

Instance Method Details

#call(shipment, options = {}) ⇒ Result

Returns the generated PDF result.

Parameters:

  • shipment (Shipment)

    the shipment to generate the label for

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

    Options hash

Options Hash (options):

  • :signature_confirmation (Boolean)

    include signature confirmation

  • :sort_code (String)

    Spee-Dee sort code to print on the label

Returns:

  • (Result)

    the generated PDF result



22
23
24
25
26
# File 'app/services/pdf/label/speedee.rb', line 22

def call(shipment, options = {})
  Pdf::Loader.load!
  pdf = generate(shipment, options)
  Result.new(pdf: pdf, shipment: shipment, file_name: "#{shipment.reference_number}.pdf")
end