Permalink
Browse files

Initial release of Shipment::Temando

basic functionality now exists for quoting, booking, and cancelling
  • Loading branch information...
pullingshots committed Jan 26, 2012
1 parent 9d601bf commit a98aff63a518da28da4ee82b8817c28663538538
Showing with 240 additions and 47 deletions.
  1. +13 −3 eg/temando.pl
  2. +13 −0 lib/Shipment/Address.pm
  3. +16 −0 lib/Shipment/Base.pm
  4. +181 −41 lib/Shipment/Temando.pm
  5. +17 −3 t/temando.t
View
@@ -2,7 +2,7 @@
use strict;
use warnings;
-use Test::More tests => 18;
+use Test::More tests => 19;
my ($username, $password) = @ARGV;
@@ -117,10 +117,20 @@
$shipment->ship( 'ground' );
is( $shipment->service->cost->value, $rate, 'rate matches actual cost') if defined $shipment->service;
-ok( defined $shipment->labels, 'got labels' );
-is( $shipment->labels->content_type, 'application/pdf', 'labels are a pdf') if defined $shipment->get_package(0)->label;
+ok( defined $shipment->documents, 'got labels' );
+is( $shipment->documents->content_type, 'application/pdf', 'labels are a pdf') if defined $shipment->documents;
#$shipment->documents->save;
#$shipment->manifest->save;
+my $request_id = $shipment->request_id;
+
+$shipment = Shipment::Temando->new(
+ username => $username,
+ password => $password,
+ request_id => $request_id,
+);
+
+$shipment->cancel;
+is( $shipment->error, undef, 'successfully cancelled shipment');
View
@@ -33,6 +33,7 @@ This class defines a shipping address and provides some methods for parsing the
use Moose 2.0000;
use MooseX::Aliases 0.10;
+use Moose::Util::TypeConstraints;
=head1 Class Attributes
@@ -69,6 +70,18 @@ has 'company' => (
default => 'n/a',
);
+=head2 address_type
+
+Whether the address is residential or business
+
+=cut
+
+has 'address_type' => (
+ is => 'rw',
+ isa => enum( [ qw/residential business/ ] ),
+ default => 'business',
+);
+
=head2 address1, address2, address3
The street address lines
View
@@ -47,6 +47,7 @@ use Data::Currency;
use Shipment::Service;
use Moose 2.0000;
use Moose::Util::TypeConstraints;
+use MooseX::Types::DateTime::ButMaintained qw( DateTime );
=head1 Class Attributes
@@ -265,6 +266,21 @@ has 'currency' => (
default => 'USD',
);
+=head2 pickup_date
+
+When the shipment will be ready for pickup
+
+type: DateTime
+
+=cut
+
+has 'pickup_date' => (
+ is => 'rw',
+ isa => DateTime,
+ default => time(),
+ coerce => 1,
+);
+
=head2 services
The available services
Oops, something went wrong.

0 comments on commit a98aff6

Please sign in to comment.