class Shipment < ActiveRecord::Base
  belongs_to :order

  enum shipping_carrier: %i(fedex usps ups)

  def tracking_url
    case shipping_carrier.to_sym
    when :ups
      "https://wwwapps.ups.com/WebTracking/track?track=yes&trackNums=#{tracking_number}&loc=en_us"
    when :usps
      "https://tools.usps.com/go/TrackConfirmAction.action?tRef=fullpage&tLc=1&text28777=&tLabels=#{tracking_number}"
    when :fedex
      "https://www.fedex.com/apps/fedextrack/?tracknumbers=#{tracking_number}"
    end
  end
end

class Shipment < ActiveRecord::Base
  belongs_to :order

  enum shipping_carrier: %i(fedex usps ups)

  def tracking_url
    case shipping_carrier
    when 'ups'
      "https://wwwapps.ups.com/WebTracking/track?track=yes&trackNums=#{tracking_number}&loc=en_us"
    when 'usps'
      "https://tools.usps.com/go/TrackConfirmAction.action?tRef=fullpage&tLc=1&text28777=&tLabels=#{tracking_number}"
    when 'fedex'
      "https://www.fedex.com/apps/fedextrack/?tracknumbers=#{tracking_number}"
    end
  end
end

Change shipping carrier switch to string
Change shipping carrier switch to string
