The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Shipment::Purolator

VERSION

version 2.03

SYNOPSIS

  use Shipment::Purolator;
  use Shipment::Address;
  use Shipment::Package;

  my $shipment = Shipment::Purolator->new(
    from_address => Shipment::Address->new( ... ),
    to_address => Shipment::Address->new( ... ),
    packages => [ Shipment::Package->new( ... ), ],
  );

  foreach my $service ( $shipment->all_services ) {
    print $service->id . "\n";
  }

  $shipment->rate( 'express' );
  print $shipment->service->cost . "\n";

  $shipment->ship( 'ground' );
  $shipment->get_package(0)->label->save;

NAME

Shipment::Purolator - Interface to Purolator Shipping Web Services

ABOUT

This class provides an interface to the Purolator E-Ship Web Services.

For code examples, see https://github.com/pullingshots/Shipment/tree/master/eg

You must sign up for a development key in order to make use of this module.

https://eship.purolator.com

See related modules for documentation on options and how to access rates and labels:

Shipment::Base - common attributes and methods for all interfaces Shipment::Address - define an from or to address Shipment::Package - define package details, weight, dimensions, etc Shipment::Service - access information about a service, rate, etd, etc Shipment::Label - access the label file

It makes extensive use of SOAP::WSDL in order to create/decode xml requests and responses. The Shipment::UPS::WSDL interface was created primarily using the wsdl2perl.pl script from SOAP::WSDL.

Class Attributes

key, password

Credentials required to access Puroator E-Ship Web Services

proxy_domain

This determines whether you will use the Purolator testing environment (for development) or the production (live) environment * devwebservices.purolator.com (development) * webservices.purolator.com (production)

Shipment::Base type maps

Shipment::Base provides abstract types which need to be mapped to Purolator codes (i.e. package_type of "custom" maps to Purolator "CustomerPackaging")

printer types

Purolator does not offer true thermal printing, all labels are provided as pdfs, thermal labels are simply a 4x6 pdf.

default currency

The default currency is CAD

Class Methods

_build_services

This calls GetServicesOptions from the Service Availability API

Each Service that is returned is added to services

The following service mapping is used: * ground => PurolatorGround (when shipping within the same city this gets mapped to PurolatorExpress) * express => PurolatorExpress * priority => PurolatorExpress9AM/10:30AM/12:00/Evening (exact service depends on what is available)

All of the available service options are placed in the service->options hashref

rate

This method calls GetFullEstimate from the Estimating API

ship

This calls CreateShipment from the Shipping API

It also calls fetch_documents which is a separate method since Purolator does not return the label along with the create shipment response.

fetch_documents

Calls GetDocuments from the Shipping Documents API

Purolator returns all of the labels and required documents in a single pdf. Because of this, for a multi-piece shipment, calling

  $shipment->get_package(0)->label-save;

will actually save a pdf file with all of the labels and documents. It is probably a better idea to make use of

  $shipment->documents->save

cancel

Calls VoidShipment from the Shipping API

For multi-piece shipments, any 1 of the related tracking id's can be in $shipment->tracking_id. All related packages will be voided. There is no way to void a single package within a multi-piece shipment.

returns "true" if successful

This depends on calling Consolidate from the Shipping API which has not been implemented yet

Calls GetShipmentManifestDocument from the Shipping Documents API

AUTHOR

Andrew Baerg @ <andrew at pullingshots dot ca>

http://pullingshots.ca/

BUGS

Issues can be submitted at https://github.com/pullingshots/Shipment/issues

COPYRIGHT

Copyright (C) 2016 Andrew J Baerg, All Rights Reserved

NO WARRANTY

Absolutely, positively NO WARRANTY, neither express or implied, is offered with this software. You use this software at your own risk. In case of loss, no person or entity owes you anything whatsoever. You have been warned.

LICENSE

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Andrew Baerg <baergaj@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2016 by Andrew Baerg.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.