NAME

Transport::AU::PTV::Departure

VERSION

version 0.01

NAME

Transport::AU::PTV::Departures - a collections of departures for a particular stop on the Victorian Public Transport Network

SYNOPSIS

# Credentials are in environment variables
my @departures = Transport::AU::PTV->new
->routes->find({ name => 'Upfield' })
->stops->find({ name => "Coburg Station" })
->departures({ max_results => 1 })
->as_array;

for my $departure (@departures) {
    say "Scheduled Departure: ". $departure->scheduled_departure;
    say "Estimated Departure: ". $departure->estimated_departure;
    say "Run ID: ". $departure->run_id;
}

METHODS

new

my $departure = Transport::AU::PTV::Departure->new( Transport::AU::PTV::APIRequest->new, $departure_structure );

scheduled_departure

my $scheduled = $departure->scheduled_departure;
say "Hour:Minute:Second: ".$scheduled->hms;

Returns a DateTime object representing the scheduled date/time that the the train/tram/bus will depart from the station.

estimated_departure

my $estimated = $departure->estimated_departure;
say "Hour:Minute:Second: ".$scheduled->hms;

Returns a DateTime object representing the estimated date/time that the the train/tram/bus will depart from the station.

at_platform

say "At platform" if $departure->at_platform;

Returns 1 if the departure is currently at the stop/platform. Returns 0 if it is not.

platform_number

Returns the platform number of the stop that this departure will leave from.

direction_id

Returns the direction identifier for the direction that this departure will head towards.

run_id

Returns the run identifier for this departure.

AUTHOR

Greg Foletta <greg@foletta.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2018 by Greg Foletta.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.