The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

WWW::FreshBooks::API - Perl interface to the FreshBooks API v2.0

VERSION

Version 0.01

SYNOPSIS

    use WWW::FreshBooks::API;

    my $fb = WWW::FreshBooks::API->new({
                                svc_url => "https://sample.freshbooks.com/api/xml-in",
                                auth_token => "somemd5hashedstringforyouraccount",
                                });
    my ($ref,$resp) = $fb->call('client.list', {
                                $arg1 => 'val1',
                                $arg2 => 'val2',
                                });

    # $ref is a hash reference created from the xml response.
    # $resp is an HTTP::Response object containg the response.

    # Verifies that the request was completed successfully.
    # Displays the client_id of the first client in the list.
    if ($ref) {
        $ref->{'client'}[0]->{'client_id'};
    }

    #Displays the response content as a string
    $resp->as_string;

METHODS/SUBROUTINES

new($args)

Constructs a new WWW::FreshBooks::API object storing you svc_url and auth_token.

call($method, $args)

Calls the specified $method passing through all $args in XML format. Formatting for the request body is done with XML::Simple. A hash reference created from the response xml and an HTTP::Response object is returned. If the request fails, the hashref will return 0.

DEPENDENCIES

Class::Accessor LWP::UserAgent

AUTHOR

Anthony Decena, <anthony at mindelusions.com>

COPYRIGHT & LICENSE

Copyright 2007 Anthony Decena, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.