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

NAME

Net::FreshBooks::API::Invoice

VERSION

version 0.12

SYNOPSIS

    my $fb = Net::FreshBooks::API->new({ ... });
    my $invoice = $fb->invoice;

invoice->create

Create an invoice in the FreshBooks system.

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

invoice->add_line

Create a new Net::FreshBooks::API::InvoiceLine object and add it to the end of the list of lines

    my $bool = $invoice->add_line(
        {   name         => "Yard Work",          # (Optional)
            description  => "Mowed the lawn.",    # (Optional)
            unit_cost    => 10,                   # Default is 0
            quantity     => 4,                    # Default is 0
            tax1_name    => "GST",                # (Optional)
            tax2_name    => "PST",                # (Optional)
            tax1_percent => 8,                    # (Optional)
            tax2_percent => 6,                    # (Optional)
        }
    );

invoice->send_by_email

Send the invoice by email.

  my $result = $invoice->send_by_email();

invoice->send_by_snail_mail

Send the invoice by snail mail.

  my $result = $invoice->send_by_snail_mail();

invoice->update

Please see client->update for an example of how to use this method.

invoice->get

    my $invoice = $fb->invoice->get({ invoice_id => $invoice_id });

invoice->delete

    my $invoice = $fb->invoice->get({ invoice_id => $invoice_id });
    $invoice->delete;

Returns an object with three methods. Each method returns a FreshBooks URL.

    print "send this url to client: " . $invoice->links->client_view;
    print "view invoice in my account: " . $invoice->links->view;
    print "edit invoice in my account: " . $invoice->links->edit;

invoice->list

Returns a Net::FreshBooks::API::Iterator object.

    # list unpaid invoices
    my $invoices = $fb->invoice->list({ status => 'unpaid' });

    while ( my $invoice = $invoices->list ) {
        print $invoice->invoice_id, "\n";
    }

invoice->lines

Returns an ARRAYREF of Net::FreshBooks::API::InvoiceLine objects

    foreach my $line ( @{ $invoice->lines } ) {
        print $line->amount, "\n";
    }

DESCRIPTION

This class gives you object to FreshBooks invoice information. Net::FreshBooks::API will construct this object for you.

AUTHOR

Olaf Alders <olaf@wundercounter.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2010 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.