RestApi/SheetsApi4/Request/Spreadsheet.pm

filter: Statementstmt 78.8% 56 / 71 Branchbran 35.0% 14 / 40 Conditioncond 50.0% 3 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 80.0% 12 / 15 Podpod 0.0% 0 / 13 totaltotal 57.0% 85 / 149 CC 23 SCAR 28.2
CC
23
Cov
62%
add_worksheet
56.0
update_protected_range
15.6
add_protected_range
5.3
CRAP 16.8
« RestApi/DriveApi3/Changes.pm ↑ Summary RestApi/DriveApi3/Drive.pm »
1 package Google::RestApi::SheetsApi4::Request::Spreadsheet;
2  
3 2 our $VERSION = '2.2.5';
4  
5 2 ▶use Google::RestApi::Setup;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 ▶use parent "Google::RestApi::SheetsApi4::Request";
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 0 ▶sub spreadsheet_id { LOGDIE "Pure virtual function 'spreadsheet_id' must be overridden"; }
Subroutine spreadsheet_id: not called CC=1 SCAR=6.9
Pod undocumented
10  
11 1 ▶sub delete_protected_range {
Subroutine delete_protected_range: called CC=1 SCAR=0.0
Pod undocumented
12 1 my $self = shift;
13  
14 1 state $check = signature(positional => [Str]);
15 1 my ($id) = $check->(@_);
16  
17 1 $self->batch_requests(
18 deleteProtectedRange => {
19 protectedRangeId => $id,
20 },
21 );
22  
23 1 return $self;
24 }
25  
26 0 ▶sub add_worksheet {
Subroutine add_worksheet: not called CC=7 SCAR=40.3
Pod undocumented
27 0 my $self = shift;
28  
29 0 state $check = signature(
30 bless => !!0,
31 named => [
32 name => Optional[Str],
33 title => Optional[Str],
34 grid_properties => Optional[Dict[ rows => Optional[Int], cols => Optional[Int] ]],
35 tab_color => Optional[Dict[ red => Optional[Num], blue => Optional[Num], green => Optional[Num] ]],
36 ],
37 );
38 0 my $p = $check->(@_);
39  
40 0 my %properties;
41 0 ▶ $properties{title} = $p->{title} if $p->{title};
Branch: 1 branch
BranchTrueFalseTotal
if $$p{"title"} 0 0 0
42 0 ▶ $properties{title} = $p->{name} if $p->{name};
Branch: 1 branch
BranchTrueFalseTotal
if $$p{"name"} 0 0 0
43 0 ▶ $properties{tabColor} = $p->{tab_color} if $p->{tab_color};
Branch: 1 branch
BranchTrueFalseTotal
if $$p{"tab_color"} 0 0 0
44  
45 0 ▶ $p->{grid_properties}->{rowCount} = delete $p->{grid_properties}->{rows} if $p->{grid_properties}->{rows};
Branch: 1 branch
BranchTrueFalseTotal
if $$p{"grid_properties"}{"rows"} 0 0 0
46 0 ▶ $p->{grid_properties}->{columnCount} = delete $p->{grid_properties}->{cols} if $p->{grid_properties}->{cols};
Branch: 1 branch
BranchTrueFalseTotal
if $$p{"grid_properties"}{"cols"} 0 0 0
47 0 ▶ $properties{gridProperties} = $p->{grid_properties} if $p->{grid_properties};
Branch: 1 branch
BranchTrueFalseTotal
if $$p{"grid_properties"} 0 0 0
48  
49 0 $self->batch_requests(addSheet => { properties => \%properties });
50  
51 0 return $self;
52 }
53  
54 6 ▶sub update_spreadsheet_properties {
Subroutine update_spreadsheet_properties: called CC=2 SCAR=7.0
Pod undocumented
55 6 my $self = shift;
56  
57 6 state $check = signature(
58 bless => !!0,
59 named => [
60 properties => HashRef,
61 fields => Str, { optional => 1 },
62 ],
63 );
64 6 my $p = $check->(@_);
65  
66 6 my $properties = $p->{properties};
67 6 ▶ my $fields = $p->{fields} || join(',', sort keys %$properties);
Condition66%2/3
$$p{'fields'} || join(',', sort(keys %$properties))
l!l&&r!l&&!r
240
MC/DC0%0/2
$$p{'fields'} || join(',', sort(keys %$properties))
$$p{'fields'} join(',', sort(keys %$properties))
Truth table66%2/3
A || B
A= $$p{'fields'}B= join(',', sort(keys %$properties))
ABresult
1X1
011
000
68  
69 6 $self->batch_requests(
70 updateSpreadsheetProperties => {
71 properties => $properties,
72 fields => $fields,
73 },
74 );
75  
76 6 return $self;
77 }
78  
79 1 ▶sub ss_title { shift->update_spreadsheet_properties(properties => { title => shift }); }
Subroutine ss_title: called CC=1 SCAR=0.0
Pod undocumented
80 1 ▶sub ss_locale { shift->update_spreadsheet_properties(properties => { locale => shift }); }
Subroutine ss_locale: called CC=1 SCAR=0.0
Pod undocumented
81 1 ▶sub ss_time_zone { shift->update_spreadsheet_properties(properties => { timeZone => shift }); }
Subroutine ss_time_zone: called CC=1 SCAR=0.0
Pod undocumented
82 1 ▶sub ss_auto_recalc { shift->update_spreadsheet_properties(properties => { autoRecalc => shift }); }
Subroutine ss_auto_recalc: called CC=1 SCAR=0.0
Pod undocumented
83 1 ▶sub ss_iteration_count {
Subroutine ss_iteration_count: called CC=1 SCAR=0.0
Pod undocumented
84 1 my $self = shift;
85 1 $self->update_spreadsheet_properties(
86 properties => { iterativeCalculationSettings => { maxIterations => shift } },
87 fields => 'iterativeCalculationSettings.maxIterations',
88 );
89 }
90 1 ▶sub ss_iteration_threshold {
Subroutine ss_iteration_threshold: called CC=1 SCAR=0.0
Pod undocumented
91 1 my $self = shift;
92 1 $self->update_spreadsheet_properties(
93 properties => { iterativeCalculationSettings => { convergenceThreshold => shift } },
94 fields => 'iterativeCalculationSettings.convergenceThreshold',
95 );
96 }
97 0 ▶sub ss_default_format {
Subroutine ss_default_format: not called CC=1 SCAR=6.9
Pod undocumented
98 0 my $self = shift;
99 0 $self->update_spreadsheet_properties(
100 properties => { defaultFormat => shift },
101 fields => 'defaultFormat',
102 );
103 }
104  
105 1 ▶sub add_protected_range {
Subroutine add_protected_range: called CC=5 SCAR=16.6
Pod undocumented
106 1 my $self = shift;
107  
108 1 state $check = signature(
109 bless => !!0,
110 named => [
111 range => HashRef,
112 description => Optional[Str],
113 warning_only => Optional[Bool],
114 requesting_user => Optional[Bool],
115 editors => Optional[HashRef],
116 ],
117 );
118 1 my $p = $check->(@_);
119  
120 1 my %protected_range = (range => $p->{range});
121 1 ▶ $protected_range{description} = $p->{description} if defined $p->{description};
Branch: 1 branch
BranchTrueFalseTotal
if defined $$p{"description"} 1 0 1
122 1 ▶ $protected_range{warningOnly} = bool($p->{warning_only}) if defined $p->{warning_only};
Branch: 1 branch
BranchTrueFalseTotal
if defined $$p{"warning_only"} 0 1 1
123 1 ▶ $protected_range{requestingUserCanEdit} = bool($p->{requesting_user}) if defined $p->{requesting_user};
Branch: 1 branch
BranchTrueFalseTotal
if defined $$p{"requesting_user"} 0 1 1
124 1 ▶ $protected_range{editors} = $p->{editors} if $p->{editors};
Branch: 1 branch
BranchTrueFalseTotal
if $$p{"editors"} 0 1 1
125  
126 1 $self->batch_requests(
127 addProtectedRange => {
128 protectedRange => \%protected_range,
129 },
130 );
131  
132 1 return $self;
133 }
134  
135 1 ▶sub update_protected_range {
Subroutine update_protected_range: called CC=12 SCAR=27.5
Pod undocumented
136 1 my $self = shift;
137  
138 1 state $check = signature(
139 bless => !!0,
140 named => [
141 id => Str,
142 range => Optional[HashRef],
143 description => Optional[Str],
144 warning_only => Optional[Bool],
145 requesting_user => Optional[Bool],
146 editors => Optional[HashRef],
147 fields => Optional[Str],
148 ],
149 );
150 1 my $p = $check->(@_);
151  
152 1 my %protected_range = (protectedRangeId => $p->{id});
153 1 ▶ $protected_range{range} = $p->{range} if $p->{range};
Branch: 1 branch
BranchTrueFalseTotal
if $$p{"range"} 1 0 1
154 1 ▶ $protected_range{description} = $p->{description} if defined $p->{description};
Branch: 1 branch
BranchTrueFalseTotal
if defined $$p{"description"} 1 0 1
155 1 ▶ $protected_range{warningOnly} = bool($p->{warning_only}) if defined $p->{warning_only};
Branch: 1 branch
BranchTrueFalseTotal
if defined $$p{"warning_only"} 0 1 1
156 1 ▶ $protected_range{requestingUserCanEdit} = bool($p->{requesting_user}) if defined $p->{requesting_user};
Branch: 1 branch
BranchTrueFalseTotal
if defined $$p{"requesting_user"} 0 1 1
157 1 ▶ $protected_range{editors} = $p->{editors} if $p->{editors};
Branch: 1 branch
BranchTrueFalseTotal
if $$p{"editors"} 0 1 1
158  
159 1 my @field_list;
160 1 ▶ push @field_list, 'range' if $p->{range};
Branch: 1 branch
BranchTrueFalseTotal
if $$p{"range"} 1 0 1
161 1 ▶ push @field_list, 'description' if defined $p->{description};
Branch: 1 branch
BranchTrueFalseTotal
if defined $$p{"description"} 1 0 1
162 1 ▶ push @field_list, 'warningOnly' if defined $p->{warning_only};
Branch: 1 branch
BranchTrueFalseTotal
if defined $$p{"warning_only"} 0 1 1
163 1 ▶ push @field_list, 'requestingUserCanEdit' if defined $p->{requesting_user};
Branch: 1 branch
BranchTrueFalseTotal
if defined $$p{"requesting_user"} 0 1 1
164 1 ▶ push @field_list, 'editors' if $p->{editors};
Branch: 1 branch
BranchTrueFalseTotal
if $$p{"editors"} 0 1 1
165 1 ▶ my $fields = $p->{fields} || join(',', @field_list);
Condition33%1/3
$$p{'fields'} || join(',', @field_list)
l!l&&r!l&&!r
010
MC/DC0%0/2
$$p{'fields'} || join(',', @field_list)
$$p{'fields'} join(',', @field_list)
Truth table33%1/3
A || B
A= $$p{'fields'}B= join(',', @field_list)
ABresult
1X1
011
000
166  
167 1 $self->batch_requests(
168 updateProtectedRange => {
169 protectedRange => \%protected_range,
170 fields => $fields,
171 },
172 );
173  
174 1 return $self;
175 }
176  
177 2 1;
178  
179 __END__
« RestApi/DriveApi3/Changes.pm ↑ Summary RestApi/DriveApi3/Drive.pm »