| Finance-Wesabe documentation | Contained in the Finance-Wesabe distribution. |
Finance::Wesabe::Transaction - Class to represent a transaction
my $txn = Finance::Wesabe::Transaction->new(
content => $c, parent => $p
);
This class represents a single transaction for a given account.
Returns the transaction amount in a nicely formatted string based on your preferenes.
Returns a boolean indicating if this transaction is a transfer.
Brian Cassidy <bricas@cpan.org>
Copyright 2009-2010 by Brian Cassidy
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Finance-Wesabe documentation | Contained in the Finance-Wesabe distribution. |
package Finance::Wesabe::Transaction; use Moose; use Finance::Wesabe::Utils;
has content => ( is => 'ro', isa => 'HashRef' ); has parent => ( is => 'ro', isa => 'Object' );
__PACKAGE__->mk_simple_field( qw( memo raw-name guid raw-txntype note ) ); __PACKAGE__->mk_deep_field( qw( amount ) ); __PACKAGE__->mk_simple_date_field( qw( date original-date ) );
sub pretty_amount { my $self = shift; return $self->parent->_format_number( $self->amount ); }
sub tags { my $self = shift; my $tags = $self->content->{ tags }->{ tag }; return $tags->{ name } unless ref $tags eq 'ARRAY'; return map { $_->{ name } } @$tags; }
sub is_transfer { return exists shift->content->{ transfer }; } no Moose; __PACKAGE__->meta->make_immutable;
1;