File Coverage

lib/Google/RestApi/SheetsApi4/Request/Spreadsheet.pm
Criterion Covered Total %
statement 6 24 25.0
branch 0 12 0.0
condition n/a
subroutine 2 5 40.0
pod 0 3 0.0
total 8 44 18.1


line stmt bran cond sub pod time code
1              
2             our $VERSION = '1.0.2';
3              
4             use Google::RestApi::Setup;
5 1     1   453  
  1         3  
  1         6  
6             use parent "Google::RestApi::SheetsApi4::Request";
7 1     1   18871  
  1         2  
  1         6  
8              
9 0     0 0   my $self = shift;
10              
11             state $check = compile(Str);
12 0     0 0   my ($id) = $check->(@_);
13              
14 0           $self->batch_requests(
15 0           deleteProtectedRange => {
16             protectedRangeId => $id,
17 0           },
18             );
19              
20             return $self;
21             }
22              
23 0           my $self = shift;
24              
25             state $check = compile_named(
26             name => Optional[Str],
27 0     0 0   title => Optional[Str],
28             grid_properties => Optional[Dict[ rows => Optional[Int], cols => Optional[Int] ]],
29 0           tab_color => Optional[Dict[ red => Optional[Num], blue => Optional[Num], green => Optional[Num] ]],
30             );
31             my $p = $check->(@_);
32              
33             my %properties;
34             $properties{title} = $p->{title} if $p->{title};
35 0           $properties{title} = $p->{name} if $p->{name};
36             $properties{tabColor} = $p->{tab_color} if $p->{tab_color};
37 0          
38 0 0         $p->{grid_properties}->{rowCount} = delete $p->{grid_properties}->{rows} if $p->{grid_properties}->{rows};
39 0 0         $p->{grid_properties}->{columnCount} = delete $p->{grid_properties}->{cols} if $p->{grid_properties}->{cols};
40 0 0         $properties{gridProperties} = $p->{grid_properties} if $p->{grid_properties};
41            
42 0 0         $self->batch_requests(addSheet => { properties => \%properties });
43 0 0          
44 0 0         return $self;
45             }
46 0            
47             1;
48 0            
49              
50             =head1 NAME
51              
52             Google::RestApi::SheetsApi4::Request::Spreadsheet - Build Google API's batchRequests for a Spreadsheet.
53              
54             =head1 DESCRIPTION
55              
56             Deriving from the Request object, this adds the ability to create
57             requests that have to do with spreadsheet properties.
58              
59             See the description and synopsis at Google::RestApi::SheetsApi4::Request.
60             and Google::RestApi::SheetsApi4.
61              
62             =head1 AUTHORS
63              
64             =over
65              
66             =item
67              
68             Robin Murray mvsjes@cpan.org
69              
70             =back
71              
72             =head1 COPYRIGHT
73              
74             Copyright (c) 2021, Robin Murray. All rights reserved.
75              
76             This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.