Twilio/Rest/FlexApi/V1/Plugin.pm

filter: Statementstmt 84.8% 84 / 99 Branchbran 100% 2 / 2 Conditioncond 54.5% 6 / 11 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 82.0% 32 / 39 Podpod n/a totaltotal 78.9% 124 / 157 CC 7 SCAR 3.5
CC
7
Cov
82%
fetch
2.0
create
2.0
page
2.0
CRAP 1.4
« Twilio/Rest/Sync/V1/Service/SyncMap.pm ↑ Summary Twilio/Rest/Supersim/V1/NetworkAccessProfile.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::FlexApi::V1::Plugin;
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::FlexApi::V1::PluginList;
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 7 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 7 my ($class, $version) = @_;
17 7 my $self = $class->SUPER::new($version);
18 7 $self->{solution} = {};
19 7 $self->{uri} = '/PluginService/Plugins';
20 7 return $self;
21 }
22  
23 1 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
24 1 my ($self, $unique_name, $options) = @_;
25 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
26  
27 my $data = {
28 UniqueName => $unique_name,
29 Description => $options->{description},
30 FriendlyName => $options->{friendly_name},
31 1 };
32  
33 my $response = $self->{version}->handle_request(
34 'POST',
35 $self->{uri},
36 'create',
37 {
38 data => $data,
39 headers => { 'Flex-Metadata' => $options->{flex_metadata}, }
40 }
41 1 );
42 1 return Twilio::Rest::FlexApi::V1::PluginInstance->new($self->{version}, $response->get_content);
43 }
44  
45 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
46 0 my ($self, @arguments) = @_;
47 0 return $self->read_records(@arguments);
48 }
49  
50 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
51 0 my ($self, @arguments) = @_;
52 0 return $self->stream_records(@arguments);
53 }
54  
55 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
56 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
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 1 my $params = {
60 PageToken => $page_token,
61 Page => $page_number,
62 PageSize => $page_size,
63 };
64  
65 my $response = $self->{version}->page(
66 'GET',
67 $self->{uri},
68 {
69 params => $params,
70 headers => { 'Flex-Metadata' => $options->{flex_metadata}, }
71 }
72 1 );
73 1 return $self->_build_page($response);
74 }
75  
76 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
77 0 my ($self, $target_url) = @_;
78 0 my $client = $self->{version}->get_domain->get_client;
79 0 return $self->_build_page($client->request('GET', $target_url));
80 }
81  
82 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
83 1 my ($self, $response) = @_;
84 1 return Twilio::Rest::FlexApi::V1::PluginPage->new($self->{version}, $response, $self->{solution});
85 }
86  
87 5 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
88 5 my ($self, $sid) = @_;
89 5 return Twilio::Rest::FlexApi::V1::PluginContext->new($self->{version}, $sid);
90 }
91  
92 package Twilio::Rest::FlexApi::V1::PluginPage;
93  
94 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
95  
96 1 ▶sub records_key { return 'plugins' }
Subroutine records_key: called CC=1 SCAR=0.0
97  
98 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
99 1 my ($self, $payload) = @_;
100 1 return Twilio::Rest::FlexApi::V1::PluginInstance->new($self->{version}, $payload);
101 }
102  
103 package Twilio::Rest::FlexApi::V1::PluginContext;
104  
105 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
106  
107 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
108  
109 5 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
110 5 my ($class, $version, $sid) = @_;
111 5 my $self = $class->SUPER::new($version);
112 5 $self->{solution} = { sid => $sid };
113 5 $self->{uri} = join q{}, '/PluginService/Plugins/', Twilio::Serialize::path_segment($sid);
114 5 return $self;
115 }
116  
117 1 ▶sub fetch {
Subroutine fetch: called CC=2 SCAR=7.0
118 1 my ($self, $options) = @_;
119 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
120  
121 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch',
122 1 { headers => { 'Flex-Metadata' => $options->{flex_metadata}, } });
123 1 return $self->_build_instance($response);
124 }
125  
126 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
127 1 my ($self, $options) = @_;
128 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
129  
130 my $data = {
131 Description => $options->{description},
132 FriendlyName => $options->{friendly_name},
133 1 };
134  
135 my $response = $self->{version}->handle_request(
136 'POST',
137 $self->{uri},
138 'update',
139 {
140 data => $data,
141 headers => { 'Flex-Metadata' => $options->{flex_metadata}, }
142 }
143 1 );
144 1 return $self->_build_instance($response);
145 }
146  
147 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
148 2 my ($self, $response) = @_;
149 return Twilio::Rest::FlexApi::V1::PluginInstance->new($self->{version}, $response->get_content,
150 2 $self->{solution}{sid});
151 }
152  
153 3 ▶sub plugin_versions {
Subroutine plugin_versions: called CC=2 SCAR=6.9
154 3 my ($self, $sid) = @_;
155 3 require Twilio::Rest::FlexApi::V1::Plugin::PluginVersions;
156 my $list = Twilio::Rest::FlexApi::V1::Plugin::PluginVersionsList->new($self->{version},
157 3 $self->{solution}{sid});
158 3 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 1 2 3
159 }
160  
161 package Twilio::Rest::FlexApi::V1::PluginInstance;
162  
163 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
164  
165 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
166  
167 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
168 4 my ($class, $version, $payload, $sid) = @_;
169 4 my $self = $class->SUPER::new($version, $payload);
170 4 ▶ $self->{solution} = { sid => $sid // $self->{properties}{sid} };
Condition66%2/3
$sid // $self->{"properties"}{"sid"}
l!l&&r!l&&!r
220
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
171 4 return $self;
172 }
173  
174 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
175 0 my ($self, @arguments) = @_;
176 0 return $self->_context->fetch(@arguments);
177 }
178  
179 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
180 0 my ($self, @arguments) = @_;
181 0 return $self->_context->update(@arguments);
182 }
183  
184 0 ▶sub plugin_versions {
Subroutine plugin_versions: not called CC=1 SCAR=6.9
185 0 my ($self, @arguments) = @_;
186 0 return $self->_context->plugin_versions(@arguments);
187 }
188  
189 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
190 0 my ($self) = @_;
191 0 return Twilio::Rest::FlexApi::V1::PluginContext->new($self->{version}, $self->{solution}{sid});
192 }
193  
194 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
195 4 ▶sub archived { return $_[0]{properties}{archived} }
Subroutine archived: called CC=1 SCAR=0.0
196 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
197 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
198 4 ▶sub description { return $_[0]{properties}{description} }
Subroutine description: called CC=1 SCAR=0.0
199 4 ▶sub friendly_name { return $_[0]{properties}{friendly_name} }
Subroutine friendly_name: called CC=1 SCAR=0.0
200 4 ▶sub links { return $_[0]{properties}{links} }
Subroutine links: called CC=1 SCAR=0.0
201 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
202 4 ▶sub unique_name { return $_[0]{properties}{unique_name} }
Subroutine unique_name: called CC=1 SCAR=0.0
203 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
204  
205 2 1;
206  
207 __END__
« Twilio/Rest/Sync/V1/Service/SyncMap.pm ↑ Summary Twilio/Rest/Supersim/V1/NetworkAccessProfile.pm »