Twilio/Rest/Iam/V1/ApiKey.pm

filter: Statementstmt 88.0% 59 / 67 Branchbran n/a Conditioncond 40.0% 2 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 84.0% 21 / 25 Podpod n/a totaltotal 82.0% 82 / 100 CC 3 SCAR 2.7
CC
3
Cov
85%
new
2.1
update
2.0
delete
2.0
CRAP 1.3
« Twilio/Rest/Serverless/V1/Service/Environment/Deployment.pm ↑ Summary Twilio/Rest/FlexApi/V1/Assessments.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Iam::V1::ApiKey;
3  
4 2 ▶use 5.016;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 our $VERSION = '2.001';
8  
9 package Twilio::Rest::Iam::V1::ApiKeyList;
10  
11 2 ▶use parent 'Twilio::ListResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 3 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 3 my ($class, $version) = @_;
17 3 my $self = $class->SUPER::new($version);
18 3 $self->{solution} = {};
19 3 $self->{uri} = '/Keys';
20 3 return $self;
21 }
22  
23 3 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
24 3 my ($self, $sid) = @_;
25 3 return Twilio::Rest::Iam::V1::ApiKeyContext->new($self->{version}, $sid);
26 }
27  
28 package Twilio::Rest::Iam::V1::ApiKeyContext;
29  
30 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
31  
32 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
33  
34 3 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
35 3 my ($class, $version, $sid) = @_;
36 3 my $self = $class->SUPER::new($version);
37 3 $self->{solution} = { sid => $sid };
38 3 $self->{uri} = join q{}, '/Keys/', Twilio::Serialize::path_segment($sid);
39 3 return $self;
40 }
41  
42 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
43 1 my ($self) = @_;
44 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
45 1 return 1;
46 }
47  
48 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
49 1 my ($self) = @_;
50  
51 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
52 1 return $self->_build_instance($response);
53 }
54  
55 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
56 1 my ($self, $options) = @_;
57 1 ▶ $options //= {};
Condition50%1/2
$options //= {}
l!l
10
MC/DC0%0/1
$options //= {}
$options
Truth table50%1/2
A
A= $options
Aresult
11
00
58  
59 my $data = {
60 FriendlyName => $options->{friendly_name},
61 1 Policy => Twilio::Serialize::json_object($options->{policy}),
62 };
63  
64 my $response =
65 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
66 1 return $self->_build_instance($response);
67 }
68  
69 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
70 2 my ($self, $response) = @_;
71 return Twilio::Rest::Iam::V1::ApiKeyInstance->new($self->{version}, $response->get_content,
72 2 $self->{solution}{sid});
73 }
74  
75 package Twilio::Rest::Iam::V1::ApiKeyInstance;
76  
77 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
78  
79 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
80  
81 2 ▶sub new {
Subroutine new: called CC=2 SCAR=7.4
82 2 my ($class, $version, $payload, $sid) = @_;
83 2 my $self = $class->SUPER::new($version, $payload);
84 2 ▶ $self->{solution} = { sid => $sid // $self->{properties}{sid} };
Condition33%1/3
$sid // $self->{"properties"}{"sid"}
l!l&&r!l&&!r
200
MC/DC0%0/2
$sid // $self->{"properties"}{"sid"}
$sid $self->{"properties"}{"sid"}
Truth table33%1/3
A // B
A= $sidB= $self->{"properties"}{"sid"}
ABresult
1X1
011
000
85 2 return $self;
86 }
87  
88 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
89 0 my ($self, @arguments) = @_;
90 0 return $self->_context->delete(@arguments);
91 }
92  
93 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
94 0 my ($self, @arguments) = @_;
95 0 return $self->_context->fetch(@arguments);
96 }
97  
98 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
99 0 my ($self, @arguments) = @_;
100 0 return $self->_context->update(@arguments);
101 }
102  
103 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
104 0 my ($self) = @_;
105 0 return Twilio::Rest::Iam::V1::ApiKeyContext->new($self->{version}, $self->{solution}{sid});
106 }
107  
108 2 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
109 2 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
110 2 ▶sub friendly_name { return $_[0]{properties}{friendly_name} }
Subroutine friendly_name: called CC=1 SCAR=0.0
111 2 ▶sub policy { return $_[0]{properties}{policy} }
Subroutine policy: called CC=1 SCAR=0.0
112 2 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
113  
114 2 1;
115  
116 __END__
« Twilio/Rest/Serverless/V1/Service/Environment/Deployment.pm ↑ Summary Twilio/Rest/FlexApi/V1/Assessments.pm »