NAME

Net::UPS::Service - Class representing a UPS service

SYNOPSIS

    $services = $ups->shop_for_rates($from, $to, $package);
    unless ( defined $services ) {
        die $ups->errstr;
    }
    unless ( @$services ) {
        die "There are no services available for your address";
    }
    print "Following services are available for your address to ship that package:\n";
    while (my $service = shift @$services ) {
        printf("%s => \$.2f\n", $service->label, $service->total_charges);
    }

DESCRIPTION

Net::UPS::Service represents a single UPS shipping service. In typical programming environment, the only time you will interact with this object is when it's returned from shop_for_rates() method of Net::UPS.

ATTRIBUTES

Following attributes are available in all Services

code()

Two digit service code as used by UPS Online Tools. It is not something useful for an average programmer.

label()

Label assigned by Net::UPS to each service code, to rid programmer of having to have service codes table in front of him the whole time he's coding.

total_charges()

Monetary value of total cost of shipping package(s). If you had multiple packages passed to shop_for_rates() method, then total_charges() is the total of all the rates' total_charges(). Don't get confused!

rates()

An array reference to a list of rates quoted by this service. Amount of rates always equals amount of packages being rated, so there is always only one rate per package. If there was only one package rated, than rates() returns an arrayref with a single Net::UPS::Rate object.

rated_packages()

Reference to a list of packages rated using this service. If there was only one package rated, rated_packages() returns an arrayref containing a single element. Each package represented by Net::UPS::Package instance.

guaranteed_days()

Guaranteed days in transit. You can use this option to calculate the exact date the customer can expect the package delivered. This attributes seems to be undef for GROUND service.

METHODS

Net::UPS::Service is a Class::Struct. In addition, following methods are provided:

new_from_code($code)

Creates a Net::UPS::Service instance using the service code. Example:

    $service = Net::UPS::Service->new_from_code('03');
    printf("Service is: %s\n", $service->label);

    # outputs:
    Service is: GROUND
new_from_label($label)

Create Net::UPS::Service instance using the service label. Example:

    $service = Net::UPS::Service->new_from_label('2ND_DAY_AIR');
    printf("Service code is: %s\n", $service->code);

    # Outputs:
    Service code is: 02
name()

Similar to label(), except underscores will be removed before output. For example:

    $service = Net::UPS::Service->new_from_code('07');
    printf("Service label is: %s\n", $service->label);
    printf("Service name  is: %s\n", $service->name);

    # Outputs:
    Service label is: WORLDWIDE_EXPRESS
    Service name  is: WORLDWIDE EXPRESS

AUTHOR AND LICENSING

For support and licensing information refer to Net::UPS