0.0
No commit activity in last 3 years
No release in over 3 years
PackageTracker is a ruby gem for fetching the status of a packages(UPS, FedEx, etc...) with a simple API.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.0.0
~> 1.6.0
>= 0
~> 2.6.0

Runtime

 Project Readme

PackageTracker¶ ↑

PackageTracker is a ruby gem for fetching the status of a packages(UPS, FedEx, etc…) with a simple API. Currently only UPS, FedEx and USPS are supported. More docs and carrier support to come soon…

Installation¶ ↑

To install:

gem install package_tracker

Usage¶ ↑

client = PackageTracker::Client.new(Yaml.load_file("credentials.yaml"))

fedex_package = client.track("999999999999")
# => PackageTracker::Response

fedex_package.delivered? 
# => true

fedex_package.statuses 
# => [{:message => "DELIVERED", :location => "San Francsico, CA, USA", :time => 2011-04-22 00:00:00 -0700}, ...]

ups_package = client.track("1Z9999999999999999")

# and so on...

Configuration¶ ↑

PackageTracker::Client::new takes a hash of credentials with the following parameters:

{
  :ups => {
    :key => "key"
    :user_id => "user id"
    :password => "password"
  },
  :fedex => {
    :password => "password",
    :key => "key",
    :account => "account",
    :meter => "meter number"
  },
  :usps => {
    :username => "username",
    :password => "password"
  }
}

It’s usually easiest to put those credentials in a YAML file and load them in. That makes it easy to keep your sensitive password info out of version control as well.

If you don’t want to use the built in tracking number detection, you can specify which carrier to use with a tracking request:

client.track("999999999999", :ups)
# Sent directly to ups api

If you just want to hit the carriers’ test servers, you can set your client to test mode:

client = PackageTracker::Client.new(Yaml.load_file("credentials.yaml"))

client.test_mode!
# all requests will now to to the carriers' test servers