Finance-Bank-Cahoot
view release on metacpan or search on metacpan
NAME
Finance::Bank::Cahoot - Check your Cahoot bank accounts from Perl
DESCRIPTION
This module provides a rudimentary interface to the Cahoot online
banking system at "https://www.cahoot.com/". You will need either
"Crypt::SSLeay" or "IO::Socket::SSL" installed for HTTPS support to work
with WWW::Mechanize.
SYNOPSIS
my $cahoot = Finance::Bank::Cahoot->new(credentials => 'Constant',
credentials_options => {
account => '12345678',
password => 'verysecret',
place => 'London',
date => '01/01/1906',
username => 'dummy',
maiden => 'Smith' } );
my $accounts = $cahoot->accounts;
$cahoot->set_account($accounts->[0]->{account});
my $snapshot = $cahoot->snapshot;
foreach my $row (@$snapshot) {
print join ',', @$row; print "\n";
}
METHODS
new Create a new instance of a connection to the Cahoot server.
"new" can be called in two different ways. It can take a single
parameter, "credentials", which will accept an already created
credentials object, of type
"Finance::Bank::Cahoot::CredentialsProvider::*". Alternatively, it
can take two parameters, "credentials" and "credentials_options". In
this case "credentials" is the name of a credentials class to create
an instance of, and "credentials_options" is a hash of the options
to pass-through to the constructor of the chosen class.
If the second form of "new" is being used, and the chosen class is
*not* one of the ones supplied as standard then it will need to be
"required" first.
If any errors occur then "new" will "croak".
my $cahoot = Finance::Bank::Cahoot->new(credentials => 'Constant',
credentials_options => {
account => '12345678',
password => 'verysecret',
place => 'London',
date => '01/01/1906',
username => 'dummy',
maiden => 'Smith' } );
# Or create the credentials object ourselves
my $credentials = Finance::Bank::Cahoot::CredentialsProvider::Constant->new(
account => '12345678', password => 'verysecret', place => 'London',
date => '01/01/1906', username => 'dummy', maiden => 'Smith' } );
my $cahoot = Finance::Bank::Cahoot->new(credentials => $credentials);
login
Login to the Cahoot server using the credentials supplied to "new".
This method is implicit for all data access methods, so typically
does not need to be called explicitly. The method takes no arguments
and will only call one of memorable place, date or mother's maiden
name as expected by the Cahoot portal.
accounts
Returns a list reference containing a summary of any accounts
available from the supplied credentials. If a login has yet to occur
"accounts" will automatically do this.
my $accounts = $cahoot->accounts;
Each item in the list is a hash reference that holds summary
information for a single account, and contains this data:
name - the text name of the account
account - the account number
balance - the current balance of the account
available - the currently available funds (including any overdrafts)
set_account
Select an account for data retrieval using an 8-digit account
number. If a login has yet to occur or a list of accounts has yet to
be retrieved, "set_account" will automatically do this and cache the
results.
my @accounts = $cahoot->accounts;
$cahoot->set_account($accounts->[0]->{account});
# Or without first loading a list of accounts
$cahoot->set_account('12345678);
statements
Returns a list reference containing a summary of all statements
available for an account. When called with the optional parameter
containing an 8-digit account number, "statements" will
automatically login (if required) and select that account.
If no account has been selected and no account is supplied by the
caller, "statements" will "croak".
Each item in the returned list is a hash reference that holds
summary information for a single statement, and contains this data:
description - a text description of the date of the statement,
typically in the form "DD/MM/YY - DD/MM/YY"
start - the date of the start of the statement as a time as returned
by the "time" function.
end - the date of the end of the statement as a time as returned by
the "time" function.
set_statement
Select a statement for data retrieval using a statement description
previously returned from "statements". The text description of the
statement must be supplied as a parameter to the method and an
account must have been selected using "set_account". If no account
has been selected or no statement name is supplied by the caller,
"statement" will "croak".
$cahoot->set_account('12345678);
my $statements = $cahoot->statements;
$cahoot->set_statement($statements->[0]->{description});
debits
Return a list of direct debits currently active on the account. An
optional account parameter may be supplied as an 8-digit account
number. If no account has previously been selected or no account
number is supplied, "debits" will "croak". The return value is a
( run in 0.865 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )