README.rdoc in trackerific-0.1.2 vs README.rdoc in trackerific-0.2.0

- old
+ new

@@ -6,12 +6,12 @@ bundle install == Usage: # Track a FedEx package: - fedex = Trackerific::FedEx.new :account => '123456789', :meter => '123456789', :key => 'kQdEJwuHBjtQ7g2', :password => 'qqPpiRoE5WdsMO78j8j5GRdoI' - tracking_info = fedex.track_package('999999999999') + fedex = Trackerific::FedEx.new :account => '123456789', :meter => '123456789' + tracking_info = fedex.track_package('183689015000001') # Track a USPS package: usps = Trackerific::USPS.new :user_id => '123USERID4567' tracking_info = usps.track_package('EJ958083578US') @@ -19,11 +19,12 @@ ups = Trackerific::UPS.new :user_id => 'userid', :key => 'kQdEJwuHBjtQ7g2', :password => 'secret' tracking_info = ups.track_package('1Z12345E0291980793') === Tracking Results -The tracking results for all three providers are returned in a Hash in this format: +The tracking results for all three providers are returned in a Hash in this +format: { :package_id => 'the package id being tracked', :summary => 'summary of the tracking results', :details => ['array containing each tracking status by date'] @@ -41,28 +42,48 @@ Your item was delivered at 8:10 am on June 1 in Wilmington DE 19801. * May 30 11:07 am NOTICE LEFT WILMINGTON DE 19801. * May 30 10:08 am ARRIVAL AT UNIT WILMINGTON DE 19850. * May 29 9:55 am ACCEPT OR PICKUP EDGEWATER NJ 07020. +=== Finding a Tracking Service Provider + +If you do not know the tracking service provider of a package id, you can use +the tracking_service helper method to get a Trackerific class that most likely +will be able to track the given package id. + + include Trackerific + tracking_service "183689015000001" # => Trackerific::FedEx + tracking_service "1Z12345E0291980793" # => Trackerific::UPS + tracking_service "EJ958083578US" # => Trackerific::USPS + tracking_service "unknown package id" # => nil + === Exception handling: -Exception handling is esssential for tracking packages. If, for example, you enter the wrong number, or the tracking provider has yet to have added the tracking number to their system, a Trackerific::Error will be raised. Here's an example on how to handle Trackerific::Errors: +Exception handling is esssential for tracking packages. If, for example, +you enter the wrong number, or the tracking provider has yet to have added the +tracking number to their system, a Trackerific::Error will be raised. Here's an +example on how to handle Trackerific::Errors: begin usps.track_package('EJ958083578US') rescue Trackerific::Error => e puts e.message end == Contributing to trackerific -* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet -* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it +* Check out the latest master to make sure the feature hasn't been implemented +or the bug hasn't been fixed yet +* Check out the issue tracker to make sure someone already hasn't requested it +and/or contributed it * Fork the project * Start a feature/bugfix branch * Commit and push until you are happy with your contribution -* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally. -* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it. +* Make sure to add tests for it. This is important so I don't break it in a +future version unintentionally. +* Please try not to mess with the Rakefile, version, or history. If you want to +have your own version, or is otherwise necessary, that is fine, but please +isolate to its own commit so I can cherry-pick around it. == Copyright Copyright (c) 2011 Travis Haynes. See LICENSE.txt for further details.