Twilio/Rest/Api/V2010/Account/Address.pm

filter: Statementstmt 84.2% 91 / 108 Branchbran n/a Conditioncond 55.5% 5 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 82.9% 39 / 47 Podpod n/a totaltotal 79.8% 135 / 169 CC 5 SCAR 2.7
CC
5
Cov
82%
create
2.0
page
2.0
update
2.0
CRAP 1.3
« Twilio/Rest/IpMessaging/V2/Service/User/UserChannel.pm ↑ Summary Twilio/Rest/Webhooks/V1/Setting.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Api::V2010::Account::Address;
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::Api::V2010::Account::AddressList;
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 6 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 6 my ($class, $version, $account_sid) = @_;
17 6 my $self = $class->SUPER::new($version);
18 6 $self->{solution} = { account_sid => $account_sid };
19 6 $self->{uri} = join q{}, '/Accounts/', Twilio::Serialize::path_segment($account_sid),
20 '/Addresses.json';
21 6 return $self;
22 }
23  
24 1 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
25 1 my ($self, $customer_name, $street, $city, $region, $postal_code, $iso_country, $options) = @_;
26 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
27  
28 my $data = {
29 CustomerName => $customer_name,
30 Street => $street,
31 City => $city,
32 Region => $region,
33 PostalCode => $postal_code,
34 IsoCountry => $iso_country,
35 AutoCorrectAddress => Twilio::Serialize::boolean_to_string($options->{auto_correct_address}),
36 EmergencyEnabled => Twilio::Serialize::boolean_to_string($options->{emergency_enabled}),
37 FriendlyName => $options->{friendly_name},
38 StreetSecondary => $options->{street_secondary},
39 1 };
40  
41 my $response =
42 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
43 return Twilio::Rest::Api::V2010::Account::AddressInstance->new($self->{version},
44 1 $response->get_content, $self->{solution}{account_sid});
45 }
46  
47 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
48 0 my ($self, @arguments) = @_;
49 0 return $self->read_records(@arguments);
50 }
51  
52 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
53 0 my ($self, @arguments) = @_;
54 0 return $self->stream_records(@arguments);
55 }
56  
57 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
58 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
59 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
60  
61 my $params = {
62 CustomerName => $options->{customer_name},
63 EmergencyEnabled => Twilio::Serialize::boolean_to_string($options->{emergency_enabled}),
64 FriendlyName => $options->{friendly_name},
65 IsoCountry => $options->{iso_country},
66 1 PageToken => $page_token,
67 Page => $page_number,
68 PageSize => $page_size,
69 };
70  
71 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
72 1 return $self->_build_page($response);
73 }
74  
75 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
76 0 my ($self, $target_url) = @_;
77 0 my $client = $self->{version}->get_domain->get_client;
78 0 return $self->_build_page($client->request('GET', $target_url));
79 }
80  
81 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
82 1 my ($self, $response) = @_;
83 return Twilio::Rest::Api::V2010::Account::AddressPage->new($self->{version}, $response,
84 1 $self->{solution});
85 }
86  
87 4 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
88 4 my ($self, $sid) = @_;
89 return Twilio::Rest::Api::V2010::Account::AddressContext->new($self->{version},
90 4 $self->{solution}{account_sid}, $sid);
91 }
92  
93 package Twilio::Rest::Api::V2010::Account::AddressPage;
94  
95 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
96  
97 1 ▶sub records_key { return 'addresses' }
Subroutine records_key: called CC=1 SCAR=0.0
98  
99 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
100 1 my ($self, $payload) = @_;
101 return Twilio::Rest::Api::V2010::Account::AddressInstance->new($self->{version}, $payload,
102 1 $self->{solution}{account_sid});
103 }
104  
105 package Twilio::Rest::Api::V2010::Account::AddressContext;
106  
107 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
108  
109 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
110  
111 4 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
112 4 my ($class, $version, $account_sid, $sid) = @_;
113 4 my $self = $class->SUPER::new($version);
114 4 $self->{solution} = { account_sid => $account_sid, sid => $sid };
115 4 $self->{uri} = join q{}, '/Accounts/', Twilio::Serialize::path_segment($account_sid),
116 '/Addresses/', Twilio::Serialize::path_segment($sid), '.json';
117 4 return $self;
118 }
119  
120 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
121 1 my ($self) = @_;
122 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
123 1 return 1;
124 }
125  
126 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
127 1 my ($self) = @_;
128  
129 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
130 1 return $self->_build_instance($response);
131 }
132  
133 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
134 1 my ($self, $options) = @_;
135 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
136  
137 my $data = {
138 AutoCorrectAddress => Twilio::Serialize::boolean_to_string($options->{auto_correct_address}),
139 City => $options->{city},
140 CustomerName => $options->{customer_name},
141 EmergencyEnabled => Twilio::Serialize::boolean_to_string($options->{emergency_enabled}),
142 FriendlyName => $options->{friendly_name},
143 PostalCode => $options->{postal_code},
144 Region => $options->{region},
145 Street => $options->{street},
146 StreetSecondary => $options->{street_secondary},
147 1 };
148  
149 my $response =
150 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
151 1 return $self->_build_instance($response);
152 }
153  
154 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
155 2 my ($self, $response) = @_;
156 return Twilio::Rest::Api::V2010::Account::AddressInstance->new(
157 $self->{version}, $response->get_content,
158 $self->{solution}{account_sid}, $self->{solution}{sid}
159 2 );
160 }
161  
162 1 ▶sub dependent_phone_numbers {
Subroutine dependent_phone_numbers: called CC=1 SCAR=0.0
163 1 my ($self) = @_;
164 1 require Twilio::Rest::Api::V2010::Account::Address::DependentPhoneNumber;
165 return Twilio::Rest::Api::V2010::Account::Address::DependentPhoneNumberList->new(
166 $self->{version},
167 $self->{solution}{account_sid},
168 $self->{solution}{sid}
169 1 );
170 }
171  
172 package Twilio::Rest::Api::V2010::Account::AddressInstance;
173  
174 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
175  
176 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
177  
178 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
179 4 my ($class, $version, $payload, $account_sid, $sid) = @_;
180 4 my $self = $class->SUPER::new($version, $payload);
181 4 ▶ $self->{solution} = { account_sid => $account_sid, 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
182 4 return $self;
183 }
184  
185 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
186 0 my ($self, @arguments) = @_;
187 0 return $self->_context->delete(@arguments);
188 }
189  
190 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
191 0 my ($self, @arguments) = @_;
192 0 return $self->_context->fetch(@arguments);
193 }
194  
195 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
196 0 my ($self, @arguments) = @_;
197 0 return $self->_context->update(@arguments);
198 }
199  
200 0 ▶sub dependent_phone_numbers {
Subroutine dependent_phone_numbers: not called CC=1 SCAR=6.9
201 0 my ($self, @arguments) = @_;
202 0 return $self->_context->dependent_phone_numbers(@arguments);
203 }
204  
205 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
206 0 my ($self) = @_;
207 return Twilio::Rest::Api::V2010::Account::AddressContext->new(
208 $self->{version},
209 $self->{solution}{account_sid},
210 $self->{solution}{sid}
211 0 );
212 }
213  
214 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
215 4 ▶sub city { return $_[0]{properties}{city} }
Subroutine city: called CC=1 SCAR=0.0
216 4 ▶sub customer_name { return $_[0]{properties}{customer_name} }
Subroutine customer_name: called CC=1 SCAR=0.0
217 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
218 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
219 4 ▶sub emergency_enabled { return $_[0]{properties}{emergency_enabled} }
Subroutine emergency_enabled: called CC=1 SCAR=0.0
220 4 ▶sub friendly_name { return $_[0]{properties}{friendly_name} }
Subroutine friendly_name: called CC=1 SCAR=0.0
221 4 ▶sub iso_country { return $_[0]{properties}{iso_country} }
Subroutine iso_country: called CC=1 SCAR=0.0
222 4 ▶sub postal_code { return $_[0]{properties}{postal_code} }
Subroutine postal_code: called CC=1 SCAR=0.0
223 4 ▶sub region { return $_[0]{properties}{region} }
Subroutine region: called CC=1 SCAR=0.0
224 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
225 4 ▶sub street { return $_[0]{properties}{street} }
Subroutine street: called CC=1 SCAR=0.0
226 4 ▶sub street_secondary { return $_[0]{properties}{street_secondary} }
Subroutine street_secondary: called CC=1 SCAR=0.0
227 4 ▶sub uri { return $_[0]{properties}{uri} }
Subroutine uri: called CC=1 SCAR=0.0
228 4 ▶sub validated { return $_[0]{properties}{validated} }
Subroutine validated: called CC=1 SCAR=0.0
229 4 ▶sub verified { return $_[0]{properties}{verified} }
Subroutine verified: called CC=1 SCAR=0.0
230  
231 2 1;
232  
233 __END__
« Twilio/Rest/IpMessaging/V2/Service/User/UserChannel.pm ↑ Summary Twilio/Rest/Webhooks/V1/Setting.pm »