WebService::UPS::Activity - Object to Represent a particular tracked event in the package's adventure


WebService-UPS documentation Contained in the WebService-UPS distribution.

Index


Code Index:

NAME

Top

WebService::UPS::Activity - Object to Represent a particular tracked event in the package's adventure

SYNOPSIS

Top

    my $Package = WebService::UPS::TrackRequest->new;
    $Package->Username('kbrandt');
    $Package->Password('topsecrent');
    $Package->License('8C3D7EE8FZZZZZ4');
    $Package->TrackingNumber('1ZA45Y5111111111');
    print $Package->Username();
    my $trackedpackage = $Package->requestTrack();
    my $activity = $trackedpackage->getActivity(0);
    print $activity->getTime();




Methods

Top

new()

    WebService::UPS::Activity->new( _activity_hash => $object->getActiviy(0));

The constructor method that creates a new Activity object. You probably should not be calling this directly as above, rather it should returned from the WebService::UPS::TrackedPackage Object

_activity_hash

You shouldn't be messing with it in general. But if you dump it with dumper, and you are clever, you might be able to access things that my module doesn't have getters for.

getTime()

    $activity->getTime()

Returns the time as a string, I will leave it up to you to make it into a datetime object.

getAddress()

    $activity->getAddress()

Returns an address object which represents the location of the activity

getDescription()

	$activity->getDescription()

returns a string that describes the action for this activity entry, for example 'OUT FOR DELIVERY'

getDate()

	$activity->getDate()

Returns String, like 052297

AUTHOR

Top

Kyle Brandt, kyle@kbrandt.com http://www.kbrandt.com


WebService-UPS documentation Contained in the WebService-UPS distribution.

#
#===============================================================================
#         FILE:  Activity.pm
#  DESCRIPTION:  Activity Object for my OO UPS Tracking Module
#       AUTHOR:  Kyle Brandt (mn), kyle@kbrandt.com , http://www.kbrandt.com
#===============================================================================

use strict;
use warnings;

package WebService::UPS::Activity;
use Mouse;

has '_activity_hash' => ( is => 'rw' );

sub getTime {
    my $self = shift;
    return $self->_activity_hash()->{Time} // '';
}

sub getAddress {
	my $self = shift;
	my $addressObject = WebService::UPS::Address->new( _address_hash => $self->_activity_hash()->{ActivityLocation}{Address}) // '';
	return $addressObject;
}

sub getDescription {
	my $self = shift;
	my $description = $self->_activity_hash()->{Status}{StatusType}{Description} // '';
	return $description;
}

sub getDate {
	my $self = shift;
	return $self->_activity_hash()->{Date} // '';
}
1;