The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::FreshBooks::API - easy OO access to the FreshBooks.com API

SYNOPSIS

    use Net::FreshBooks::API;

    # auth_token and account_name come from FreshBooks
    my $fb = Net::FreshBooks::API->new(
        {   auth_token   => $auth_token,
            account_name => $account_name,
        }
    );

    # create a new client
    my $client = $fb->client->create(
        {   first_name   => 'Larry',
            last_name    => 'Wall',
            organization => 'Perl HQ',
            email        => 'larry@example.com',
        }
    );

    # 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', } );

    # create an invoice for this client
    my $invoice = $fb->invoice(
        {   client_id => $client->client_id,
            number    => '00001',
        }
    );

    # add a line to the invoice
    $invoice->add_line(
        {   name      => 'Hawaiian shirt consulting',
            unit_cost => 60,
            quantity  => 4,
        }
    );

    # save the invoice and then send it
    $invoice->create;
    $invoice->send_by_email;

WARNING

This code is still under development - any and all patches most welcome.

Especially lacking is the documentation - for now you'd better look at the test file 't/live-test.t' for examples of usage.

Also I've only implemented the clients and invoices as they were all I needed. If you need other details they should be very easy to add - please get in touch.

DESCRIPTION

FreshBooks.com is a website that lets you create, send and manage invoices. This module is an OO abstraction of their API that lets you work with Clients, Invoices etc as if they were standard Perl objects.

METHODS

new

    my $fb = Net::FreshBooks::API->new(
        {   account_name => 'account_name',
            auth_token   => '123...def',
        }
    );

Create a new API object.

ping

  my $bool = $fb->ping(  );

Ping the server with a trivial request to see if a connection can be made. Returns true if the server is reachable and the authentication details are valid.

service_url

  my $url = $fb->service_url(  );

Returns a URI object that represents the service URL.

client, invoice

  my $client = $fb->client->create({...});

Accessor to the various objects in the API.

ua

  my $ua = $fb->ua;

Return a LWP::UserAgent object to use when contacting the server.

AUTHOR

Edmund von der Burg <evdb@ecclestoad.co.uk>

Developed for HinuHinu http://www.hinuhinu.com/.

LICENCE

Perl

SEE ALSO

WWW::FreshBooks::API - an alternative interface to FreshBooks.

http://developers.freshbooks.com/overview/ the FreshBooks API documentation.