Twilio/Rest/Verify/V2/Service/AccessToken.pm

filter: Statementstmt 93.8% 61 / 65 Branchbran n/a Conditioncond 60.0% 3 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 92.5% 25 / 27 Podpod n/a totaltotal 89.0% 89 / 100 CC 3 SCAR 1.9
CC
3
Cov
91%
create
2.0
new
2.0
fetch
2.0
CRAP 1.2
« Twilio/Rest/Taskrouter/V1/Workspace/Workflow/WorkflowStatistics.pm ↑ Summary Twilio/Rest/Monitor/V1/Alert.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Verify::V2::Service::AccessToken;
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::Verify::V2::Service::AccessTokenList;
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, $service_sid) = @_;
17 3 my $self = $class->SUPER::new($version);
18 3 $self->{solution} = { service_sid => $service_sid };
19 3 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid),
20 '/AccessTokens';
21 3 return $self;
22 }
23  
24 2 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
25 2 my ($self, $identity, $factor_type, $options) = @_;
26 2 ▶ $options //= {};
Condition50%1/2
$options //= {}
l!l
20
MC/DC0%0/1
$options //= {}
$options
Truth table50%1/2
A
A= $options
Aresult
11
00
27  
28 my $data = {
29 Identity => $identity,
30 FactorType => $factor_type,
31 FactorFriendlyName => $options->{factor_friendly_name},
32 Ttl => $options->{ttl},
33 2 };
34  
35 my $response =
36 2 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
37 return Twilio::Rest::Verify::V2::Service::AccessTokenInstance->new($self->{version},
38 2 $response->get_content, $self->{solution}{service_sid});
39 }
40  
41 1 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
42 1 my ($self, $sid) = @_;
43 return Twilio::Rest::Verify::V2::Service::AccessTokenContext->new($self->{version},
44 1 $self->{solution}{service_sid}, $sid);
45 }
46  
47 package Twilio::Rest::Verify::V2::Service::AccessTokenContext;
48  
49 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
50  
51 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
52  
53 1 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
54 1 my ($class, $version, $service_sid, $sid) = @_;
55 1 my $self = $class->SUPER::new($version);
56 1 $self->{solution} = { service_sid => $service_sid, sid => $sid };
57 1 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid),
58 '/AccessTokens/', Twilio::Serialize::path_segment($sid);
59 1 return $self;
60 }
61  
62 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
63 1 my ($self) = @_;
64  
65 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
66 1 return $self->_build_instance($response);
67 }
68  
69 1 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
70 1 my ($self, $response) = @_;
71 return Twilio::Rest::Verify::V2::Service::AccessTokenInstance->new(
72 $self->{version}, $response->get_content,
73 $self->{solution}{service_sid}, $self->{solution}{sid}
74 1 );
75 }
76  
77 package Twilio::Rest::Verify::V2::Service::AccessTokenInstance;
78  
79 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
80  
81 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
82  
83 3 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
84 3 my ($class, $version, $payload, $service_sid, $sid) = @_;
85 3 my $self = $class->SUPER::new($version, $payload);
86 3 ▶ $self->{solution} = { service_sid => $service_sid, sid => $sid // $self->{properties}{sid} };
Condition66%2/3
$sid // $self->{"properties"}{"sid"}
l!l&&r!l&&!r
120
MC/DC0%0/2
$sid // $self->{"properties"}{"sid"}
$sid $self->{"properties"}{"sid"}
Truth table66%2/3
A // B
A= $sidB= $self->{"properties"}{"sid"}
ABresult
1X1
011
000
87 3 return $self;
88 }
89  
90 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
91 0 my ($self, @arguments) = @_;
92 0 return $self->_context->fetch(@arguments);
93 }
94  
95 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
96 0 my ($self) = @_;
97 return Twilio::Rest::Verify::V2::Service::AccessTokenContext->new(
98 $self->{version},
99 $self->{solution}{service_sid},
100 $self->{solution}{sid}
101 0 );
102 }
103  
104 3 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
105 3 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
106 3 ▶sub entity_identity { return $_[0]{properties}{entity_identity} }
Subroutine entity_identity: called CC=1 SCAR=0.0
107 3 ▶sub factor_friendly_name { return $_[0]{properties}{factor_friendly_name} }
Subroutine factor_friendly_name: called CC=1 SCAR=0.0
108 3 ▶sub factor_type { return $_[0]{properties}{factor_type} }
Subroutine factor_type: called CC=1 SCAR=0.0
109 3 ▶sub service_sid { return $_[0]{properties}{service_sid} }
Subroutine service_sid: called CC=1 SCAR=0.0
110 3 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
111 3 ▶sub token { return $_[0]{properties}{token} }
Subroutine token: called CC=1 SCAR=0.0
112 3 ▶sub ttl { return $_[0]{properties}{ttl} }
Subroutine ttl: called CC=1 SCAR=0.0
113 3 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
114  
115 2 1;
116  
117 __END__
« Twilio/Rest/Taskrouter/V1/Workspace/Workflow/WorkflowStatistics.pm ↑ Summary Twilio/Rest/Monitor/V1/Alert.pm »