Class: Spree::ShippingLabels::StoreFileJob

Inherits:
BaseJob
  • Object
show all
Defined in:
app/jobs/spree/shipping_labels/store_file_job.rb

Overview

Retries fetching a purchased label's file when the fetch right after purchase failed — the carrier's hosted copy is usually there a moment later. Idempotent: an already-attached file is left alone.

Constant Summary

Constants inherited from BaseJob

BaseJob::TRANSIENT_ERRORS

Instance Method Summary collapse

Instance Method Details

#perform(shipping_label_id) ⇒ Object

Parameters:

  • shipping_label_id (Integer)


10
11
12
13
14
# File 'app/jobs/spree/shipping_labels/store_file_job.rb', line 10

def perform(shipping_label_id)
  shipping_label = Spree::ShippingLabel.find(shipping_label_id)
  result = Spree.shipping_label_store_file_service.call(shipping_label: shipping_label)
  raise result.error.to_s if result.failure?
end