| Net-FreshBooks-API documentation | view source | Contained in the Net-FreshBooks-API distribution. |
Net::FreshBooks::API::Client - FreshBooks Client access
version 0.21
my $fb = Net::FreshBooks::API->new({ ... });
my $client = $fb->client;
# create a new client
my $client = $fb->client->create(
{ first_name => 'Larry',
last_name => 'Wall',
organization => 'Perl HQ',
email => 'larry@example.com',
}
);
Once you have a client object, you may set any of the mutable fields by calling the appropriate method on the object:
$client->first_name( 'Lawrence' );
$client->last_name( 'Wahl' );
These changes will not be reflected in your FreshBooks account until you call the update() method, which is described below.
# take the client object created above
# we can now make changes to the client and save them
$client->organization('Perl Foundation');
$client->update;
# or more quickly
$client->update( { organization => 'Perl Foundation', } );
# fetch a client based on a FreshBooks client_id
my $client = $fb->client->get({ client_id => $client_id });
# fetch a client and then delete it
my $client = $fb->client->get({ client_id => $client_id });
$client->delete;
Returns an Net::FreshBooks::API::Links object, which returns FreshBooks URLs.
print "Client view: " . $fb->client->links->client_view;
Returns an Net::FreshBooks::API::Iterator object. Currently, all list() functionality defaults to 15 items per page.
#list all active clients
my $clients = $fb->client->list();
print $clients->total . " active clients\n";
print $clients->pages . " pages of results\n";
while ( my $client = $clients->next ) {
print join( "\t", $client->client_id, $client->first_name, $client->last_name ) . "\n";
}
To override the default pagination:
my $clients = $fb->client->list({ page => 2, per_page => 35 });
This class gives you object to FreshBooks client information. Net::FreshBooks::API will construct this object for you.
This software is copyright (c) 2011 by Edmund von der Burg & Olaf Alders.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
| Net-FreshBooks-API documentation | view source | Contained in the Net-FreshBooks-API distribution. |