RestApi/CalendarApi3/CalendarList.pm

filter: Statementstmt 47.7% 21 / 44 Branchbran 7.1% 1 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 63.6% 7 / 11 Podpod 85.7% 6 / 7 totaltotal 46.0% 35 / 76 CC 8 SCAR 31.2
CC
8
Cov
38%
update
56.0
get
2.0
insert
2.0
CRAP 22.7
« RestApi/SheetsApi4/Request.pm ↑ Summary RestApi/DriveApi3/Changes.pm »
1 package Google::RestApi::CalendarApi3::CalendarList;
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::SubResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 4 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
10 4 my $class = shift;
11 4 state $check = signature(
12 bless => !!0,
13 named => [
14 calendar_api => HasApi,
15 id => Str, { optional => 1 },
16 ],
17 );
18 4 return bless $check->(@_), $class;
19 }
20  
21 1 ▶sub _uri_base { 'users/me/calendarList' }
Subroutine _uri_base: called CC=1 SCAR=0.0
22 1 ▶sub _parent_accessor { 'calendar_api' }
Subroutine _parent_accessor: called CC=1 SCAR=0.0
23  
24 1 ▶sub get {
Subroutine get: called CC=2 SCAR=7.0
Pod documented
25 1 my $self = shift;
26 1 state $check = signature(
27 bless => !!0,
28 named => [
29 fields => Str, { optional => 1 },
30 ],
31 );
32 1 my $p = $check->(@_);
33  
34 1 $self->require_id('get');
35  
36 1 my %params;
37 1 ▶ $params{fields} = $p->{fields} if defined $p->{fields};
Branch: 1 branch
BranchTrueFalseTotal
if defined $$p{"fields"} 0 1 1
38  
39 1 return $self->api(params => \%params);
40 }
41  
42 0 ▶sub insert {
Subroutine insert: not called CC=1 SCAR=6.9
Pod documented
43 0 my $self = shift;
44 0 state $check = signature(
45 bless => !!0,
46 named => [
47 id => Str,
48 _extra_ => slurpy HashRef,
49 ],
50 );
51 0 my $p = named_extra($check->(@_));
52  
53 my %content = (
54 id => delete $p->{id},
55 0 );
56  
57 0 DEBUG(sprintf("Inserting calendar '%s' into calendar list", $content{id}));
58 0 my $result = $self->calendar_api()->api(
59 uri => 'users/me/calendarList',
60 method => 'post',
61 content => \%content,
62 );
63 0 return ref($self)->new(calendar_api => $self->calendar_api(), id => $result->{id});
64 }
65  
66 0 ▶sub update {
Subroutine update: not called CC=7 SCAR=40.3
Pod documented
67 0 my $self = shift;
68 0 state $check = signature(
69 bless => !!0,
70 named => [
71 summary_override => Str, { optional => 1 },
72 color_id => Str, { optional => 1 },
73 hidden => Bool, { optional => 1 },
74 selected => Bool, { optional => 1 },
75 _extra_ => slurpy HashRef,
76 ],
77 );
78 0 my $p = named_extra($check->(@_));
79  
80 0 $self->require_id('update');
81  
82 0 my %content;
83 0 ▶ $content{summaryOverride} = delete $p->{summary_override} if defined $p->{summary_override};
Branch: 1 branch
BranchTrueFalseTotal
if defined $$p{"summary_override"} 0 0 0
84 0 ▶ $content{colorId} = delete $p->{color_id} if defined $p->{color_id};
Branch: 1 branch
BranchTrueFalseTotal
if defined $$p{"color_id"} 0 0 0
85 0 ▶ $content{hidden} = delete $p->{hidden} ? JSON::MaybeXS::true() : JSON::MaybeXS::false() if defined $p->{hidden};
Branch: 2 branches
BranchTrueFalseTotal
if defined $$p{"hidden"} 0 0 0
delete $$p{'hidden'} ? : 0 0 0
86 0 ▶ $content{selected} = delete $p->{selected} ? JSON::MaybeXS::true() : JSON::MaybeXS::false() if defined $p->{selected};
Branch: 2 branches
BranchTrueFalseTotal
if defined $$p{"selected"} 0 0 0
delete $$p{'selected'} ? : 0 0 0
87  
88 0 DEBUG(sprintf("Updating calendar list entry '%s'", $self->{id}));
89 0 return $self->api(
90 method => 'patch',
91 content => \%content,
92 );
93 }
94  
95 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
Pod documented
96 0 my $self = shift;
97  
98 0 $self->require_id('delete');
99  
100 0 DEBUG(sprintf("Deleting calendar list entry '%s'", $self->{id}));
101 0 return $self->api(method => 'delete');
102 }
103  
104 0 ▶sub calendar_list_id { shift->{id}; }
Subroutine calendar_list_id: not called CC=1 SCAR=6.9
Pod documented
105 1 ▶sub calendar_api { shift->{calendar_api}; }
Subroutine calendar_api: called CC=1 SCAR=0.0
Pod documented
106  
107 2 1;
108  
109 __END__
« RestApi/SheetsApi4/Request.pm ↑ Summary RestApi/DriveApi3/Changes.pm »