Luke Poskitt > WWW-Myki-0.02 > WWW::Myki::Card

Download:
WWW-Myki-0.02.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.01   Source   Latest Release: WWW-Myki-0.04

NAME ^

WWW::Myki::Card - Class for operations with a Myki card

VERSION 0.01 ^

SYNOPSIS ^

    # Print my Myki card money balance
    my $balance = $card->money;

    # What time did I stumble home last night?
    print $card->last_transaction;

    # Yeesh, really?  How?
    print $card->service;

    # Ooooohh, now I remember.

DESCRIPTION ^

WWW::Myki::Card is a class providing account and card management and querying functionality for registered Myki users.

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

METHODS ^

id

Returns the card ID number.

holder

Returns the name of the registered card holder.

money

Returns the balance of Myki money on the card.

pass

Returns the balance of the active Myki pass (if any) on the card.

type

Returns the card type.

expiry

Returns the card expiry date in the format DD Mon YYYY, where Mon is the abbreviated month name.

status

Returns the card status.

money_top_up

Returns the value of any Myki money top up in progress - this is money that has been added by a top up, but may not yet have been credited to the card.

money_total

Returns the total of the balance of Myki money and the balance of Myki money top in progress on the card.

active_pass

Returns the balance of the current active Myki pass (if any) on the card.

inactive_pass

Returns the balance of the current inactive Myki pass (if any) on the card.

last_transaction

Returns the last transaction time and date for the card in the format; DD Mon YYYY HH:MM:SS AM/PM, where Mon is the abbreviated month name.

transactions

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

  # Prints a formatted list of the last 15 transactions for this card - e.g.
  # 
  # 29/05/2012 17:28:38 Bus        Surburbia,Route SUB16out_new
  # 29/05/2012 08:08:12 Bus        Metro,Route MET16in_new

Returns an array of WWW::Myki::Transaction objects representing the last 15 transactions for the card.

See WWW::Myki::Transaction for more information on transactions. Transaction data is cached on the initial invocation to increase the performance of subsequent calls and reduce unnecessary communication with the Myki portal. This is probably what you want, but if you really do want to force transaction data to be refreshed then you can call the method with the argument refresh set to a true value. e.g.

  $card->transactions( refresh => 1 );

Please note that this will incur a performance penalty.

refresh

When a WWW::Myki::Card object is created, the card data is cached to improve the performance of subsequent method calls and reduce unessecary network communication. This is probably what you want, however if you do want to force the object to update its cached data for any reason, then you can call refresh. Note that doing so will incur a performance penalty.

AUTHOR ^

Luke Poskitt, <ltp at cpan.org>

BUGS ^

Please report any bugs or feature requests to bug-www-myki-card at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-Myki-Card. 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::Card

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::Transaction

syntax highlighting: