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
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.
Timeline
- Liquid Template Tags
- Advanced Solr Filters with Phonetics
- Advanced db_free_solr
- "Fixing" acts_as_solr
- USPS Package Tracking
- Setting up rmagick on Ubuntu
- Spec refactoring
- replaceaface.com beta ultra version 0.113 build 18.2
- Executing Shell Commands in Ruby
- Tutorial - Red5, AS3, FC4, and Shared Fridge Magnets!
Comments
The SVN doesn’t have a usps_track folder?
Nice plugin , but there is indeed no usps_track folder on the SVN repository.
Sorry, I’ve fixed that. Try again now. :)
it looks nice to me, however, does it only track the current position, or all destinations the packege went through..?