Class: Workarea::BogusCarrier

Inherits:
ActiveShipping::Workarea show all
Defined in:
lib/workarea/bogus_carrier.rb

Constant Summary collapse

MESSAGE =
'SUCCESS - 0000 Success'

Instance Method Summary collapse

Methods inherited from ActiveShipping::Workarea

#find_rates

Instance Method Details

#create_shipment(origin, destination, packages, options = {}) ⇒ Object



5
6
7
8
# File 'lib/workarea/bogus_carrier.rb', line 5

def create_shipment(origin, destination, packages, options = {})
  labels = [ActiveShipping::Label.new(generate_tracking_number, image)]
  ActiveShipping::LabelResponse.new(true, MESSAGE, {}, labels: labels)
end

#generate_tracking_numberObject



10
11
12
# File 'lib/workarea/bogus_carrier.rb', line 10

def generate_tracking_number
  "1ZX1A#{Array.new(13) { rand(0..9) }.join}"
end

#imageObject



14
15
16
# File 'lib/workarea/bogus_carrier.rb', line 14

def image
  IO.read(Core::Engine.root.join('test', 'fixtures', 'label.png'))
end