Search code examples
ruby-on-railsrubyruby-on-rails-plugins

Fedex & UPS implementation


I've been looking for a Ruby implementation of Fedex and UPS.

I've been through their documentation, and think it's really overcomplicated (I'm a bit of a ruby "newbie" myself), so was looking for something simpler. I would only like to use the tracking function.

Has anyone ever worked with something like that and could point me to the right direction on how to implement this?


Solution

  • Try Shopify's active_shipping plugin. It supports UPS, USPS, and FedEx. The developers are planning on adding tracking support (according to the readme), but support is already provided for FedEx tracking:

    fdx = FedEx.new(:login => '999999999', :password => '7777777')
    tracking_info = fdx.find_tracking_info('tracking number here', :carrier_code => 'fedex_ground') # Ground package
    
    tracking_info.shipment_events.each do |event|
      puts "#{event.name} at #{event.location.city}, #{event.location.state} on #{event.time}. #{event.message}"
    end
    # => Package information transmitted to FedEx at NASHVILLE LOCAL, TN on Thu Oct 23 00:00:00 UTC 2008. 
    # Picked up by FedEx at NASHVILLE LOCAL, TN on Thu Oct 23 17:30:00 UTC 2008. 
    # Scanned at FedEx sort facility at NASHVILLE, TN on Thu Oct 23 18:50:00 UTC 2008. 
    # Departed FedEx sort facility at NASHVILLE, TN on Thu Oct 23 22:33:00 UTC 2008. 
    # Arrived at FedEx sort facility at KNOXVILLE, TN on Fri Oct 24 02:45:00 UTC 2008. 
    # Scanned at FedEx sort facility at KNOXVILLE, TN on Fri Oct 24 05:56:00 UTC 2008. 
    # Delivered at Knoxville, TN on Fri Oct 24 16:45:00 UTC 2008. Signed for by: T.BAKER