1. Skip to navigation
  2. Skip to content

The ELC Community Blog

A knowledge exchange on Ruby on Rails and Agile Development


USPS Package Tracking

by Ariel H. Pillet on February 15, 2008

ELC Plugins

About

USPS Track is a plugin which allows you to track US Postal Service packages easily from your Rails app.

Installation

To get started, install it with the following command:

script/plugin install http://svn.elctech.com/svn/public/plugins/usps_track

Second, you'll need a USPS developer account:. You can register here

Usage

Initialize the class with your USPS username:

usps = ELC::USPS.new(username)

Track a package:

result = usps.track(tracking_number)

It returns an array of hashes with the following structure:

{ :eventstate   => "DE",
  :event        => "NOTICE LEFT",
  :eventzipcode => "19801",
  :eventtime    => "11:07 am",
  :eventdate    => "May 30, 2001",
  :eventcity    => "WILMINGTON" }

It's that simple! Please respond with any suggestions, comments or corrections.

Comments

Zach Inglis at

The SVN doesn’t have a usps_track folder?

Michel de Graaf at

Nice plugin , but there is indeed no usps_track folder on the SVN repository.

Ariel H. Pillet at

Sorry, I’ve fixed that. Try again now. :)

keli at

it looks nice to me, however, does it only track the current position, or all destinations the packege went through..?

Add a comment


home | services | Ruby on Rails Development | code | blog | company