2013-02-25 14:11:13 -08:00
|
|
|
package DDG::Goodie::IPS;
|
2014-08-20 11:45:33 -07:00
|
|
|
# ABSTRACT: track a package through IPS.
|
2013-02-25 14:11:13 -08:00
|
|
|
|
2015-02-22 12:09:29 -08:00
|
|
|
use strict;
|
2013-02-25 14:11:13 -08:00
|
|
|
use DDG::Goodie;
|
|
|
|
|
|
|
|
zci is_cached => 1;
|
|
|
|
zci answer_type => "ips";
|
|
|
|
|
2013-03-18 12:44:28 -07:00
|
|
|
primary_example_queries 'EM999999999IN';
|
|
|
|
description 'Track a package from IPS';
|
|
|
|
name 'IPS';
|
|
|
|
code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/IPS.pm';
|
|
|
|
category 'ids';
|
|
|
|
topics 'special_interest';
|
2015-01-07 10:37:42 -08:00
|
|
|
attribution github => [ 'https://github.com/duckduckgo', 'duckduckgo'];
|
2013-03-18 12:44:28 -07:00
|
|
|
|
|
|
|
triggers query_nowhitespace_nodash => qr/(E[MA]\d{9})(IN|HR|)/xi;
|
2013-02-25 14:11:13 -08:00
|
|
|
|
|
|
|
handle query_nowhitespace_nodash => sub {
|
|
|
|
my $package_number = $1 . $2;
|
|
|
|
my $country = lc $2 || '';
|
|
|
|
|
|
|
|
my $tmp_link = '';
|
|
|
|
|
|
|
|
if ( $country eq 'in' ) {
|
|
|
|
$tmp_link = "http://ipsweb.ptcmysore.gov.in/ipswebtracking/IPSWeb_item_events.asp?itemid=$package_number&Submit=Submit";
|
|
|
|
}
|
|
|
|
elsif ( $country eq 'hr' ) {
|
|
|
|
$tmp_link = "http://ips.posta.hr/IPSWeb_item_events.asp?itemid=$package_number&Submit=Submit";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$tmp_link = "http://mailtracking.gov.bm/IPSWeb_item_events.asp?itemid=$package_number&Submit=Submit+Query";
|
|
|
|
}
|
|
|
|
if ($tmp_link) {
|
2013-03-09 14:09:28 -08:00
|
|
|
return $package_number, heading => "IPS Shipment Tracking", html => qq(Track this shipment at <a href="$tmp_link">IPS</a>.);
|
2013-02-25 14:11:13 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
};
|
|
|
|
|
2014-08-20 11:45:33 -07:00
|
|
|
1;
|