Sha256: cba3ca145141645eeb3d511a3b697140fa73bff99f267838ede4c9e570c8bfcb

Contents?: true

Size: 1.5 KB

Versions: 2

Compression:

Stored size: 1.5 KB

Contents

= PackageTracker

PackageTracker is a ruby gem for fetching the status of a packages(UPS, FedEx, etc...) with a simple API.  Currently only UPS and FedEx 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_response = @client.track("999999999999")
    # => PackageTracker::Response
    
    fedex_response.delivered? 
    # => true
    
    fedex_response.statuses 
    # => [{:message => "DELIVERED", :location => "San Francsico, CA, USA", :time => 2011-04-22 00:00:00 -0700}, ...]
    
    ups_response = @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"
      }
    }
    
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 git as well.

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
package_tracker-0.0.3 README.rdoc
package_tracker-0.0.2 README.rdoc