Twilio/Rest/Conversations/V2/Participant.pm

filter: Statementstmt 85.3% 76 / 89 Branchbran n/a Conditioncond 60.0% 3 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 83.3% 30 / 36 Podpod n/a totaltotal 81.9% 109 / 133 CC 3 SCAR 2.3
CC
3
Cov
84%
page
2.0
new
2.0
read
2.0
CRAP 1.3
« Twilio/Rest/Messaging/V1/Service/ShortCode.pm ↑ Summary Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber/AssignedAddOn/AssignedAddOnExtension.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Conversations::V2::Participant;
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::V2::ParticipantList;
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, $conversation_id) = @_;
17 4 my $self = $class->SUPER::new($version);
18 4 $self->{solution} = { conversation_id => $conversation_id };
19 4 $self->{uri} = join q{}, '/Conversations/', Twilio::Serialize::path_segment($conversation_id),
20 '/Participants';
21 4 return $self;
22 }
23  
24 1 ▶sub create {
Subroutine create: called CC=1 SCAR=0.0
25 1 my ($self, $body) = @_;
26  
27 1 my $data = Twilio::Serialize::json_body($body, {});
28  
29 my $response = $self->{version}->handle_request(
30 'POST',
31 $self->{uri},
32 1 'create',
33 {
34 data => $data,
35 headers => { 'Content-Type' => 'application/json', }
36 }
37 );
38 return Twilio::Rest::Conversations::V2::ParticipantInstance->new($self->{version},
39 1 $response->get_content, $self->{solution}{conversation_id});
40 }
41  
42 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
43 0 my ($self, @arguments) = @_;
44 0 return $self->read_records(@arguments);
45 }
46  
47 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
48 0 my ($self, @arguments) = @_;
49 0 return $self->stream_records(@arguments);
50 }
51  
52 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
53 1 my ($self, $options, $page_size, $page_token) = @_;
54 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
55  
56 1 my $params = {
57 pageSize => $page_size,
58 pageToken => $page_token,
59 };
60  
61 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
62 1 return $self->_build_page($response);
63 }
64  
65 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
66 0 my ($self, $target_url) = @_;
67 0 my $client = $self->{version}->get_domain->get_client;
68 0 return $self->_build_page($client->request('GET', $target_url));
69 }
70  
71 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
72 1 my ($self, $response) = @_;
73 return Twilio::Rest::Conversations::V2::ParticipantPage->new($self->{version}, $response,
74 1 $self->{solution});
75 }
76  
77 2 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
78 2 my ($self, $id) = @_;
79 return Twilio::Rest::Conversations::V2::ParticipantContext->new($self->{version},
80 2 $self->{solution}{conversation_id}, $id);
81 }
82  
83 package Twilio::Rest::Conversations::V2::ParticipantPage;
84  
85 2 ▶use parent 'Twilio::TokenPaginationPage';
Subroutine BEGIN: called CC=1 SCAR=0.0
86  
87 1 ▶sub records_key { return 'participants' }
Subroutine records_key: called CC=1 SCAR=0.0
88  
89 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
90 1 my ($self, $payload) = @_;
91 return Twilio::Rest::Conversations::V2::ParticipantInstance->new($self->{version}, $payload,
92 1 $self->{solution}{conversation_id});
93 }
94  
95 package Twilio::Rest::Conversations::V2::ParticipantContext;
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 2 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
102 2 my ($class, $version, $conversation_id, $id) = @_;
103 2 my $self = $class->SUPER::new($version);
104 2 $self->{solution} = { conversation_id => $conversation_id, id => $id };
105 2 $self->{uri} = join q{}, '/Conversations/', Twilio::Serialize::path_segment($conversation_id),
106 '/Participants/', Twilio::Serialize::path_segment($id);
107 2 return $self;
108 }
109  
110 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
111 1 my ($self) = @_;
112  
113 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
114 1 return $self->_build_instance($response);
115 }
116  
117 1 ▶sub update {
Subroutine update: called CC=1 SCAR=0.0
118 1 my ($self, $body) = @_;
119  
120 1 my $data = Twilio::Serialize::json_body($body, {});
121  
122 my $response = $self->{version}->handle_request(
123 'PUT',
124 $self->{uri},
125 1 'update',
126 {
127 data => $data,
128 headers => { 'Content-Type' => 'application/json', }
129 }
130 );
131 1 return $self->_build_instance($response);
132 }
133  
134 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
135 2 my ($self, $response) = @_;
136 return Twilio::Rest::Conversations::V2::ParticipantInstance->new(
137 $self->{version}, $response->get_content,
138 $self->{solution}{conversation_id},
139 $self->{solution}{id}
140 2 );
141 }
142  
143 package Twilio::Rest::Conversations::V2::ParticipantInstance;
144  
145 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
146  
147 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
148  
149 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
150 4 my ($class, $version, $payload, $conversation_id, $id) = @_;
151 4 my $self = $class->SUPER::new($version, $payload);
152 4 ▶ $self->{solution} = { conversation_id => $conversation_id, id => $id // $self->{properties}{id} };
Condition66%2/3
$id // $self->{"properties"}{"id"}
l!l&&r!l&&!r
220
MC/DC0%0/2
$id // $self->{"properties"}{"id"}
$id $self->{"properties"}{"id"}
Truth table66%2/3
A // B
A= $idB= $self->{"properties"}{"id"}
ABresult
1X1
011
000
153 4 return $self;
154 }
155  
156 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
157 0 my ($self, @arguments) = @_;
158 0 return $self->_context->fetch(@arguments);
159 }
160  
161 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
162 0 my ($self, @arguments) = @_;
163 0 return $self->_context->update(@arguments);
164 }
165  
166 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
167 0 my ($self) = @_;
168 return Twilio::Rest::Conversations::V2::ParticipantContext->new(
169 $self->{version},
170 $self->{solution}{conversation_id},
171 $self->{solution}{id}
172 0 );
173 }
174  
175 4 ▶sub account_id { return $_[0]{properties}{accountId} }
Subroutine account_id: called CC=1 SCAR=0.0
176 4 ▶sub addresses { return $_[0]{properties}{addresses} }
Subroutine addresses: called CC=1 SCAR=0.0
177 4 ▶sub conversation_id { return $_[0]{properties}{conversationId} }
Subroutine conversation_id: called CC=1 SCAR=0.0
178 4 ▶sub created_at { return Twilio::Deserialize::date_time($_[0]{properties}{createdAt}) }
Subroutine created_at: called CC=1 SCAR=0.0
179 4 ▶sub id { return $_[0]{properties}{id} }
Subroutine id: called CC=1 SCAR=0.0
180 4 ▶sub name { return $_[0]{properties}{name} }
Subroutine name: called CC=1 SCAR=0.0
181 4 ▶sub profile_id { return $_[0]{properties}{profileId} }
Subroutine profile_id: called CC=1 SCAR=0.0
182 4 ▶sub type { return $_[0]{properties}{type} }
Subroutine type: called CC=1 SCAR=0.0
183 4 ▶sub updated_at { return Twilio::Deserialize::date_time($_[0]{properties}{updatedAt}) }
Subroutine updated_at: called CC=1 SCAR=0.0
184  
185 2 1;
186  
187 __END__
« Twilio/Rest/Messaging/V1/Service/ShortCode.pm ↑ Summary Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber/AssignedAddOn/AssignedAddOnExtension.pm »