Twilio/Jwt/Grants/VoiceGrant.pm

filter: Statementstmt 100% 44 / 44 Branchbran 100% 10 / 10 Conditioncond 100% 7 / 7 MC/DCmcdc 100% 4 / 4 Subroutinesub 100% 15 / 15 Podpod 100% 12 / 12 totaltotal 100% 92 / 92 CC 10 SCAR 14.1
CC
10
Cov
100%
get_payload
9.0
set_incoming_allow
2.0
BEGIN
1.0
CRAP 4.1
« Twilio/Serialize.pm ↑ Summary Twilio/Jwt/Validation/ClientValidationJwt.pm »
1 package Twilio::Jwt::Grants::VoiceGrant;
2  
3 2 ▶use 5.016;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use parent 'Twilio::Jwt::Grants::Grant';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 our $VERSION = '2.001';
9  
10 3 ▶sub get_grant_key { return 'voice' }
Subroutine get_grant_key: called CC=1 SCAR=0.0
Pod documented
11  
12 1 ▶sub get_incoming_allow { return $_[0]{incoming_allow} }
Subroutine get_incoming_allow: called CC=1 SCAR=0.0
Pod documented
13 2 ▶sub get_outgoing_application_sid { return $_[0]{outgoing_application_sid} }
Subroutine get_outgoing_application_sid: called CC=1 SCAR=0.0
Pod documented
14 1 ▶sub get_outgoing_application_params { return $_[0]{outgoing_application_params} }
Subroutine get_outgoing_application_params: called CC=1 SCAR=0.0
Pod documented
15 1 ▶sub get_push_credential_sid { return $_[0]{push_credential_sid} }
Subroutine get_push_credential_sid: called CC=1 SCAR=0.0
Pod documented
16 1 ▶sub get_endpoint_id { return $_[0]{endpoint_id} }
Subroutine get_endpoint_id: called CC=1 SCAR=0.0
Pod documented
17  
18 3 ▶sub set_incoming_allow {
Subroutine set_incoming_allow: called CC=2 SCAR=6.9
Pod documented
19 3 my ($self, $allow) = @_;
20 3 ▶ $self->{incoming_allow} = $allow ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$allow ? : 2 1 3
21 3 return $self;
22 }
23  
24 2 ▶sub set_outgoing_application_sid {
Subroutine set_outgoing_application_sid: called CC=1 SCAR=0.0
Pod documented
25 2 my ($self, $sid) = @_;
26 2 $self->{outgoing_application_sid} = $sid;
27 2 return $self;
28 }
29  
30 3 ▶sub set_outgoing_application {
Subroutine set_outgoing_application: called CC=1 SCAR=0.0
Pod documented
31 3 my ($self, $sid, $params) = @_;
32 3 $self->{outgoing_application_sid} = $sid;
33 3 $self->{outgoing_application_params} = $params;
34 3 return $self;
35 }
36  
37 2 ▶sub set_push_credential_sid {
Subroutine set_push_credential_sid: called CC=1 SCAR=0.0
Pod documented
38 2 my ($self, $sid) = @_;
39 2 $self->{push_credential_sid} = $sid;
40 2 return $self;
41 }
42  
43 2 ▶sub set_endpoint_id {
Subroutine set_endpoint_id: called CC=1 SCAR=0.0
Pod documented
44 2 my ($self, $endpoint_id) = @_;
45 2 $self->{endpoint_id} = $endpoint_id;
46 2 return $self;
47 }
48  
49 5 ▶sub get_payload {
Subroutine get_payload: called CC=9 SCAR=22.0
Pod documented
50 5 my ($self) = @_;
51  
52 5 my %payload;
53 5 ▶ $payload{incoming} = { allow => \1 } if $self->{incoming_allow};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"incoming_allow"} 3 2 5
54  
55 5 ▶ if (length($self->{outgoing_application_sid} // q{})) {
Branch: 1 branch
BranchTrueFalseTotal
if (length($self->{"outgoing_application_sid"} // "")) 4 1 5
Condition100%2/2
$self->{"outgoing_application_sid"} // ""
l!l
41
MC/DC100%1/1
$self->{"outgoing_application_sid"} // ""
$self->{"outgoing_application_sid"}
Truth table100%2/2
A
A= $self->{"outgoing_application_sid"}
Aresult
11
00
56 4 my %outgoing = (application_sid => $self->{outgoing_application_sid});
57 4 my $params = $self->{outgoing_application_params};
58 4 ▶ $outgoing{params} = $params if $params && %{$params};
Branch: 1 branch
BranchTrueFalseTotal
if $params and %{$params;} 2 2 4
Condition100%3/3
$params and %{$params;}
!ll&&!rl&&r
112
MC/DC100%2/2
$params and %{$params;}
$params %{$params;}
Truth table100%3/3
A and B
A= $paramsB= %{$params;}
ABresult
0X0
100
111
59 4 $payload{outgoing} = \%outgoing;
60 }
61  
62 5 for my $field (qw(push_credential_sid endpoint_id)) {
63 10 ▶ $payload{$field} = $self->{$field} if length($self->{$field} // q{});
Branch: 1 branch
BranchTrueFalseTotal
if length($self->{$field} // "") 6 4 10
Condition100%2/2
$self->{$field} // ""
l!l
64
MC/DC100%1/1
$self->{$field} // ""
$self->{$field}
Truth table100%2/2
A
A= $self->{$field}
Aresult
11
00
64 }
65 5 return \%payload;
66 }
67  
68 2 1;
69  
70 __END__
« Twilio/Serialize.pm ↑ Summary Twilio/Jwt/Validation/ClientValidationJwt.pm »