RestApi/CalendarApi3/Calendar.pm

filter: Statementstmt 94.9% 56 / 59 Branchbran 50.0% 7 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 94.1% 16 / 17 Podpod 90.9% 10 / 11 totaltotal 88.1% 89 / 101 CC 8 SCAR 7.8
CC
8
Cov
86%
update
5.3
events
2.0
acl_rules
2.0
CRAP 2.2
« RestApi/SheetsApi4/Range/Cell.pm ↑ Summary RestApi/SheetsApi4/RangeGroup/Tie.pm »
1 package Google::RestApi::CalendarApi3::Calendar;
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 2 ▶use aliased 'Google::RestApi::CalendarApi3::Event';
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use aliased 'Google::RestApi::CalendarApi3::Acl';
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 16 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
13 16 my $class = shift;
14 16 state $check = signature(
15 bless => !!0,
16 named => [
17 calendar_api => HasApi,
18 id => Str,
19 ],
20 );
21 16 return bless $check->(@_), $class;
22 }
23  
24 13 ▶sub _uri_base { 'calendars' }
Subroutine _uri_base: called CC=1 SCAR=0.0
25 13 ▶sub _parent_accessor { 'calendar_api' }
Subroutine _parent_accessor: called CC=1 SCAR=0.0
26  
27 1 ▶sub get {
Subroutine get: called CC=2 SCAR=7.0
Pod documented
28 1 my $self = shift;
29 1 state $check = signature(
30 bless => !!0,
31 named => [
32 fields => Str, { optional => 1 },
33 params => HashRef, { default => {} },
34 ],
35 );
36 1 my $p = $check->(@_);
37  
38 1 my $params = $p->{params};
39 1 ▶ $params->{fields} = $p->{fields} if defined $p->{fields};
Branch: 1 branch
BranchTrueFalseTotal
if defined $$p{"fields"} 0 1 1
40  
41 1 return $self->api(params => $params);
42 }
43  
44 1 ▶sub update {
Subroutine update: called CC=5 SCAR=16.6
Pod documented
45 1 my $self = shift;
46 1 state $check = signature(
47 bless => !!0,
48 named => [
49 summary => Str, { optional => 1 },
50 description => Str, { optional => 1 },
51 location => Str, { optional => 1 },
52 time_zone => Str, { optional => 1 },
53 _extra_ => slurpy HashRef,
54 ],
55 );
56 1 my $p = named_extra($check->(@_));
57  
58 1 my %content;
59 1 ▶ $content{summary} = delete $p->{summary} if defined $p->{summary};
Branch: 1 branch
BranchTrueFalseTotal
if defined $$p{"summary"} 1 0 1
60 1 ▶ $content{description} = delete $p->{description} if defined $p->{description};
Branch: 1 branch
BranchTrueFalseTotal
if defined $$p{"description"} 0 1 1
61 1 ▶ $content{location} = delete $p->{location} if defined $p->{location};
Branch: 1 branch
BranchTrueFalseTotal
if defined $$p{"location"} 0 1 1
62 1 ▶ $content{timeZone} = delete $p->{time_zone} if defined $p->{time_zone};
Branch: 1 branch
BranchTrueFalseTotal
if defined $$p{"time_zone"} 0 1 1
63  
64 1 DEBUG(sprintf("Updating calendar '%s'", $self->{id}));
65 1 return $self->api(
66 method => 'put',
67 content => \%content,
68 );
69 }
70  
71 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
Pod documented
72 1 my $self = shift;
73 1 DEBUG(sprintf("Deleting calendar '%s'", $self->{id}));
74 1 return $self->api(method => 'delete');
75 }
76  
77 0 ▶sub clear {
Subroutine clear: not called CC=1 SCAR=6.9
Pod documented
78 0 my $self = shift;
79 0 DEBUG(sprintf("Clearing calendar '%s'", $self->{id}));
80 0 return $self->api(uri => 'clear', method => 'post');
81 }
82  
83 3 ▶sub event {
Subroutine event: called CC=1 SCAR=0.0
Pod documented
84 3 my $self = shift;
85 3 state $check = signature(
86 bless => !!0,
87 named => [
88 id => Str, { optional => 1 },
89 ],
90 );
91 3 my $p = $check->(@_);
92 3 return Event->new(calendar => $self, %$p);
93 }
94  
95 1 ▶sub events {
Subroutine events: called CC=2 SCAR=7.0
Pod documented
96 1 my $self = shift;
97 1 state $check = signature(
98 bless => !!0,
99 named => [
100 fields => Str, { optional => 1 },
101 max_pages => Int, { default => 0 },
102 page_callback => CodeRef, { optional => 1 },
103 params => HashRef, { default => {} },
104 ],
105 );
106 1 my $p = $check->(@_);
107  
108 return paginated_list(
109 api => $self,
110 uri => 'events',
111 result_key => 'items',
112 default_fields => 'items(id, summary, start, end)',
113 max_pages => $p->{max_pages},
114 params => $p->{params},
115 1 ▶ ($p->{page_callback} ? (page_callback => $p->{page_callback}) : ()),
Branch: 1 branch
BranchTrueFalseTotal
$$p{'page_callback'} ? : 0 1 1
116 );
117 }
118  
119 2 ▶sub acl {
Subroutine acl: called CC=1 SCAR=0.0
Pod documented
120 2 my $self = shift;
121 2 state $check = signature(
122 bless => !!0,
123 named => [
124 id => Str, { optional => 1 },
125 ],
126 );
127 2 my $p = $check->(@_);
128 2 return Acl->new(calendar => $self, %$p);
129 }
130  
131 1 ▶sub acl_rules {
Subroutine acl_rules: called CC=2 SCAR=7.0
Pod documented
132 1 my $self = shift;
133 1 state $check = signature(
134 bless => !!0,
135 named => [
136 fields => Str, { optional => 1 },
137 max_pages => Int, { default => 0 },
138 page_callback => CodeRef, { optional => 1 },
139 params => HashRef, { default => {} },
140 ],
141 );
142 1 my $p = $check->(@_);
143  
144 return paginated_list(
145 api => $self,
146 uri => 'acl',
147 result_key => 'items',
148 default_fields => 'items(id, role, scope)',
149 max_pages => $p->{max_pages},
150 params => $p->{params},
151 1 ▶ ($p->{page_callback} ? (page_callback => $p->{page_callback}) : ()),
Branch: 1 branch
BranchTrueFalseTotal
$$p{'page_callback'} ? : 0 1 1
152 );
153 }
154  
155 7 ▶sub calendar_id { shift->{id}; }
Subroutine calendar_id: called CC=1 SCAR=0.0
Pod documented
156 13 ▶sub calendar_api { shift->{calendar_api}; }
Subroutine calendar_api: called CC=1 SCAR=0.0
Pod documented
157  
158 2 1;
159  
160 __END__
« RestApi/SheetsApi4/Range/Cell.pm ↑ Summary RestApi/SheetsApi4/RangeGroup/Tie.pm »