Twilio/Rest/Preview/Marketplace/InstalledAddOn.pm

filter: Statementstmt 83.5% 86 / 103 Branchbran 100% 2 / 2 Conditioncond 55.5% 5 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 80.4% 33 / 41 Podpod n/a totaltotal 78.7% 126 / 160 CC 6 SCAR 3.3
CC
6
Cov
82%
create
2.0
page
2.0
update
2.0
CRAP 1.4
« Twilio/Rest/FlexApi/V1/WebChannel.pm ↑ Summary Twilio/Rest/Studio/V2/Flow.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Preview::Marketplace::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::Preview::Marketplace::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 8 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 8 my ($class, $version) = @_;
17 8 my $self = $class->SUPER::new($version);
18 8 $self->{solution} = {};
19 8 $self->{uri} = '/InstalledAddOns';
20 8 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::Preview::Marketplace::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::Preview::Marketplace::InstalledAddOnPage->new($self->{version}, $response,
73 1 $self->{solution});
74 }
75  
76 6 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
77 6 my ($self, $sid) = @_;
78 6 return Twilio::Rest::Preview::Marketplace::InstalledAddOnContext->new($self->{version}, $sid);
79 }
80  
81 package Twilio::Rest::Preview::Marketplace::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 return Twilio::Rest::Preview::Marketplace::InstalledAddOnInstance->new($self->{version},
90 1 $payload);
91 }
92  
93 package Twilio::Rest::Preview::Marketplace::InstalledAddOnContext;
94  
95 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
96  
97 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
98  
99 6 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
100 6 my ($class, $version, $sid) = @_;
101 6 my $self = $class->SUPER::new($version);
102 6 $self->{solution} = { sid => $sid };
103 6 $self->{uri} = join q{}, '/InstalledAddOns/', Twilio::Serialize::path_segment($sid);
104 6 return $self;
105 }
106  
107 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
108 1 my ($self) = @_;
109 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
110 1 return 1;
111 }
112  
113 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
114 1 my ($self) = @_;
115  
116 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
117 1 return $self->_build_instance($response);
118 }
119  
120 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
121 1 my ($self, $options) = @_;
122 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
123  
124 my $data = {
125 Configuration => Twilio::Serialize::json_object($options->{configuration}),
126 UniqueName => $options->{unique_name},
127 1 };
128  
129 my $response =
130 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
131 1 return $self->_build_instance($response);
132 }
133  
134 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
135 2 my ($self, $response) = @_;
136 return Twilio::Rest::Preview::Marketplace::InstalledAddOnInstance->new($self->{version},
137 2 $response->get_content, $self->{solution}{sid});
138 }
139  
140 3 ▶sub extensions {
Subroutine extensions: called CC=2 SCAR=6.9
141 3 my ($self, $sid) = @_;
142 3 require Twilio::Rest::Preview::Marketplace::InstalledAddOn::InstalledAddOnExtension;
143 my $list = Twilio::Rest::Preview::Marketplace::InstalledAddOn::InstalledAddOnExtensionList->new(
144 3 $self->{version}, $self->{solution}{sid});
145 3 ▶ return defined $sid ? $list->get_context($sid) : $list;
Branch: 1 branch
BranchTrueFalseTotal
defined $sid ? : 2 1 3
146 }
147  
148 package Twilio::Rest::Preview::Marketplace::InstalledAddOnInstance;
149  
150 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
151  
152 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
153  
154 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
155 4 my ($class, $version, $payload, $sid) = @_;
156 4 my $self = $class->SUPER::new($version, $payload);
157 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
158 4 return $self;
159 }
160  
161 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
162 0 my ($self, @arguments) = @_;
163 0 return $self->_context->delete(@arguments);
164 }
165  
166 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
167 0 my ($self, @arguments) = @_;
168 0 return $self->_context->fetch(@arguments);
169 }
170  
171 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
172 0 my ($self, @arguments) = @_;
173 0 return $self->_context->update(@arguments);
174 }
175  
176 0 ▶sub extensions {
Subroutine extensions: not called CC=1 SCAR=6.9
177 0 my ($self, @arguments) = @_;
178 0 return $self->_context->extensions(@arguments);
179 }
180  
181 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
182 0 my ($self) = @_;
183 return Twilio::Rest::Preview::Marketplace::InstalledAddOnContext->new($self->{version},
184 0 $self->{solution}{sid});
185 }
186  
187 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
188 4 ▶sub configuration { return $_[0]{properties}{configuration} }
Subroutine configuration: called CC=1 SCAR=0.0
189 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
190 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
191 4 ▶sub description { return $_[0]{properties}{description} }
Subroutine description: called CC=1 SCAR=0.0
192 4 ▶sub friendly_name { return $_[0]{properties}{friendly_name} }
Subroutine friendly_name: called CC=1 SCAR=0.0
193 4 ▶sub links { return $_[0]{properties}{links} }
Subroutine links: called CC=1 SCAR=0.0
194 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
195 4 ▶sub unique_name { return $_[0]{properties}{unique_name} }
Subroutine unique_name: called CC=1 SCAR=0.0
196 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
197  
198 2 1;
199  
200 __END__
« Twilio/Rest/FlexApi/V1/WebChannel.pm ↑ Summary Twilio/Rest/Studio/V2/Flow.pm »