Check your parcel status and history by providing a inpost parcel tracking number
Add this line to your application's Gemfile:
gem 'inpost_parcels_tracker'
And then execute:
$ bundle
Or install it yourself as:
$ gem install inpost_parcels_tracker
Inpost::Parcel.new('111111111111111111111111').track
example success response :
=>
{:tracking_number=>"111111111111111111111111", :type=>"inpost_locker_standard", :custom_attributes=>{:target_machine_id=>"XXXXXX"}, :status=>"ready_to_pickup", :tracking_details=>
[
{:status=>"ready_to_pickup", :origin_status=>"XXX", :datetime=>"datetime"},
{:status=>"out_for_delivery", :origin_status=>"XXX", :datetime=>"datetime"},
{:status=>"adopted_at_source_branch", :origin_status=>"XXX", :datetime=>"datetime"},
{:status=>"confirmed", :origin_status=>"PPN", :datetime=>"datetime"}
],
:expected_flow=>[], :created_at=>"datetime", :updated_at=>"datetime"}
example fail responses :
too short tracking_code provided
Inpost::Parcel.new('1111111111111111111').track
RuntimeError: Invalid tracking code provided
Inpost::Parcel.new(nil).track
RuntimeError: Tracking code cannot be nil
Parcels tracking information storage gets eventually deleted from Inpost servers. This is what eventually will be returned:
Inpost::Parcel.new('222222222222222222222222').track
=> {:status=>404, :error=>"resource_not_found",
:message=>"Tracking information about 222222222222222222222222 shipment has not been found.",
:details=>{}}
Bug reports and pull requests are welcome on GitHub at https://github.com/justcodeio/inpost_parcels_tracker. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.