Twilio/Rest/Marketplace/V1/InstalledAddOn.pm

filter: Statementstmt 82.4% 89 / 108 Branchbran 100% 2 / 2 Conditioncond 55.5% 5 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 79.0% 34 / 43 Podpod n/a totaltotal 77.8% 130 / 167 CC 6 SCAR 3.3
CC
6
Cov
81%
create
2.0
page
2.0
update
2.0
CRAP 1.4
« Twilio/Rest/Events/V1/Subscription/SubscribedEvent.pm ↑ Summary Twilio/Rest/Video/V1/Room/Participant.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Marketplace::V1::InstalledAddOn;
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::Marketplace::V1::InstalledAddOnList;
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 9 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 9 my ($class, $version) = @_;
17 9 my $self = $class->SUPER::new($version);
18 9 $self->{solution} = {};
19 9 $self->{uri} = '/InstalledAddOns';
20 9 return $self;
21 }
22  
23 1 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
24 1 my ($self, $available_add_on_sid, $accept_terms_of_service, $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 AvailableAddOnSid => $available_add_on_sid,
29 AcceptTermsOfService => Twilio::Serialize::boolean_to_string($accept_terms_of_service),
30 Configuration => Twilio::Serialize::json_object($options->{configuration}),
31 UniqueName => $options->{unique_name},
32 1 };
33  
34 my $response =
35 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
36 return Twilio::Rest::Marketplace::V1::InstalledAddOnInstance->new($self->{version},
37 1 $response->get_content);
38 }
39  
40 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
41 0 my ($self, @arguments) = @_;
42 0 return $self->read_records(@arguments);
43 }
44  
45 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
46 0 my ($self, @arguments) = @_;
47 0 return $self->stream_records(@arguments);
48 }
49  
50 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
51 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
52 1 ▶ $options //= {};
Condition50%1/2
$options //= {}
l!l
01
MC/DC0%0/1
$options //= {}
$options
Truth table50%1/2
A
A= $options
Aresult
11
00
53  
54 1 my $params = {
55 PageToken => $page_token,
56 Page => $page_number,
57 PageSize => $page_size,
58 };
59  
60 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
61 1 return $self->_build_page($response);
62 }
63  
64 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
65 0 my ($self, $target_url) = @_;
66 0 my $client = $self->{version}->get_domain->get_client;
67 0 return $self->_build_page($client->request('GET', $target_url));
68 }
69  
70 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
71 1 my ($self, $response) = @_;
72 return Twilio::Rest::Marketplace::V1::InstalledAddOnPage->new($self->{version}, $response,
73 1 $self->{solution});
74 }
75  
76 7 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
77 7 my ($self, $sid) = @_;
78 7 return Twilio::Rest::Marketplace::V1::InstalledAddOnContext->new($self->{version}, $sid);
79 }
80  
81 package Twilio::Rest::Marketplace::V1::InstalledAddOnPage;
82  
83 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
84  
85 1 ▶sub records_key { return 'installed_add_ons' }
Subroutine records_key: called CC=1 SCAR=0.0
86  
87 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
88 1 my ($self, $payload) = @_;
89 1 return Twilio::Rest::Marketplace::V1::InstalledAddOnInstance->new($self->{version}, $payload);
90 }
91  
92 package Twilio::Rest::Marketplace::V1::InstalledAddOnContext;
93  
94 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
95  
96 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
97  
98 7 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
99 7 my ($class, $version, $sid) = @_;
100 7 my $self = $class->SUPER::new($version);
101 7 $self->{solution} = { sid => $sid };
102 7 $self->{uri} = join q{}, '/InstalledAddOns/', Twilio::Serialize::path_segment($sid);
103 7 return $self;
104 }
105  
106 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
107 1 my ($self) = @_;
108 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
109 1 return 1;
110 }
111  
112 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
113 1 my ($self) = @_;
114  
115 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
116 1 return $self->_build_instance($response);
117 }
118  
119 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
120 1 my ($self, $options) = @_;
121 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
122  
123 my $data = {
124 Configuration => Twilio::Serialize::json_object($options->{configuration}),
125 UniqueName => $options->{unique_name},
126 1 };
127  
128 my $response =
129 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
130 1 return $self->_build_instance($response);
131 }
132  
133 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
134 2 my ($self, $response) = @_;
135 return Twilio::Rest::Marketplace::V1::InstalledAddOnInstance->new($self->{version},
136 2 $response->get_content, $self->{solution}{sid});
137 }
138  
139 3 ▶sub extensions {
Subroutine extensions: called CC=2 SCAR=6.9
140 3 my ($self, $sid) = @_;
141 3 require Twilio::Rest::Marketplace::V1::InstalledAddOn::InstalledAddOnExtension;
142 my $list = Twilio::Rest::Marketplace::V1::InstalledAddOn::InstalledAddOnExtensionList->new(
143 3 $self->{version}, $self->{solution}{sid});
144 3 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 2 1 3
145 }
146  
147 1 ▶sub usage {
Subroutine usage: called CC=1 SCAR=0.0
148 1 my ($self) = @_;
149 1 require Twilio::Rest::Marketplace::V1::InstalledAddOn::InstalledAddOnUsage;
150 return Twilio::Rest::Marketplace::V1::InstalledAddOn::InstalledAddOnUsageList->new(
151 1 $self->{version}, $self->{solution}{sid});
152 }
153  
154 package Twilio::Rest::Marketplace::V1::InstalledAddOnInstance;
155  
156 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
157  
158 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
159  
160 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
161 4 my ($class, $version, $payload, $sid) = @_;
162 4 my $self = $class->SUPER::new($version, $payload);
163 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
164 4 return $self;
165 }
166  
167 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
168 0 my ($self, @arguments) = @_;
169 0 return $self->_context->delete(@arguments);
170 }
171  
172 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
173 0 my ($self, @arguments) = @_;
174 0 return $self->_context->fetch(@arguments);
175 }
176  
177 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
178 0 my ($self, @arguments) = @_;
179 0 return $self->_context->update(@arguments);
180 }
181  
182 0 ▶sub extensions {
Subroutine extensions: not called CC=1 SCAR=6.9
183 0 my ($self, @arguments) = @_;
184 0 return $self->_context->extensions(@arguments);
185 }
186  
187 0 ▶sub usage {
Subroutine usage: not called CC=1 SCAR=6.9
188 0 my ($self, @arguments) = @_;
189 0 return $self->_context->usage(@arguments);
190 }
191  
192 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
193 0 my ($self) = @_;
194 return Twilio::Rest::Marketplace::V1::InstalledAddOnContext->new($self->{version},
195 0 $self->{solution}{sid});
196 }
197  
198 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
199 4 ▶sub configuration { return $_[0]{properties}{configuration} }
Subroutine configuration: called CC=1 SCAR=0.0
200 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
201 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
202 4 ▶sub description { return $_[0]{properties}{description} }
Subroutine description: called CC=1 SCAR=0.0
203 4 ▶sub friendly_name { return $_[0]{properties}{friendly_name} }
Subroutine friendly_name: called CC=1 SCAR=0.0
204 4 ▶sub links { return $_[0]{properties}{links} }
Subroutine links: called CC=1 SCAR=0.0
205 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
206 4 ▶sub unique_name { return $_[0]{properties}{unique_name} }
Subroutine unique_name: called CC=1 SCAR=0.0
207 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
208  
209 2 1;
210  
211 __END__
« Twilio/Rest/Events/V1/Subscription/SubscribedEvent.pm ↑ Summary Twilio/Rest/Video/V1/Room/Participant.pm »