Twilio/Rest/Webhooks/V1/Rule.pm

filter: Statementstmt 85.7% 90 / 105 Branchbran n/a Conditioncond 63.6% 7 / 11 MC/DCmcdc 16.6% 1 / 6 Subroutinesub 83.3% 35 / 42 Podpod n/a totaltotal 81.1% 133 / 164 CC 6 SCAR 3.1
CC
6
Cov
84%
create
2.0
page
2.0
patch
2.0
CRAP 1.4
« Twilio/Rest/Conversations/V1/Service/Conversation/Participant.pm ↑ Summary Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Webhooks::V1::Rule;
3  
4 3 ▶use 5.016;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 our $VERSION = '2.001';
8  
9 package Twilio::Rest::Webhooks::V1::RuleList;
10  
11 3 ▶use parent 'Twilio::ListResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 3 ▶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) = @_;
17 6 my $self = $class->SUPER::new($version);
18 6 $self->{solution} = {};
19 6 $self->{uri} = '/Webhooks/Rules';
20 6 return $self;
21 }
22  
23 1 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
24 1 my ($self, $body, $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 1 my $data = Twilio::Serialize::json_body($body, {});
28  
29 my $response = $self->{version}->handle_request(
30 'POST',
31 $self->{uri},
32 'create',
33 {
34 data => $data,
35 headers => {
36 'Content-Type' => 'application/json',
37 'Idempotency-Key' => $options->{idempotency_key},
38 }
39 }
40 1 );
41 return Twilio::Rest::Webhooks::V1::RuleOperationResponseInstance->new($self->{version},
42 1 $response->get_content);
43 }
44  
45 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
46 0 my ($self, @arguments) = @_;
47 0 return $self->read_records(@arguments);
48 }
49  
50 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
51 0 my ($self, @arguments) = @_;
52 0 return $self->stream_records(@arguments);
53 }
54  
55 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
56 1 my ($self, $options, $page_size, $page_token) = @_;
57 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
58  
59 my $params = {
60 settingId => $options->{setting_id},
61 1 pageSize => $page_size,
62 pageToken => $page_token,
63 };
64  
65 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
66 1 return $self->_build_page($response);
67 }
68  
69 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
70 0 my ($self, $target_url) = @_;
71 0 my $client = $self->{version}->get_domain->get_client;
72 0 return $self->_build_page($client->request('GET', $target_url));
73 }
74  
75 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
76 1 my ($self, $response) = @_;
77 1 return Twilio::Rest::Webhooks::V1::RulePage->new($self->{version}, $response, $self->{solution});
78 }
79  
80 4 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
81 4 my ($self, $rule_id) = @_;
82 4 return Twilio::Rest::Webhooks::V1::RuleContext->new($self->{version}, $rule_id);
83 }
84  
85 package Twilio::Rest::Webhooks::V1::RulePage;
86  
87 3 ▶use parent 'Twilio::TokenPaginationPage';
Subroutine BEGIN: called CC=1 SCAR=0.0
88  
89 1 ▶sub records_key { return 'rules' }
Subroutine records_key: called CC=1 SCAR=0.0
90  
91 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
92 1 my ($self, $payload) = @_;
93 1 return Twilio::Rest::Webhooks::V1::RuleInstance->new($self->{version}, $payload);
94 }
95  
96 package Twilio::Rest::Webhooks::V1::RuleContext;
97  
98 3 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
99  
100 3 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
101  
102 4 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
103 4 my ($class, $version, $rule_id) = @_;
104 4 my $self = $class->SUPER::new($version);
105 4 $self->{solution} = { rule_id => $rule_id };
106 4 $self->{uri} = join q{}, '/Webhooks/Rules/', Twilio::Serialize::path_segment($rule_id);
107 4 return $self;
108 }
109  
110 2 ▶sub delete {
Subroutine delete: called CC=2 SCAR=6.9
111 2 my ($self, $options) = @_;
112 2 ▶ $options //= {};
Condition100%2/2
$options //= {}
l!l
11
MC/DC100%1/1
$options //= {}
$options
Truth table100%2/2
A
A= $options
Aresult
11
00
113 my $response = $self->{version}->handle_request('DELETE', $self->{uri}, 'delete',
114 2 { headers => { 'Idempotency-Key' => $options->{idempotency_key}, } });
115 return Twilio::Rest::Webhooks::V1::RuleOperationResponseInstance->new($self->{version},
116 2 $response->get_content);
117 }
118  
119 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
120 1 my ($self) = @_;
121  
122 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
123 1 return $self->_build_instance($response);
124 }
125  
126 1 ▶sub patch {
Subroutine patch: called CC=2 SCAR=7.0
127 1 my ($self, $body, $options) = @_;
128 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
129  
130 1 my $data = Twilio::Serialize::json_body($body, {});
131  
132 my $response = $self->{version}->handle_request(
133 'PATCH',
134 $self->{uri},
135 'patch',
136 {
137 data => $data,
138 headers => {
139 'Content-Type' => 'application/json',
140 'Idempotency-Key' => $options->{idempotency_key},
141 }
142 }
143 1 );
144 return Twilio::Rest::Webhooks::V1::RuleOperationResponseInstance->new($self->{version},
145 1 $response->get_content);
146 }
147  
148 1 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
149 1 my ($self, $response) = @_;
150 return Twilio::Rest::Webhooks::V1::RuleInstance->new($self->{version}, $response->get_content,
151 1 $self->{solution}{rule_id});
152 }
153  
154 package Twilio::Rest::Webhooks::V1::RuleInstance;
155  
156 3 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
157  
158 3 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
159  
160 2 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
161 2 my ($class, $version, $payload, $rule_id) = @_;
162 2 my $self = $class->SUPER::new($version, $payload);
163 2 ▶ $self->{solution} = { rule_id => $rule_id // $self->{properties}{id} };
Condition66%2/3
$rule_id // $self->{"properties"}{"id"}
l!l&&r!l&&!r
110
MC/DC0%0/2
$rule_id // $self->{"properties"}{"id"}
$rule_id $self->{"properties"}{"id"}
Truth table66%2/3
A // B
A= $rule_idB= $self->{"properties"}{"id"}
ABresult
1X1
011
000
164 2 return $self;
165 }
166  
167 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
168 0 my ($self, @arguments) = @_;
169 0 return $self->_context->delete(@arguments);
170 }
171  
172 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
173 0 my ($self, @arguments) = @_;
174 0 return $self->_context->fetch(@arguments);
175 }
176  
177 0 ▶sub patch {
Subroutine patch: not called CC=1 SCAR=6.9
178 0 my ($self, @arguments) = @_;
179 0 return $self->_context->patch(@arguments);
180 }
181  
182 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
183 0 my ($self) = @_;
184 0 return Twilio::Rest::Webhooks::V1::RuleContext->new($self->{version}, $self->{solution}{rule_id});
185 }
186  
187 2 ▶sub created_at { return Twilio::Deserialize::date_time($_[0]{properties}{createdAt}) }
Subroutine created_at: called CC=1 SCAR=0.0
188 2 ▶sub description { return $_[0]{properties}{description} }
Subroutine description: called CC=1 SCAR=0.0
189 2 ▶sub friendly_name { return $_[0]{properties}{friendlyName} }
Subroutine friendly_name: called CC=1 SCAR=0.0
190 2 ▶sub id { return $_[0]{properties}{id} }
Subroutine id: called CC=1 SCAR=0.0
191 2 ▶sub match_type { return $_[0]{properties}{matchType} }
Subroutine match_type: called CC=1 SCAR=0.0
192 2 ▶sub prefix { return $_[0]{properties}{prefix} }
Subroutine prefix: called CC=1 SCAR=0.0
193 2 ▶sub settings { return $_[0]{properties}{settings} }
Subroutine settings: called CC=1 SCAR=0.0
194 2 ▶sub updated_at { return Twilio::Deserialize::date_time($_[0]{properties}{updatedAt}) }
Subroutine updated_at: called CC=1 SCAR=0.0
195 2 ▶sub value { return $_[0]{properties}{value} }
Subroutine value: called CC=1 SCAR=0.0
196  
197 package Twilio::Rest::Webhooks::V1::RuleOperationResponseInstance;
198  
199 3 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
200  
201 3 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
202  
203 4 ▶sub operation { return $_[0]{properties}{operation} }
Subroutine operation: called CC=1 SCAR=0.0
204 3 ▶sub rule { return $_[0]{properties}{rule} }
Subroutine rule: called CC=1 SCAR=0.0
205  
206 3 1;
207  
208 __END__
« Twilio/Rest/Conversations/V1/Service/Conversation/Participant.pm ↑ Summary Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry.pm »