Twilio/Rest/FlexApi/V1/Channel.pm

filter: Statementstmt 85.2% 75 / 88 Branchbran n/a Conditioncond 57.1% 4 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 82.8% 29 / 35 Podpod n/a totaltotal 80.6% 108 / 134 CC 4 SCAR 2.8
CC
4
Cov
83%
create
2.0
page
2.0
new
2.0
CRAP 1.3
« Twilio/Rest/Api/V2010/Account/Recording/AddOnResult.pm ↑ Summary Twilio/Rest/Numbers/V2/RegulatoryCompliance/Regulation.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::FlexApi::V1::Channel;
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::ChannelList;
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 4 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 4 my ($class, $version) = @_;
17 4 my $self = $class->SUPER::new($version);
18 4 $self->{solution} = {};
19 4 $self->{uri} = '/Channels';
20 4 return $self;
21 }
22  
23 1 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
24 1 my ($self, $flex_flow_sid, $identity, $chat_user_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 ChatUserFriendlyName => $chat_user_friendly_name,
32 ChatFriendlyName => $chat_friendly_name,
33 ChatUniqueName => $options->{chat_unique_name},
34 LongLived => Twilio::Serialize::boolean_to_string($options->{long_lived}),
35 PreEngagementData => $options->{pre_engagement_data},
36 Target => $options->{target},
37 TaskAttributes => $options->{task_attributes},
38 TaskSid => $options->{task_sid},
39 1 };
40  
41 my $response =
42 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
43 1 return Twilio::Rest::FlexApi::V1::ChannelInstance->new($self->{version}, $response->get_content);
44 }
45  
46 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
47 0 my ($self, @arguments) = @_;
48 0 return $self->read_records(@arguments);
49 }
50  
51 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
52 0 my ($self, @arguments) = @_;
53 0 return $self->stream_records(@arguments);
54 }
55  
56 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
57 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
58 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
59  
60 1 my $params = {
61 PageToken => $page_token,
62 Page => $page_number,
63 PageSize => $page_size,
64 };
65  
66 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
67 1 return $self->_build_page($response);
68 }
69  
70 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
71 0 my ($self, $target_url) = @_;
72 0 my $client = $self->{version}->get_domain->get_client;
73 0 return $self->_build_page($client->request('GET', $target_url));
74 }
75  
76 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
77 1 my ($self, $response) = @_;
78 return Twilio::Rest::FlexApi::V1::ChannelPage->new($self->{version}, $response,
79 1 $self->{solution});
80 }
81  
82 2 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
83 2 my ($self, $sid) = @_;
84 2 return Twilio::Rest::FlexApi::V1::ChannelContext->new($self->{version}, $sid);
85 }
86  
87 package Twilio::Rest::FlexApi::V1::ChannelPage;
88  
89 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
90  
91 1 ▶sub records_key { return 'flex_chat_channels' }
Subroutine records_key: called CC=1 SCAR=0.0
92  
93 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
94 1 my ($self, $payload) = @_;
95 1 return Twilio::Rest::FlexApi::V1::ChannelInstance->new($self->{version}, $payload);
96 }
97  
98 package Twilio::Rest::FlexApi::V1::ChannelContext;
99  
100 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
101  
102 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
103  
104 2 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
105 2 my ($class, $version, $sid) = @_;
106 2 my $self = $class->SUPER::new($version);
107 2 $self->{solution} = { sid => $sid };
108 2 $self->{uri} = join q{}, '/Channels/', Twilio::Serialize::path_segment($sid);
109 2 return $self;
110 }
111  
112 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
113 1 my ($self) = @_;
114 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
115 1 return 1;
116 }
117  
118 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
119 1 my ($self) = @_;
120  
121 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
122 1 return $self->_build_instance($response);
123 }
124  
125 1 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
126 1 my ($self, $response) = @_;
127 return Twilio::Rest::FlexApi::V1::ChannelInstance->new($self->{version}, $response->get_content,
128 1 $self->{solution}{sid});
129 }
130  
131 package Twilio::Rest::FlexApi::V1::ChannelInstance;
132  
133 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
134  
135 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
136  
137 3 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
138 3 my ($class, $version, $payload, $sid) = @_;
139 3 my $self = $class->SUPER::new($version, $payload);
140 3 ▶ $self->{solution} = { sid => $sid // $self->{properties}{sid} };
Condition66%2/3
$sid // $self->{"properties"}{"sid"}
l!l&&r!l&&!r
120
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
141 3 return $self;
142 }
143  
144 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
145 0 my ($self, @arguments) = @_;
146 0 return $self->_context->delete(@arguments);
147 }
148  
149 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
150 0 my ($self, @arguments) = @_;
151 0 return $self->_context->fetch(@arguments);
152 }
153  
154 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
155 0 my ($self) = @_;
156 0 return Twilio::Rest::FlexApi::V1::ChannelContext->new($self->{version}, $self->{solution}{sid});
157 }
158  
159 3 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
160 3 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
161 3 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
162 3 ▶sub flex_flow_sid { return $_[0]{properties}{flex_flow_sid} }
Subroutine flex_flow_sid: called CC=1 SCAR=0.0
163 3 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
164 3 ▶sub task_sid { return $_[0]{properties}{task_sid} }
Subroutine task_sid: called CC=1 SCAR=0.0
165 3 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
166 3 ▶sub user_sid { return $_[0]{properties}{user_sid} }
Subroutine user_sid: called CC=1 SCAR=0.0
167  
168 2 1;
169  
170 __END__
« Twilio/Rest/Api/V2010/Account/Recording/AddOnResult.pm ↑ Summary Twilio/Rest/Numbers/V2/RegulatoryCompliance/Regulation.pm »