Business-Shipping
view release on metacpan or search on metacpan
lib/Business/Shipping/USPS_Online/RateRequest.pm view on Meta::CPAN
package Business::Shipping::USPS_Online::RateRequest;
=head1 NAME
Business::Shipping::USPS_Online::RateRequest
=head1 SERVICE TYPES
=head2 Domestic
All
EXPRESS
Priority
Parcel
Library
BPM
Media
=head2 International
Global Express Guaranteed
Global Express Guaranteed Non-Document Rectangular
Global Express Guaranteed Non-Document Non-Rectangular
USPS GXG Envelopes
Express Mail International
Express Mail International Flat Rate Envelope
Express Mail International Legal Flat Rate Envelope
Priority Mail International
Priority Mail International Large Flat Rate Box
Priority Mail International Medium Flat Rate Box
Priority Mail International Small Flat Rate Box
Priority Mail International DVD Flat Rate Box
Priority Mail International Large Video Flat Rate Box
Priority Mail International Flat Rate Envelope
Priority Mail International Legal Flat Rate Envelope
Priority Mail International Padded Flat Rate Envelope
Priority Mail International Gift Card Flat Rate Envelope
Priority Mail International Small Flat Rate Envelope
Priority Mail International Window Flat Rate Envelope
First-Class Mail International Package
First-Class Mail International Large Envelope
=head1 METHODS
=cut
use Any::Moose;
use Data::Dumper;
use Carp;
use Business::Shipping::Logging;
use Business::Shipping::USPS_Online::Shipment;
use Business::Shipping::USPS_Online::Package;
use XML::Simple 2.05;
use XML::DOM;
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Response;
use version; our $VERSION = qv('400');
=head2 domestic
=head2 to_zip
Note that some methods are handled by the parent class:
to_zip, from_zip, to_city, from_city, to_country, from_country.
=cut
extends 'Business::Shipping::RateRequest::Online';
has 'domestic' => (is => 'rw', default => 1);
has 'prod_url' => (
is => 'rw',
default => 'http://production.shippingapis.com/ShippingAPI.dll'
);
has 'test_url' => (
is => 'rw',
default => 'http://testing.shippingapis.com/ShippingAPItest.dll',
);
has 'shipment' => (
is => 'rw',
isa => 'Business::Shipping::USPS_Online::Shipment',
default => sub { Business::Shipping::USPS_Online::Shipment->new() },
handles => [
'ounces', 'pounds', 'weight', 'container',
'size', 'machinable', 'mail_type', 'shipper',
'width', 'length', 'height', 'girth',
'service',
]
);
__PACKAGE__->meta()->make_immutable();
=head2 Required()
International USPS does not require the service or from_zip parameters, but
domestic does.
We use a hand-written "Required()" method for this class, because we require one
of the following: pounds, ounces, or weight. It doesn't matter which one it is,
but if none of them are defined, then we pick 'weight' to Require.
=cut
sub Required {
my ($self) = @_;
my @required;
if ($self->domestic) {
@required = qw/ service from_zip /;
}
( run in 0.518 second using v1.01-cache-2.11-cpan-97f6503c9c8 )