Twilio/Rest/FlexApi/V1/WebChannel.pm

filter: Statementstmt 83.8% 78 / 93 Branchbran n/a Conditioncond 55.5% 5 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 80.0% 28 / 35 Podpod n/a totaltotal 78.1% 111 / 142 CC 5 SCAR 3.3
CC
5
Cov
81%
create
2.0
page
2.0
update
2.0
CRAP 1.4
« Twilio/Rest/Accounts/V1/Credential/PublicKey.pm ↑ Summary Twilio/Rest/Preview/Marketplace/InstalledAddOn.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::FlexApi::V1::WebChannel;
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::FlexApi::V1::WebChannelList;
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} = '/WebChannels';
20 5 return $self;
21 }
22  
23 1 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
24 1 my ($self, $flex_flow_sid, $identity, $customer_friendly_name, $chat_friendly_name, $options) =
25 @_;
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 FlexFlowSid => $flex_flow_sid,
30 Identity => $identity,
31 CustomerFriendlyName => $customer_friendly_name,
32 ChatFriendlyName => $chat_friendly_name,
33 ChatUniqueName => $options->{chat_unique_name},
34 PreEngagementData => $options->{pre_engagement_data},
35 1 };
36  
37 my $response =
38 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
39 return Twilio::Rest::FlexApi::V1::WebChannelInstance->new($self->{version},
40 1 $response->get_content);
41 }
42  
43 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
44 0 my ($self, @arguments) = @_;
45 0 return $self->read_records(@arguments);
46 }
47  
48 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
49 0 my ($self, @arguments) = @_;
50 0 return $self->stream_records(@arguments);
51 }
52  
53 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
54 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
55 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
56  
57 1 my $params = {
58 PageToken => $page_token,
59 Page => $page_number,
60 PageSize => $page_size,
61 };
62  
63 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
64 1 return $self->_build_page($response);
65 }
66  
67 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
68 0 my ($self, $target_url) = @_;
69 0 my $client = $self->{version}->get_domain->get_client;
70 0 return $self->_build_page($client->request('GET', $target_url));
71 }
72  
73 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
74 1 my ($self, $response) = @_;
75 return Twilio::Rest::FlexApi::V1::WebChannelPage->new($self->{version}, $response,
76 1 $self->{solution});
77 }
78  
79 3 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
80 3 my ($self, $sid) = @_;
81 3 return Twilio::Rest::FlexApi::V1::WebChannelContext->new($self->{version}, $sid);
82 }
83  
84 package Twilio::Rest::FlexApi::V1::WebChannelPage;
85  
86 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
87  
88 1 ▶sub records_key { return 'flex_chat_channels' }
Subroutine records_key: called CC=1 SCAR=0.0
89  
90 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
91 1 my ($self, $payload) = @_;
92 1 return Twilio::Rest::FlexApi::V1::WebChannelInstance->new($self->{version}, $payload);
93 }
94  
95 package Twilio::Rest::FlexApi::V1::WebChannelContext;
96  
97 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
98  
99 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
100  
101 3 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
102 3 my ($class, $version, $sid) = @_;
103 3 my $self = $class->SUPER::new($version);
104 3 $self->{solution} = { sid => $sid };
105 3 $self->{uri} = join q{}, '/WebChannels/', Twilio::Serialize::path_segment($sid);
106 3 return $self;
107 }
108  
109 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
110 1 my ($self) = @_;
111 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
112 1 return 1;
113 }
114  
115 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
116 1 my ($self) = @_;
117  
118 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
119 1 return $self->_build_instance($response);
120 }
121  
122 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
123 1 my ($self, $options) = @_;
124 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
125  
126 my $data = {
127 ChatStatus => $options->{chat_status},
128 PostEngagementData => $options->{post_engagement_data},
129 1 };
130  
131 my $response =
132 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
133 1 return $self->_build_instance($response);
134 }
135  
136 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
137 2 my ($self, $response) = @_;
138 return Twilio::Rest::FlexApi::V1::WebChannelInstance->new($self->{version},
139 2 $response->get_content, $self->{solution}{sid});
140 }
141  
142 package Twilio::Rest::FlexApi::V1::WebChannelInstance;
143  
144 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
145  
146 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
147  
148 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
149 4 my ($class, $version, $payload, $sid) = @_;
150 4 my $self = $class->SUPER::new($version, $payload);
151 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
152 4 return $self;
153 }
154  
155 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
156 0 my ($self, @arguments) = @_;
157 0 return $self->_context->delete(@arguments);
158 }
159  
160 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
161 0 my ($self, @arguments) = @_;
162 0 return $self->_context->fetch(@arguments);
163 }
164  
165 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
166 0 my ($self, @arguments) = @_;
167 0 return $self->_context->update(@arguments);
168 }
169  
170 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
171 0 my ($self) = @_;
172 return Twilio::Rest::FlexApi::V1::WebChannelContext->new($self->{version},
173 0 $self->{solution}{sid});
174 }
175  
176 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
177 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
178 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
179 4 ▶sub flex_flow_sid { return $_[0]{properties}{flex_flow_sid} }
Subroutine flex_flow_sid: called CC=1 SCAR=0.0
180 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
181 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
182  
183 2 1;
184  
185 __END__
« Twilio/Rest/Accounts/V1/Credential/PublicKey.pm ↑ Summary Twilio/Rest/Preview/Marketplace/InstalledAddOn.pm »