NAME

WWW::Myki::Transaction - Class for operations with a Myki transaction

VERSION 0.01

SYNOPSIS

# Print the date, time, service, description and cost of our last 15 transactions

foreach my $trip ( $card->transactions ) { 
  printf( "%10s %8s %-10s %-20s %-5s\n", 
          $trip->date,
          $trip->time, 
          $trip->service,
          $trip->desc,
          $trip->debit )
}

# Maybe do a rough calculation of the cost of public transport per day

use List::Util qw( sum );
my %sum;

foreach my $t ( $card->transactions ) {
  ( my $cost = $t->debit ) =~ s/(-|\$|\s)//g;
  $sum{ $t->date } += $cost;
}

print "Average daily cost of travel on public transport: "
  . ( ( sum values %sum ) / ( keys %sum ) ) . "\n";

# Still cheaper than the environmental cost of driving to work
  

DESCRIPTION

WWW::Myki::Transaction is a class providing Myki transaction querying functionality for registered Myki users. Each WWW::Myki::Transaction object is representative of a single Myki card transaction.

Please note that you're are not meant to call the constructor yourself, instead a WWW::Myki::Transaction object will be created automatically for you by calls to methods in a WWW::Myki::Card object like transactions.

METHODS

date

Return the date of the transaction using the format DD/MM/YYYY.

time

Print the time of the last transaction using the format HH:MM:SS AM/PM.

service

The type of service for the last transaction (e.g. busi or train)

zone

The transit zone for the last transaction.

desc

A description of the transaction usually including the start and destination localities and a service name. This may be a hyphen (-) where no information is provided.

debit

The amount debited for the transaction using in decimal currency format (i.e. $D.DD) where present, or a hyphen where no debit was made.

credit

The amount credited for the transaction using in decimal currency format (i.e. $D.DD) where present, or a hyphen where no credit was made.

balance

The balance of the associated Myki card at the time this transaction was completed in decimal curreny format.

type

The type of transaction made (e.g. Touch-on or Touch-off).

AUTHOR

Luke Poskitt, <ltp at cpan.org>

BUGS

Please report any bugs or feature requests to bug-www-myki-transaction at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-Myki-Transaction. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc WWW::Myki::Transaction

You can also look for information at:

LICENSE AND COPYRIGHT

Copyright 2012 Luke Poskitt.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

SEE ALSO

WWW::Myki, WWW::Myki::Card