File Coverage

lib/Google/RestApi/DriveApi3.pm
Criterion Covered Total %
statement 24 28 85.7
branch 1 2 50.0
condition n/a
subroutine 7 8 87.5
pod 0 5 0.0
total 32 43 74.4


line stmt bran cond sub pod time code
1              
2             our $VERSION = '1.0.2';
3              
4             use Google::RestApi::Setup;
5 1     1   444  
  1         2  
  1         6  
6             use aliased 'Google::RestApi::DriveApi3::File';
7 1     1   18589  
  1         2  
  1         6  
8             # TODO: switch to ReadOnly
9             use constant {
10             Drive_Endpoint => "https://www.googleapis.com/drive/v3",
11 1         467 Drive_File_Id => "[a-zA-Z0-9-_]+",
12             };
13 1     1   83  
  1         2  
14             my $class = shift;
15             state $check = compile_named(
16 10     10 0 23 api => HasApi,
17 10         24 endpoint => Str, { default => Drive_Endpoint },
18             );
19             return bless $check->(@_), $class;
20             }
21 10         1062  
22             my $self = shift;
23             state $check = compile_named(
24             uri => Str, { optional => 1 },
25 20     20 0 36 _extra_ => slurpy Any,
26 20         34 );
27             my $p = named_extra($check->(@_));
28             my $uri = "$self->{endpoint}/";
29             $uri .= delete $p->{uri} if defined $p->{uri};
30 20         854 return $self->{api}->api(%$p, uri => $uri);
31 20         86 }
32 20 50       109  
33 20         103 my $self = shift;
34             state $check = compile(Str, HashRef, { default => {} });
35             my ($filter, $params) = $check->(@_);
36             $params->{'q'} = $filter;
37 9     9 0 20 return $self->api(params => $params, uri => 'files');
38 9         297 }
39 9         1209  
40 9         157 my $self = shift;
41 9         26 my $upload = $self->{endpoint};
42             $upload =~ s|googleapis.com/|googleapis.com/upload/|;
43             return $upload;
44             }
45 0     0 0 0  
46 0         0  
47 0         0 1;
48 0         0  
49              
50             =head1 NAME
51 11     11 0 69  
52             Google::RestApi::DriveApi3 - API to Google Drive API V3.
53              
54             =head1 DESCRIPTION
55              
56             This API has been minimally developed to support the SheetsApi4 API in this
57             same package. Is it very incomplete and has no direct tests other than what
58             the SheetsApi4 package tests. It will be filled out and completed in due
59             course. Pull requests welcome.
60              
61             =head1 AUTHORS
62              
63             =over
64              
65             =item
66              
67             Robin Murray mvsjes@cpan.org
68              
69             =back
70              
71             =head1 COPYRIGHT
72              
73             Copyright (c) 2021, Robin Murray. All rights reserved.
74              
75             This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.