RestApi/DriveApi3/Drive.pm

filter: Statementstmt 53.7% 29 / 54 Branchbran 0.0% 0 / 20 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 10 / 12 Podpod 87.5% 7 / 8 totaltotal 48.9% 46 / 94 CC 11 SCAR 26.2
CC
11
Cov
39%
update
36.7
delete
6.0
get
5.7
CRAP 13.8
« RestApi/SheetsApi4/Request/Spreadsheet.pm ↑ Summary RestApi/CalendarApi3/Event.pm »
1 package Google::RestApi::DriveApi3::Drive;
2  
3 2 our $VERSION = '1.1.0';
4  
5 2 ▶use Google::RestApi::Setup;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 ▶use parent 'Google::RestApi::SubResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 5 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
10 5 my $class = shift;
11 5 state $check = signature(
12 bless => !!0,
13 named => [
14 drive_api => HasApi,
15 id => Str, { optional => 1 },
16 ],
17 );
18 5 return bless $check->(@_), $class;
19 }
20  
21 0 ▶sub _uri_base { 'drives' }
Subroutine _uri_base: not called CC=1 SCAR=6.9
22 0 ▶sub _parent_accessor { 'drive_api' }
Subroutine _parent_accessor: not called CC=1 SCAR=6.9
23  
24 1 ▶sub get {
Subroutine get: called CC=3 SCAR=17.3
Pod documented
25 1 my $self = shift;
26 1 state $check = signature(
27 bless => !!0,
28 named => [
29 fields => Str, { optional => 1 },
30 use_domain_admin_access => Bool, { default => 0 },
31 ],
32 );
33 1 my $p = $check->(@_);
34  
35 1 $self->require_id('get');
36  
37 0 my %params;
38 0 ▶ $params{fields} = $p->{fields} if defined $p->{fields};
Branch: 1 branch
BranchTrueFalseTotal
if defined $$p{"fields"} 0 0 0
39 0 ▶ $params{useDomainAdminAccess} = 'true' if $p->{use_domain_admin_access};
Branch: 1 branch
BranchTrueFalseTotal
if $$p{"use_domain_admin_access"} 0 0 0
40  
41 0 return $self->api(params => \%params);
42 }
43  
44 1 ▶sub update {
Subroutine update: called CC=7 SCAR=36.0
Pod documented
45 1 my $self = shift;
46 1 state $check = signature(
47 bless => !!0,
48 named => [
49 name => Str, { optional => 1 },
50 color_rgb => Str, { optional => 1 },
51 theme_id => Str, { optional => 1 },
52 background_image_file => HashRef, { optional => 1 },
53 restrictions => HashRef, { optional => 1 },
54 use_domain_admin_access => Bool, { default => 0 },
55 _extra_ => slurpy HashRef,
56 ],
57 );
58 1 my $p = named_extra($check->(@_));
59  
60 1 $self->require_id('update');
61  
62 0 my %params;
63 0 ▶ $params{useDomainAdminAccess} = 'true' if delete $p->{use_domain_admin_access};
Branch: 1 branch
BranchTrueFalseTotal
if delete $$p{"use_domain_admin_access"} 0 0 0
64  
65 0 my %content;
66 0 ▶ $content{name} = delete $p->{name} if defined $p->{name};
Branch: 1 branch
BranchTrueFalseTotal
if defined $$p{"name"} 0 0 0
67 0 ▶ $content{colorRgb} = delete $p->{color_rgb} if defined $p->{color_rgb};
Branch: 1 branch
BranchTrueFalseTotal
if defined $$p{"color_rgb"} 0 0 0
68 0 ▶ $content{themeId} = delete $p->{theme_id} if defined $p->{theme_id};
Branch: 1 branch
BranchTrueFalseTotal
if defined $$p{"theme_id"} 0 0 0
69 $content{backgroundImageFile} = delete $p->{background_image_file}
70 0 ▶ if defined $p->{background_image_file};
Branch: 1 branch
BranchTrueFalseTotal
if defined $$p{"background_image_file"} 0 0 0
71 0 ▶ $content{restrictions} = delete $p->{restrictions} if defined $p->{restrictions};
Branch: 1 branch
BranchTrueFalseTotal
if defined $$p{"restrictions"} 0 0 0
72  
73 0 DEBUG(sprintf("Updating shared drive '%s'", $self->{id}));
74 0 return $self->api(
75 method => 'patch',
76 params => \%params,
77 content => \%content,
78 );
79 }
80  
81 1 ▶sub delete {
Subroutine delete: called CC=3 SCAR=17.9
Pod documented
82 1 my $self = shift;
83 1 state $check = signature(
84 bless => !!0,
85 named => [
86 use_domain_admin_access => Bool, { default => 0 },
87 allow_item_deletion => Bool, { default => 0 },
88 ],
89 );
90 1 my $p = $check->(@_);
91  
92 1 $self->require_id('delete');
93  
94 0 my %params;
95 0 ▶ $params{useDomainAdminAccess} = 'true' if $p->{use_domain_admin_access};
Branch: 1 branch
BranchTrueFalseTotal
if $$p{"use_domain_admin_access"} 0 0 0
96 0 ▶ $params{allowItemDeletion} = 'true' if $p->{allow_item_deletion};
Branch: 1 branch
BranchTrueFalseTotal
if $$p{"allow_item_deletion"} 0 0 0
97  
98 0 DEBUG(sprintf("Deleting shared drive '%s'", $self->{id}));
99 0 return $self->api(method => 'delete', params => \%params);
100 }
101  
102 1 ▶sub hide {
Subroutine hide: called CC=1 SCAR=1.2
Pod documented
103 1 my $self = shift;
104  
105 1 $self->require_id('hide');
106  
107 0 DEBUG(sprintf("Hiding shared drive '%s'", $self->{id}));
108 0 return $self->api(uri => 'hide', method => 'post');
109 }
110  
111 1 ▶sub unhide {
Subroutine unhide: called CC=1 SCAR=1.2
Pod documented
112 1 my $self = shift;
113  
114 1 $self->require_id('unhide');
115  
116 0 DEBUG(sprintf("Unhiding shared drive '%s'", $self->{id}));
117 0 return $self->api(uri => 'unhide', method => 'post');
118 }
119  
120 1 ▶sub drive_id { shift->{id}; }
Subroutine drive_id: called CC=1 SCAR=0.0
Pod documented
121 1 ▶sub drive_api { shift->{drive_api}; }
Subroutine drive_api: called CC=1 SCAR=0.0
Pod documented
122  
123 2 1;
124  
125 __END__
« RestApi/SheetsApi4/Request/Spreadsheet.pm ↑ Summary RestApi/CalendarApi3/Event.pm »