Dave Bullock / eecue

photographer, director of engineering: crowdrise, photojournalist, hacker, nerd, geek, human

FedEx Shipping with Rails

Today I created a Ruby on Rails module to calculate shipping from FedEx. I based it on a similar module from Ben Curtis which he wrote to calculate UPS shipping.

We both based our modules on the Shipping ruby gem, which hasn't been updated in several years and no longer works with the current version of Rails as far as I can tell.

My module is pretty straight forward, you feed it your zipcode, total weight and number of boxes and it gives you an array of prices and methods available from FedEx. You call it like this:

fedex = FEDEX::Client.new :account =>  '1000000', :meter =>  " 1000" ,
  :origin_zip =>  '90000', :url =>  'https://gateway.fedex.com/GatewayDC'
fedex_quote = fedex.rate_list '80000', '500', '20'

You can check out and download my FedEx shipping calculator module here on pastie.