RestApi/GmailApi1/Thread.pm

filter: Statementstmt 93.1% 41 / 44 Branchbran 50.0% 4 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 91.6% 11 / 12 Podpod 87.5% 7 / 8 totaltotal 87.5% 63 / 72 CC 5 SCAR 6.1
CC
5
Cov
87%
get
3.0
modify
3.0
thread_id
2.0
CRAP 1.8
« RestApi/DriveApi3.pm ↑ Summary RestApi/GmailApi1/Message.pm »
1 package Google::RestApi::GmailApi1::Thread;
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 6 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
10 6 my $class = shift;
11 6 state $check = signature(
12 bless => !!0,
13 named => [
14 gmail_api => HasApi,
15 id => Str, { optional => 1 },
16 ],
17 );
18 6 return bless $check->(@_), $class;
19 }
20  
21 4 ▶sub _uri_base { 'threads' }
Subroutine _uri_base: called CC=1 SCAR=0.0
22 4 ▶sub _parent_accessor { 'gmail_api' }
Subroutine _parent_accessor: called CC=1 SCAR=0.0
23  
24 2 ▶sub get {
Subroutine get: called CC=3 SCAR=11.1
Pod documented
25 2 my $self = shift;
26 2 state $check = signature(
27 bless => !!0,
28 named => [
29 format => Str, { optional => 1 },
30 fields => Str, { optional => 1 },
31 ],
32 );
33 2 my $p = $check->(@_);
34  
35 2 $self->require_id('get');
36  
37 1 my %params;
38 1 ▶ $params{format} = $p->{format} if defined $p->{format};
Branch: 1 branch
BranchTrueFalseTotal
if defined $$p{"format"} 0 1 1
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 2 ▶sub modify {
Subroutine modify: called CC=3 SCAR=11.1
Pod documented
45 2 my $self = shift;
46 2 state $check = signature(
47 bless => !!0,
48 named => [
49 add_label_ids => ArrayRef[Str], { default => [] },
50 remove_label_ids => ArrayRef[Str], { default => [] },
51 ],
52 );
53 2 my $p = $check->(@_);
54  
55 2 $self->require_id('modify');
56  
57 1 my %content;
58 1 ▶ $content{addLabelIds} = $p->{add_label_ids} if $p->{add_label_ids}->@*;
Branch: 1 branch
BranchTrueFalseTotal
if @{$$p{"add_label_ids"}} 1 0 1
59 1 ▶ $content{removeLabelIds} = $p->{remove_label_ids} if $p->{remove_label_ids}->@*;
Branch: 1 branch
BranchTrueFalseTotal
if @{$$p{"remove_label_ids"}} 1 0 1
60  
61 1 DEBUG(sprintf("Modifying thread '%s'", $self->{id}));
62 1 return $self->api(
63 uri => 'modify',
64 method => 'post',
65 content => \%content,
66 );
67 }
68  
69 2 ▶sub trash {
Subroutine trash: called CC=1 SCAR=0.0
Pod documented
70 2 my $self = shift;
71  
72 2 $self->require_id('trash');
73  
74 1 DEBUG(sprintf("Trashing thread '%s'", $self->{id}));
75 1 return $self->api(uri => 'trash', method => 'post');
76 }
77  
78 2 ▶sub untrash {
Subroutine untrash: called CC=1 SCAR=0.0
Pod documented
79 2 my $self = shift;
80  
81 2 $self->require_id('untrash');
82  
83 1 DEBUG(sprintf("Untrashing thread '%s'", $self->{id}));
84 1 return $self->api(uri => 'untrash', method => 'post');
85 }
86  
87 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=1.2
Pod documented
88 1 my $self = shift;
89  
90 1 $self->require_id('delete');
91  
92 0 DEBUG(sprintf("Deleting thread '%s'", $self->{id}));
93 0 return $self->api(method => 'delete');
94 }
95  
96 0 ▶sub thread_id { shift->{id}; }
Subroutine thread_id: not called CC=1 SCAR=6.9
Pod documented
97 4 ▶sub gmail_api { shift->{gmail_api}; }
Subroutine gmail_api: called CC=1 SCAR=0.0
Pod documented
98  
99 2 1;
100  
101 __END__
« RestApi/DriveApi3.pm ↑ Summary RestApi/GmailApi1/Message.pm »