Skip to content
febuiles edited this page Sep 12, 2010 · 4 revisions

ShippingCalc

  • http://github.com/febuiles/shipping_calc/
  • mailto:federico.builes@gmail.com

DESCRIPTION:

Shipping Calculator written in Ruby to get quick quotes from the major
carriers (UPS, DHL, FedEX, FreightQuote).

FEATURES/PROBLEMS:

- Current version only supports DHL and FreightQuote

SYNOPSIS:

You can find an example of each carrier’s API under the /examples directory.

A simple DHL example:

require ‘rubygems’
require ‘shipping_calc’

include ShippingCalc

opts = {
:api_user => “your_user”,
:api_password => “your_pwd”,
:shipping_key => “your_key”,
:account_num => “your_accnt”,
:date => Time.now, # or something…
:service_code => “E”, # check the docs to find out what this means
:shipment_code => “P”, # check the docs to find out what this means
:weight => 34, # weight in lbs
:to_zip => 10001,
:to_state => “NY”
}

d = DHL.new
a = d.quote(opts)
p a

REQUIREMENTS:

  • You must obtain all the DHL ShipIt data (user, password, key and account) from http://www.dhl-usa.com/TechTools/detail/TTDetail.asp?nav=TechnologyTools/Shipping/OwnSoln
  • REXML

INSTALL:

  • sudo gem install shipping-calc

TEST

To run the DHL tests you’ll need to have a .dhl_info.yml file in your home directory with your auth info like this:
~/.dhl_info.yml

api_user: your_user api_password: your_password shipping_key: your_key account_num: your_accnt_num

This is necessary only for the tests and it’ll be ignored for the actual
usage of the the library.

Clone this wiki locally