|
NAMENet::FreshBooks::API::Base - Base classVERSIONversion 0.24new_from_nodemy $new_object = $class->new_from_node( $node ); Create a new object from the node given. copymy $new_object = $self->copy( ); Returns a new object with the fb object set on it. createmy $new_object = $self->create( \%args ); Create a new object. Takes the arguments and uses 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 FreshBooks and to populate the object. updatemy $object = $object->update(); Update the object, saving any changes that have been made since the get. getmy $object = $self->get( \%args ); Fetches the object using the FreshBooks API. listmy $iterator = $self->list( $args ); Returns an iterator that represents the list fetched from the server. See Net::FreshBooks::API::Iterator for details. deletemy $result = $self->delete(); Delete the given object. INTERNAL METHODSsend_requestmy $response_data = $self->send_request( $args ); Turn the args into xml, send it to FreshBooks, receive back the XML and convert it back into a Perl data structure. method_stringmy $method_string = $self->method_string( 'action' ); Returns a method string for this class - something like 'client.action'. api_namemy $api_name = $self->api_name( ); Returns the name that should be used in the API for this class. node_namemy $node_name = $self->node_name( ); Returns the name that should be used in the XML nodes for this class. Normally this is the same as the "api_name" but can be overridden if needed. id_fieldmy $id_field = $self->id_field( ); Returns the id field for this class. field_namesmy @names = $self->field_names(); Return the names of all the fields. field_names_rwmy @names = $self->field_names_rw(); Return the names of all the fields that are marked as read and write. parameters_to_request_xmlmy $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. construct_element( $element, $hashref )Requires an XML::LibXML::Element object, followed by a HASHREF of attributes, text nodes, nested values or child elements or some combination thereof.response_xml_to_nodemy $params = $self->response_xml_to_node( $xml ); Take XML from FB and turn it into a data structure that is easier to work with. send_xml_to_freshbooksmy $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. AUTHORS
COPYRIGHT AND LICENSEThis 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.
Visit the GSP FreeBSD Man Page Interface. |