NAME
Net::Google::DocumentsList::Role::HasItems - item CRUD implementation
SYNOPSIS
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'
,
}
);
DESCRIPTION
This module implements item CRUD for Google Documents List Data API.
METHODS
add_item
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)
items
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}
);
item
returns the first item found by items method.
add_folder
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'
,
}
);
folders
shortcut for items({category => 'folder'}).
folder
returns the first folder found by folders method.
AUTHOR
Noubo Danjou <danjou@soffritto.org>
SEE ALSO
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.