Business::Shipping::RateRequest - Abstract class
Abstract Class: real implementations are done in subclasses.
Represents a request for shipping cost estimation.
Boolean. 1 = Rate Request was successful.
Boolean. 1 = Save results using CHI, and reload them if an identical request is made later. See submit() for implementation details.
Allows configuration of CHI cache. Pass it a hash reference of a CHI config. Defaults to {driver = 'File'}>.
{driver =
$rate_request->cache_config({ driver => 'Memory', global => 1 });
Boolean. 1 = Rate request was invalid, because user supplied invalid data. This can be useful in determining whether or not to log incident reports (see UserTag/business-shipping.tag for an example implementation).
Hashref. Stores the results of a rate request, for example:
{ 'UPS' => [ { id => 1, charges => 10.50 }, { id => 2, charges => 23.00 } ] }
See _handle_response() for implementation details.
Stores a Business::Shipping::Shipment object. Many methods are forwarded to it. At this time, each RateRequest only has one Shipment.
Arrayref. Stores the error results of a rate request. There can be multiple errors for one request. Each entry in the array represents an error. Each error is a hashref with the following keys:
error_code : The error code error_msg : A description error message
Additional keys may be added by the shipper class.
This method sets some values (optional), executes the request, then parses the results.
Does some validation common to all RateRequest objects, but most of the validation goes on in the subclass.
Calls unique() on all subclasses to determine a list of unique elements.
Returns a hash of element_name => element_value. Used by gen_unique_key().
Sorts hash alphabetically, then returns just the values. (So that the key will have the values sorted in the same order always).
Calls get_unique_hash(), sorts them with hash_to_sorted_values(), then returns them in string format.
Iterates the $self->results hash and sums the charges from each package->charges. Returns the total.
Example of what the results look like:
[ { name => 'UPS_Online', rates => [ { code => '03', short_name => 'GNDRES', name => 'Ground Residential', est_deliv => 4, charges => 5.32, charges_formatted => '$5.32', }, ] } ];
Arrange the values of some important variables in a pretty format. Return a scalar string.
Return formatted string of price component information
Daniel Browning, db@kavod.com, http://www.kavod.com/
Copyright 2003-2011 Daniel Browning <db@kavod.com>. All rights reserved. This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself. See LICENSE for more info.
To install Business::Shipping, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Business::Shipping
CPAN shell
perl -MCPAN -e shell install Business::Shipping
For more information on module installation, please visit the detailed CPAN module installation guide.