| Net-Google-DocumentsList documentation | Contained in the Net-Google-DocumentsList distribution. |
Net::Google::DocumentsList - Perl interface to Google Documents List Data API
use Net::Google::DocumentsList;
my $client = Net::Google::DocumentsList->new(
username => 'myname@gmail.com',
password => 'p4$$w0rd'
);
Net::Google::DocumentsList is a Perl interface to Google Documents List Data API.
creates Google Documents List Data API client.
my $clinet = Net::Google::DocumentsList->new(
username => 'foo.bar@gmail.com',
password => 'p4ssw0rd',
source => 'MyClient',
# optional, default is 'Net::Google::DocumentsList'
account_type => 'GOOGLE',
# optional, default is 'HOSTED_OR_GOOGLE'
);
You can set alternative authorization module like this:
my $oauth = Net::Google::DataAPI::Auth::OAuth->new(...);
my $client = Net::Google::DocumentsList->new(
auth => $oauth,
);
Make sure Documents List Data API would need those scopes:
These methods are implemented in Net::Google::DocumentsList::Role::HasItems.
These methods gets items on your 'root' directory. parameters are same as 'items' and 'item' methods.
You can not do add_root_item (it's useless). use add_item method instead.
Noubo Danjou <nobuo.danjou@gmail.com>
Net::Google::DocumentsList::Role::HasItems
http://code.google.com/apis/documents/docs/3.0/developers_guide_protocol.html
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Net-Google-DocumentsList documentation | Contained in the Net-Google-DocumentsList distribution. |
package Net::Google::DocumentsList; use Any::Moose; use Net::Google::DataAPI; use Net::Google::DataAPI::Auth::ClientLogin::Multiple; use 5.008001; our $VERSION = '0.05'; with 'Net::Google::DataAPI::Role::Service'; has '+gdata_version' => (default => '3.0'); has '+namespaces' => ( default => sub { { gAcl => 'http://schemas.google.com/acl/2007', batch => 'http://schemas.google.com/gdata/batch', docs => 'http://schemas.google.com/docs/2007', app => 'http://www.w3.org/2007/app', } }, ); has username => (is => 'ro', isa => 'Str'); has password => (is => 'ro', isa => 'Str'); has account_type => (is => 'ro', isa => 'Str', required => 1, default => 'HOSTED_OR_GOOGLE'); has source => (is => 'ro', isa => 'Str', required => 1, default => __PACKAGE__ . '-' . $VERSION); sub _build_auth { my ($self) = @_; Net::Google::DataAPI::Auth::ClientLogin::Multiple->new( source => $self->source, accountType => $self->account_type, services => { 'docs.google.com' => 'writely', 'spreadsheets.google.com' => 'wise', '*docs.googleusercontent.com' => 'writely', }, username => $self->username, password => $self->password, ); } feedurl item => ( entry_class => 'Net::Google::DocumentsList::Item', default => 'https://docs.google.com/feeds/default/private/full', is => 'ro', ); feedurl root_item => ( entry_class => 'Net::Google::DocumentsList::Item', default => 'https://docs.google.com/feeds/default/private/full/folder%3Aroot/contents', can_add => 0, is => 'ro', ); with 'Net::Google::DocumentsList::Role::HasItems'; around root_items => sub { my ($next, $self, $cond) = @_; my @items; my $resource_id = delete $cond->{resource_id}; if (my $cats = delete $cond->{category}) { $cats = [ "$cats" ] unless ref $cats eq 'ARRAY'; @items = $self->items_with_category('root_item', $cats, $cond); } else { @items = $next->($self, $cond); } if ($self->can('sync')) { @items = grep {$_->parent eq $self->_url_with_resource_id} @items; } if ($resource_id) { @items = grep {$_->resource_id eq $resource_id} @items; } @items; }; __PACKAGE__->meta->make_immutable; no Any::Moose; 1; __END__