Class: Shipping::CartonLabelGenerator

Inherits:
BaseService show all
Defined in:
app/services/shipping/carton_label_generator.rb

Defined Under Namespace

Classes: Result

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(shipment, options = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'app/services/shipping/carton_label_generator.rb', line 6

def process(shipment, options = {})
  # SSCC is a requirement for a carton label, generate it here
  if shipment.container_code.blank?
    shipment.set_sscc
    shipment.save
  end

  pdf = Pdf::Label::Carton.new(shipment, options).call
  Result.new(pdf: pdf, shipment: shipment, file_name: "#{shipment.reference_number}.pdf")
end