| 1 | package Net::Google::DocumentsList; | ||||||||||||
| 2 | 14 | ▶ | use Any::Moose; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 3 | 14 | ▶ | use Net::Google::DataAPI; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 14 | ▶ | use Net::Google::DataAPI::Auth::ClientLogin::Multiple; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 14 | ▶ | use Net::Google::DocumentsList::Metadata; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | 14 | ▶ | use URI; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | 14 | ▶ | use URI::Escape; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | 14 | ▶ | use 5.008001; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | |||||||||||||
| 10 | 14 | our $VERSION = '0.09'; | |||||||||||
| 11 | |||||||||||||
| 12 | 14 | with 'Net::Google::DataAPI::Role::Service'; | |||||||||||
| 13 | |||||||||||||
| 14 | 14 | has '+gdata_version' => (default => '3.0'); | |||||||||||
| 15 | has '+namespaces' => ( | ||||||||||||
| 16 | 0 | ▶ | default => sub { | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||
| 17 | { | ||||||||||||
| 18 | 0 | gAcl => 'http://schemas.google.com/acl/2007', | |||||||||||
| 19 | batch => 'http://schemas.google.com/gdata/batch', | ||||||||||||
| 20 | docs => 'http://schemas.google.com/docs/2007', | ||||||||||||
| 21 | app => 'http://www.w3.org/2007/app', | ||||||||||||
| 22 | } | ||||||||||||
| 23 | }, | ||||||||||||
| 24 | 14 | ); | |||||||||||
| 25 | |||||||||||||
| 26 | 14 | has username => (is => 'ro', isa => 'Str'); | |||||||||||
| 27 | 14 | has password => (is => 'ro', isa => 'Str'); | |||||||||||
| 28 | 14 | has account_type => (is => 'ro', isa => 'Str', required => 1, default => 'HOSTED_OR_GOOGLE'); | |||||||||||
| 29 | 14 | has source => (is => 'ro', isa => 'Str', required => 1, default => __PACKAGE__ . '-' . $VERSION); | |||||||||||
| 30 | |||||||||||||
| 31 | 0 | ▶ | sub _build_auth { | ||||||||||
|
Subroutine
_build_auth: not called CC=1 SCAR=6.9
| |||||||||||||
| 32 | 0 | my ($self) = @_; | |||||||||||
| 33 | 0 | Net::Google::DataAPI::Auth::ClientLogin::Multiple->new( | |||||||||||
| 34 | source => $self->source, | ||||||||||||
| 35 | accountType => $self->account_type, | ||||||||||||
| 36 | services => { | ||||||||||||
| 37 | 'docs.google.com' => 'writely', | ||||||||||||
| 38 | 'spreadsheets.google.com' => 'wise', | ||||||||||||
| 39 | '*docs.googleusercontent.com' => 'writely', | ||||||||||||
| 40 | }, | ||||||||||||
| 41 | username => $self->username, | ||||||||||||
| 42 | password => $self->password, | ||||||||||||
| 43 | ); | ||||||||||||
| 44 | } | ||||||||||||
| 45 | |||||||||||||
| 46 | 14 | feedurl item => ( | |||||||||||
| 47 | entry_class => 'Net::Google::DocumentsList::Item', | ||||||||||||
| 48 | default => 'https://docs.google.com/feeds/default/private/full', | ||||||||||||
| 49 | is => 'ro', | ||||||||||||
| 50 | ); | ||||||||||||
| 51 | |||||||||||||
| 52 | 14 | feedurl root_item => ( | |||||||||||
| 53 | entry_class => 'Net::Google::DocumentsList::Item', | ||||||||||||
| 54 | default => 'https://docs.google.com/feeds/default/private/full/folder%3Aroot/contents', | ||||||||||||
| 55 | can_add => 0, | ||||||||||||
| 56 | is => 'ro', | ||||||||||||
| 57 | ); | ||||||||||||
| 58 | |||||||||||||
| 59 | 14 | feedurl change => ( | |||||||||||
| 60 | entry_class => 'Net::Google::DocumentsList::Change', | ||||||||||||
| 61 | default => 'https://docs.google.com/feeds/default/private/changes', | ||||||||||||
| 62 | can_add => 0, | ||||||||||||
| 63 | is => 'ro', | ||||||||||||
| 64 | ); | ||||||||||||
| 65 | |||||||||||||
| 66 | 14 | with 'Net::Google::DocumentsList::Role::HasItems'; | |||||||||||
| 67 | |||||||||||||
| 68 | 0 | ▶ | around root_items => sub { | ||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||||
| 69 | 0 | my ($next, $self, $cond) = @_; | |||||||||||
| 70 | |||||||||||||
| 71 | 0 | my @items; | |||||||||||
| 72 | 0 | my $resource_id = delete $cond->{resource_id}; | |||||||||||
| 73 | 0 | ▶ | if (my $cats = delete $cond->{category}) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 74 | 0 | ▶ | $cats = [ "$cats" ] unless ref $cats eq 'ARRAY'; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 75 | 0 | @items = $self->items_with_category('root_item', $cats, $cond); | |||||||||||
| 76 | } else { | ||||||||||||
| 77 | 0 | @items = $next->($self, $cond); | |||||||||||
| 78 | } | ||||||||||||
| 79 | 0 | ▶ | if ($self->can('sync')) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 80 | 0 | @items = grep {$_->parent eq $self->_url_with_resource_id} @items; | |||||||||||
| 81 | } | ||||||||||||
| 82 | 0 | ▶ | if ($resource_id) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 83 | 0 | @items = grep {$_->resource_id eq $resource_id} @items; | |||||||||||
| 84 | } | ||||||||||||
| 85 | 0 | @items; | |||||||||||
| 86 | 14 | }; | |||||||||||
| 87 | |||||||||||||
| 88 | 0 | ▶ | sub metadata { | ||||||||||
|
Subroutine
metadata: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||
| 89 | 0 | my ($self, $args) = @_; | |||||||||||
| 90 | my $uri = URI->new( | ||||||||||||
| 91 | sprintf("https://docs.google.com/feeds/metadata/%s", | ||||||||||||
| 92 | 0 | ▶ | uri_escape_utf8(delete $args->{user_id} || 'default') | ||||||||||
|
Condition0%0/2
delete $args->{'user_id'} || 'default'
MC/DC0%0/1
delete $args->{'user_id'} || 'default'
delete $args->{'user_id'}
Truth table0%0/2
A
A= delete $args->{'user_id'}
| |||||||||||||
| 93 | ) | ||||||||||||
| 94 | ); | ||||||||||||
| 95 | 0 | $uri->query_form($args); | |||||||||||
| 96 | 0 | ▶ | my $atom = eval {$self->get_entry($uri)} or return; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 97 | 0 | Net::Google::DocumentsList::Metadata->new( | |||||||||||
| 98 | atom => $atom, | ||||||||||||
| 99 | service => $self, | ||||||||||||
| 100 | ); | ||||||||||||
| 101 | } | ||||||||||||
| 102 | |||||||||||||
| 103 | 14 | __PACKAGE__->meta->make_immutable; | |||||||||||
| 104 | |||||||||||||
| 105 | 14 | ▶ | no Any::Moose; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 106 | |||||||||||||
| 107 | 14 | 1; | |||||||||||
| 108 | __END__ | ||||||||||||