Net::Google::DocumentsList::Role::HasItems - item CRUD implementation
use Net::Google::DocumentsList; my $service = Net::Google::DocumentsList->new( username => 'myname@gmail.com', password => 'p4$$w0rd' ); # add a document to the root directory of your docs. my $doc = $service->add_item( { title => 'my document', kind => 'document', } ); # add a folder to the root directory of your docs. my $folder = $service->add_folder( { title => 'my folder', } ); # add a spreadsheet to a directory my $spreadsheet = $folder->add_item( { title => 'my spreadsheet', kind => 'spreadsheet', } );
This module implements item CRUD for Google Documents List Data API.
creates specified file or folder.
my $file = $client->add_item( { title => 'my document', kind => 'document', } );
available values for 'kind' are 'document', 'folder', 'pdf', 'presentation', 'spreadsheet', and 'form'.
You can also upload file:
my $uploaded = $client->add_item( { title => 'uploaded file', file => '/path/to/my/presentation.ppt', } );
To translate the file specify source_language and target_language:
my $uploaded = $client->add_item( { title => 'uploaded file', file => '/path/to/my/presentation.ppt', source_language => 'ja', target_language => 'en', } );
THIS DOESN NOT WORK FOR NOW (2010 NOV 28)
searches items like this:
my @items = $client->items( { 'title' => 'my document', 'title-exact' => 'true', 'category' => 'document', } ); my @not_viewed_and_starred_presentation = $client->items( { 'category' => ['-viewed','starred','presentation'], } );
You can specify query with hashref and specify categories in 'category' key. See http://code.google.com/intl/en/apis/documents/docs/3.0/developers_guide_protocol.html#SearchingDocs for details.
You can also specify resource_id for the query. It naturally returns 0 or 1 item which matches the resource_id. This is useful to work with Net::Google::Spreadsheets:
my $ss_in_docs = $client->item( {resource_id => 'spreadsheet:'.$ss->key} );
returns the first item found by items method.
shortcut for add_item({kind => 'folder'}).
my $new_folder = $client->add_folder( { title => 'new_folder' } );
is equivalent to
my $new_folder = $client->add_item( { title => 'new_folder', kind => 'folder', } );
shortcut for items({category => 'folder'}).
returns the first folder found by folders method.
Noubo Danjou <danjou@soffritto.org>
Net::Google::DocumentsList
Net::Google::DataAPI
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Net::Google::DocumentsList, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Google::DocumentsList
CPAN shell
perl -MCPAN -e shell install Net::Google::DocumentsList
For more information on module installation, please visit the detailed CPAN module installation guide.