Twilio/Rest/Conversations/V1/AddressConfiguration.pm

filter: Statementstmt 84.5% 82 / 97 Branchbran n/a Conditioncond 55.5% 5 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 82.0% 32 / 39 Podpod n/a totaltotal 79.3% 119 / 150 CC 5 SCAR 3.0
CC
5
Cov
82%
create
2.0
page
2.0
update
2.0
CRAP 1.4
« Twilio/Rest/Api/V2010/Account/Queue/Member.pm ↑ Summary Twilio/Rest/Taskrouter/V1/Workspace/TaskChannel.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Conversations::V1::AddressConfiguration;
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::Conversations::V1::AddressConfigurationList;
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 5 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 5 my ($class, $version) = @_;
17 5 my $self = $class->SUPER::new($version);
18 5 $self->{solution} = {};
19 5 $self->{uri} = '/Configuration/Addresses';
20 5 return $self;
21 }
22  
23 1 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
24 1 my ($self, $type, $address, $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 Type => $type,
29 Address => $address,
30 AddressCountry => $options->{address_country},
31 'AutoCreation.ConversationServiceSid' => $options->{auto_creation_conversation_service_sid},
32 'AutoCreation.Enabled' =>
33 Twilio::Serialize::boolean_to_string($options->{auto_creation_enabled}),
34 'AutoCreation.StudioFlowSid' => $options->{auto_creation_studio_flow_sid},
35 'AutoCreation.StudioRetryCount' => $options->{auto_creation_studio_retry_count},
36 'AutoCreation.Type' => $options->{auto_creation_type},
37 'AutoCreation.WebhookFilters' => $options->{auto_creation_webhook_filters},
38 'AutoCreation.WebhookMethod' => $options->{auto_creation_webhook_method},
39 'AutoCreation.WebhookUrl' => $options->{auto_creation_webhook_url},
40 FriendlyName => $options->{friendly_name},
41 1 };
42  
43 my $response =
44 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
45 return Twilio::Rest::Conversations::V1::AddressConfigurationInstance->new($self->{version},
46 1 $response->get_content);
47 }
48  
49 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
50 0 my ($self, @arguments) = @_;
51 0 return $self->read_records(@arguments);
52 }
53  
54 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
55 0 my ($self, @arguments) = @_;
56 0 return $self->stream_records(@arguments);
57 }
58  
59 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
60 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
61 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
62  
63 my $params = {
64 Type => $options->{type},
65 1 PageToken => $page_token,
66 Page => $page_number,
67 PageSize => $page_size,
68 };
69  
70 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
71 1 return $self->_build_page($response);
72 }
73  
74 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
75 0 my ($self, $target_url) = @_;
76 0 my $client = $self->{version}->get_domain->get_client;
77 0 return $self->_build_page($client->request('GET', $target_url));
78 }
79  
80 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
81 1 my ($self, $response) = @_;
82 return Twilio::Rest::Conversations::V1::AddressConfigurationPage->new($self->{version},
83 1 $response, $self->{solution});
84 }
85  
86 3 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
87 3 my ($self, $sid) = @_;
88 3 return Twilio::Rest::Conversations::V1::AddressConfigurationContext->new($self->{version}, $sid);
89 }
90  
91 package Twilio::Rest::Conversations::V1::AddressConfigurationPage;
92  
93 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
94  
95 1 ▶sub records_key { return 'address_configurations' }
Subroutine records_key: called CC=1 SCAR=0.0
96  
97 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
98 1 my ($self, $payload) = @_;
99 return Twilio::Rest::Conversations::V1::AddressConfigurationInstance->new($self->{version},
100 1 $payload);
101 }
102  
103 package Twilio::Rest::Conversations::V1::AddressConfigurationContext;
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 3 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
110 3 my ($class, $version, $sid) = @_;
111 3 my $self = $class->SUPER::new($version);
112 3 $self->{solution} = { sid => $sid };
113 3 $self->{uri} = join q{}, '/Configuration/Addresses/', Twilio::Serialize::path_segment($sid);
114 3 return $self;
115 }
116  
117 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
118 1 my ($self) = @_;
119 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
120 1 return 1;
121 }
122  
123 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
124 1 my ($self) = @_;
125  
126 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
127 1 return $self->_build_instance($response);
128 }
129  
130 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
131 1 my ($self, $options) = @_;
132 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
133  
134 my $data = {
135 'AutoCreation.ConversationServiceSid' => $options->{auto_creation_conversation_service_sid},
136 'AutoCreation.Enabled' =>
137 Twilio::Serialize::boolean_to_string($options->{auto_creation_enabled}),
138 'AutoCreation.StudioFlowSid' => $options->{auto_creation_studio_flow_sid},
139 'AutoCreation.StudioRetryCount' => $options->{auto_creation_studio_retry_count},
140 'AutoCreation.Type' => $options->{auto_creation_type},
141 'AutoCreation.WebhookFilters' => $options->{auto_creation_webhook_filters},
142 'AutoCreation.WebhookMethod' => $options->{auto_creation_webhook_method},
143 'AutoCreation.WebhookUrl' => $options->{auto_creation_webhook_url},
144 FriendlyName => $options->{friendly_name},
145 1 };
146  
147 my $response =
148 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
149 1 return $self->_build_instance($response);
150 }
151  
152 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
153 2 my ($self, $response) = @_;
154 return Twilio::Rest::Conversations::V1::AddressConfigurationInstance->new($self->{version},
155 2 $response->get_content, $self->{solution}{sid});
156 }
157  
158 package Twilio::Rest::Conversations::V1::AddressConfigurationInstance;
159  
160 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
161  
162 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
163  
164 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
165 4 my ($class, $version, $payload, $sid) = @_;
166 4 my $self = $class->SUPER::new($version, $payload);
167 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
168 4 return $self;
169 }
170  
171 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
172 0 my ($self, @arguments) = @_;
173 0 return $self->_context->delete(@arguments);
174 }
175  
176 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
177 0 my ($self, @arguments) = @_;
178 0 return $self->_context->fetch(@arguments);
179 }
180  
181 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
182 0 my ($self, @arguments) = @_;
183 0 return $self->_context->update(@arguments);
184 }
185  
186 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
187 0 my ($self) = @_;
188 return Twilio::Rest::Conversations::V1::AddressConfigurationContext->new($self->{version},
189 0 $self->{solution}{sid});
190 }
191  
192 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
193 4 ▶sub address { return $_[0]{properties}{address} }
Subroutine address: called CC=1 SCAR=0.0
194 4 ▶sub address_country { return $_[0]{properties}{address_country} }
Subroutine address_country: called CC=1 SCAR=0.0
195 4 ▶sub auto_creation { return $_[0]{properties}{auto_creation} }
Subroutine auto_creation: 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 friendly_name { return $_[0]{properties}{friendly_name} }
Subroutine friendly_name: called CC=1 SCAR=0.0
199 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
200 4 ▶sub type { return $_[0]{properties}{type} }
Subroutine type: called CC=1 SCAR=0.0
201 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
202  
203 2 1;
204  
205 __END__
« Twilio/Rest/Api/V2010/Account/Queue/Member.pm ↑ Summary Twilio/Rest/Taskrouter/V1/Workspace/TaskChannel.pm »