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

Net::Google::DocumentsList::Role::HasItems - item CRUD implementation

SYNOPSIS

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',
  }
);

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',
  }
);

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.

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 <nobuo.danjou@gmail.com>

SEE ALSO

Net::Google::DocumentsList

Net::Google::DataAPI

LICENSE

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