Twilio/Rest/Messaging/V1/Service/UsAppToPerson.pm

filter: Statementstmt 87.2% 103 / 118 Branchbran n/a Conditioncond 63.6% 7 / 11 MC/DCmcdc 16.6% 1 / 6 Subroutinesub 88.1% 52 / 59 Podpod n/a totaltotal 84.0% 163 / 194 CC 6 SCAR 2.4
CC
6
Cov
85%
create
2.0
page
2.0
update
2.0
CRAP 1.3
« Twilio/Rest/Supersim/V1/IpCommand.pm ↑ Summary Twilio/Rest/FrontlineApi/V1/User.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Messaging::V1::Service::UsAppToPerson;
3  
4 3 ▶use 5.016;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 our $VERSION = '2.001';
8  
9 package Twilio::Rest::Messaging::V1::Service::UsAppToPersonList;
10  
11 3 ▶use parent 'Twilio::ListResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 3 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 6 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 6 my ($class, $version, $messaging_service_sid) = @_;
17 6 my $self = $class->SUPER::new($version);
18 6 $self->{solution} = { messaging_service_sid => $messaging_service_sid };
19 6 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($messaging_service_sid),
20 '/Compliance/Usa2p';
21 6 return $self;
22 }
23  
24 1 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
25 my (
26 1 $self, $brand_registration_sid, $description,
27 $message_flow, $message_samples, $us_app_to_person_usecase,
28 $has_embedded_links, $has_embedded_phone, $options
29 ) = @_;
30 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
31  
32 my $data = {
33 BrandRegistrationSid => $brand_registration_sid,
34 Description => $description,
35 MessageFlow => $message_flow,
36 MessageSamples => $message_samples,
37 UsAppToPersonUsecase => $us_app_to_person_usecase,
38 HasEmbeddedLinks => Twilio::Serialize::boolean_to_string($has_embedded_links),
39 HasEmbeddedPhone => Twilio::Serialize::boolean_to_string($has_embedded_phone),
40 AgeGated => Twilio::Serialize::boolean_to_string($options->{age_gated}),
41 DirectLending => Twilio::Serialize::boolean_to_string($options->{direct_lending}),
42 HelpKeywords => $options->{help_keywords},
43 HelpMessage => $options->{help_message},
44 OptInKeywords => $options->{opt_in_keywords},
45 OptInMessage => $options->{opt_in_message},
46 OptOutKeywords => $options->{opt_out_keywords},
47 OptOutMessage => $options->{opt_out_message},
48 PrivacyPolicyUrl => $options->{privacy_policy_url},
49 SubscriberOptIn => Twilio::Serialize::boolean_to_string($options->{subscriber_opt_in}),
50 TermsAndConditionsUrl => $options->{terms_and_conditions_url},
51 1 };
52  
53 my $response = $self->{version}->handle_request(
54 'POST',
55 $self->{uri},
56 'create',
57 {
58 data => $data,
59 headers => { 'X-Twilio-Api-Version' => $options->{x_twilio_api_version}, }
60 }
61 1 );
62 return Twilio::Rest::Messaging::V1::Service::UsAppToPersonInstance->new($self->{version},
63 1 $response->get_content, $self->{solution}{messaging_service_sid});
64 }
65  
66 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
67 0 my ($self, @arguments) = @_;
68 0 return $self->read_records(@arguments);
69 }
70  
71 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
72 0 my ($self, @arguments) = @_;
73 0 return $self->stream_records(@arguments);
74 }
75  
76 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
77 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
78 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
79  
80 1 my $params = {
81 PageToken => $page_token,
82 Page => $page_number,
83 PageSize => $page_size,
84 };
85  
86 my $response = $self->{version}->page(
87 'GET',
88 $self->{uri},
89 {
90 params => $params,
91 headers => { 'X-Twilio-Api-Version' => $options->{x_twilio_api_version}, }
92 }
93 1 );
94 1 return $self->_build_page($response);
95 }
96  
97 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
98 0 my ($self, $target_url) = @_;
99 0 my $client = $self->{version}->get_domain->get_client;
100 0 return $self->_build_page($client->request('GET', $target_url));
101 }
102  
103 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
104 1 my ($self, $response) = @_;
105 return Twilio::Rest::Messaging::V1::Service::UsAppToPersonPage->new($self->{version}, $response,
106 1 $self->{solution});
107 }
108  
109 4 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
110 4 my ($self, $sid) = @_;
111 return Twilio::Rest::Messaging::V1::Service::UsAppToPersonContext->new($self->{version},
112 4 $self->{solution}{messaging_service_sid}, $sid);
113 }
114  
115 package Twilio::Rest::Messaging::V1::Service::UsAppToPersonPage;
116  
117 3 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
118  
119 1 ▶sub records_key { return 'compliance' }
Subroutine records_key: called CC=1 SCAR=0.0
120  
121 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
122 1 my ($self, $payload) = @_;
123 return Twilio::Rest::Messaging::V1::Service::UsAppToPersonInstance->new($self->{version},
124 1 $payload, $self->{solution}{messaging_service_sid});
125 }
126  
127 package Twilio::Rest::Messaging::V1::Service::UsAppToPersonContext;
128  
129 3 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
130  
131 3 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
132  
133 4 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
134 4 my ($class, $version, $messaging_service_sid, $sid) = @_;
135 4 my $self = $class->SUPER::new($version);
136 4 $self->{solution} = { messaging_service_sid => $messaging_service_sid, sid => $sid };
137 4 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($messaging_service_sid),
138 '/Compliance/Usa2p/', Twilio::Serialize::path_segment($sid);
139 4 return $self;
140 }
141  
142 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
143 1 my ($self) = @_;
144 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
145 1 return 1;
146 }
147  
148 2 ▶sub fetch {
Subroutine fetch: called CC=2 SCAR=6.9
149 2 my ($self, $options) = @_;
150 2 ▶ $options //= {};
Condition100%2/2
$options //= {}
l!l
11
MC/DC100%1/1
$options //= {}
$options
Truth table100%2/2
A
A= $options
Aresult
11
00
151  
152 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch',
153 2 { headers => { 'X-Twilio-Api-Version' => $options->{x_twilio_api_version}, } });
154 2 return $self->_build_instance($response);
155 }
156  
157 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
158 my (
159 1 $self, $has_embedded_links, $has_embedded_phone,
160 $message_samples, $message_flow, $description,
161 $age_gated, $direct_lending, $options
162 ) = @_;
163 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
164  
165 my $data = {
166 HasEmbeddedLinks => Twilio::Serialize::boolean_to_string($has_embedded_links),
167 HasEmbeddedPhone => Twilio::Serialize::boolean_to_string($has_embedded_phone),
168 MessageSamples => $message_samples,
169 MessageFlow => $message_flow,
170 Description => $description,
171 AgeGated => Twilio::Serialize::boolean_to_string($age_gated),
172 DirectLending => Twilio::Serialize::boolean_to_string($direct_lending),
173 PrivacyPolicyUrl => $options->{privacy_policy_url},
174 TermsAndConditionsUrl => $options->{terms_and_conditions_url},
175 1 };
176  
177 my $response = $self->{version}->handle_request(
178 'POST',
179 $self->{uri},
180 'update',
181 {
182 data => $data,
183 headers => { 'X-Twilio-Api-Version' => $options->{x_twilio_api_version}, }
184 }
185 1 );
186 1 return $self->_build_instance($response);
187 }
188  
189 3 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
190 3 my ($self, $response) = @_;
191 return Twilio::Rest::Messaging::V1::Service::UsAppToPersonInstance->new(
192 $self->{version}, $response->get_content,
193 $self->{solution}{messaging_service_sid},
194 $self->{solution}{sid}
195 3 );
196 }
197  
198 package Twilio::Rest::Messaging::V1::Service::UsAppToPersonInstance;
199  
200 3 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
201  
202 3 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
203  
204 5 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
205 5 my ($class, $version, $payload, $messaging_service_sid, $sid) = @_;
206 5 my $self = $class->SUPER::new($version, $payload);
207 $self->{solution} =
208 5 ▶ { messaging_service_sid => $messaging_service_sid, sid => $sid // $self->{properties}{sid} };
Condition66%2/3
$sid // $self->{"properties"}{"sid"}
l!l&&r!l&&!r
320
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
209 5 return $self;
210 }
211  
212 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
213 0 my ($self, @arguments) = @_;
214 0 return $self->_context->delete(@arguments);
215 }
216  
217 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
218 0 my ($self, @arguments) = @_;
219 0 return $self->_context->fetch(@arguments);
220 }
221  
222 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
223 0 my ($self, @arguments) = @_;
224 0 return $self->_context->update(@arguments);
225 }
226  
227 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
228 0 my ($self) = @_;
229 return Twilio::Rest::Messaging::V1::Service::UsAppToPersonContext->new(
230 $self->{version},
231 $self->{solution}{messaging_service_sid},
232 $self->{solution}{sid}
233 0 );
234 }
235  
236 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
237 4 ▶sub age_gated { return $_[0]{properties}{age_gated} }
Subroutine age_gated: called CC=1 SCAR=0.0
238 4 ▶sub brand_registration_sid { return $_[0]{properties}{brand_registration_sid} }
Subroutine brand_registration_sid: called CC=1 SCAR=0.0
239 4 ▶sub campaign_id { return $_[0]{properties}{campaign_id} }
Subroutine campaign_id: called CC=1 SCAR=0.0
240 4 ▶sub campaign_status { return $_[0]{properties}{campaign_status} }
Subroutine campaign_status: called CC=1 SCAR=0.0
241 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
242 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
243 4 ▶sub description { return $_[0]{properties}{description} }
Subroutine description: called CC=1 SCAR=0.0
244 4 ▶sub direct_lending { return $_[0]{properties}{direct_lending} }
Subroutine direct_lending: called CC=1 SCAR=0.0
245 4 ▶sub errors { return $_[0]{properties}{errors} }
Subroutine errors: called CC=1 SCAR=0.0
246 4 ▶sub has_embedded_links { return $_[0]{properties}{has_embedded_links} }
Subroutine has_embedded_links: called CC=1 SCAR=0.0
247 4 ▶sub has_embedded_phone { return $_[0]{properties}{has_embedded_phone} }
Subroutine has_embedded_phone: called CC=1 SCAR=0.0
248 4 ▶sub help_keywords { return $_[0]{properties}{help_keywords} }
Subroutine help_keywords: called CC=1 SCAR=0.0
249 4 ▶sub help_message { return $_[0]{properties}{help_message} }
Subroutine help_message: called CC=1 SCAR=0.0
250 4 ▶sub is_externally_registered { return $_[0]{properties}{is_externally_registered} }
Subroutine is_externally_registered: called CC=1 SCAR=0.0
251 4 ▶sub message_flow { return $_[0]{properties}{message_flow} }
Subroutine message_flow: called CC=1 SCAR=0.0
252 4 ▶sub message_samples { return $_[0]{properties}{message_samples} }
Subroutine message_samples: called CC=1 SCAR=0.0
253 4 ▶sub messaging_service_sid { return $_[0]{properties}{messaging_service_sid} }
Subroutine messaging_service_sid: called CC=1 SCAR=0.0
254 4 ▶sub mock { return $_[0]{properties}{mock} }
Subroutine mock: called CC=1 SCAR=0.0
255 4 ▶sub opt_in_keywords { return $_[0]{properties}{opt_in_keywords} }
Subroutine opt_in_keywords: called CC=1 SCAR=0.0
256 4 ▶sub opt_in_message { return $_[0]{properties}{opt_in_message} }
Subroutine opt_in_message: called CC=1 SCAR=0.0
257 4 ▶sub opt_out_keywords { return $_[0]{properties}{opt_out_keywords} }
Subroutine opt_out_keywords: called CC=1 SCAR=0.0
258 4 ▶sub opt_out_message { return $_[0]{properties}{opt_out_message} }
Subroutine opt_out_message: called CC=1 SCAR=0.0
259 5 ▶sub privacy_policy_url { return $_[0]{properties}{privacy_policy_url} }
Subroutine privacy_policy_url: called CC=1 SCAR=0.0
260 4 ▶sub rate_limits { return $_[0]{properties}{rate_limits} }
Subroutine rate_limits: called CC=1 SCAR=0.0
261 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
262 4 ▶sub subscriber_opt_in { return $_[0]{properties}{subscriber_opt_in} }
Subroutine subscriber_opt_in: called CC=1 SCAR=0.0
263 4 ▶sub terms_and_conditions_url { return $_[0]{properties}{terms_and_conditions_url} }
Subroutine terms_and_conditions_url: called CC=1 SCAR=0.0
264 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
265 4 ▶sub us_app_to_person_usecase { return $_[0]{properties}{us_app_to_person_usecase} }
Subroutine us_app_to_person_usecase: called CC=1 SCAR=0.0
266  
267 3 1;
268  
269 __END__
« Twilio/Rest/Supersim/V1/IpCommand.pm ↑ Summary Twilio/Rest/FrontlineApi/V1/User.pm »