create
my $new_object = $self->create( \%args );
Create a new object. Takes the arguments and use them to create a new entry at the FreshBooks end. Once the object has been created a 'get' request is issued to fetch the data back from freshboks and to populate the object.
update
my $object = $object->update();
Update the object, saving any changes that have been made since the get.
get
my $object = $self->get( \%args );
Fetches the object using the FreshBooks API.
list
my $iterator = $self->list( $args );
Returns an iterator that represents the list fetched from the server. See Net::FreshBooks::API::Iterator for details.
delete
my $result = $self->delete();
Delete the given object.
INTERNAL METHODS
send_request
my $response_data = $self->send_request( $args );
Turn the args into xml, send it to FreshBooks, recieve back the XML and convertit back into a perl data structure.
method_string
my $method_string = $self->method_string( 'action' );
Returns a method string for this class - something like 'client.action'.
api_name
my $api_name = $self->api_name( );
Returns the name that should be used in the API for this class.
id_field
my $id_field = $self->id_field( );
Returns theh id field for this class.
field_names
my @names = $self->field_names();
Return the names of all the fields.
field_names_rw
my @names = $self->field_names();
Return the names of all the fields that are marked as read and write.
parameters_to_request_xml
my $xml = $self->parameters_to_request_xml( \%parameters );
Takes the parameters given and turns them into the xml that should be sent to the server. This has some smarts that works around the tedium of processing perl datastructures -> XMl. In particular any key starting with an underscore becomes an attribute. Any key pointing to an array is wrapped so that it appears correctly in the XML.
response_xml_to_parameters
my $params = $self->response_xml_to_parameters( $xml );
Take XML from FB and turn it into a datastructure that is easier to work with.
send_xml_to_freshbooks
my $returned_xml = $self->send_xml_to_freshbooks( $xml_to_send );
Sends the xml to the FreshBooks API and returns the XML content returned. This is the lowest part and is encapsulated here so that it can be easily overridden for testing.