Twilio/Rest/Events/V1/Subscription/SubscribedEvent.pm

filter: Statementstmt 83.7% 77 / 92 Branchbran n/a Conditioncond 55.5% 5 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 79.4% 27 / 34 Podpod n/a totaltotal 77.8% 109 / 140 CC 5 SCAR 3.3
CC
5
Cov
81%
create
2.0
page
2.0
update
2.0
CRAP 1.4
« Twilio/Rest/PreviewIam/Versionless/Organization.pm ↑ Summary Twilio/Rest/Marketplace/V1/InstalledAddOn.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Events::V1::Subscription::SubscribedEvent;
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::Events::V1::Subscription::SubscribedEventList;
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 6 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 6 my ($class, $version, $subscription_sid) = @_;
17 6 my $self = $class->SUPER::new($version);
18 6 $self->{solution} = { subscription_sid => $subscription_sid };
19 6 $self->{uri} = join q{}, '/Subscriptions/', Twilio::Serialize::path_segment($subscription_sid),
20 '/SubscribedEvents';
21 6 return $self;
22 }
23  
24 2 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
25 2 my ($self, $type, $options) = @_;
26 2 ▶ $options //= {};
Condition50%1/2
$options //= {}
l!l
20
MC/DC0%0/1
$options //= {}
$options
Truth table50%1/2
A
A= $options
Aresult
11
00
27  
28 my $data = {
29 Type => $type,
30 SchemaVersion => $options->{schema_version},
31 2 };
32  
33 my $response =
34 2 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
35 return Twilio::Rest::Events::V1::Subscription::SubscribedEventInstance->new($self->{version},
36 2 $response->get_content, $self->{solution}{subscription_sid});
37 }
38  
39 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
40 0 my ($self, @arguments) = @_;
41 0 return $self->read_records(@arguments);
42 }
43  
44 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
45 0 my ($self, @arguments) = @_;
46 0 return $self->stream_records(@arguments);
47 }
48  
49 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
50 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
51 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
52  
53 1 my $params = {
54 PageToken => $page_token,
55 Page => $page_number,
56 PageSize => $page_size,
57 };
58  
59 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
60 1 return $self->_build_page($response);
61 }
62  
63 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
64 0 my ($self, $target_url) = @_;
65 0 my $client = $self->{version}->get_domain->get_client;
66 0 return $self->_build_page($client->request('GET', $target_url));
67 }
68  
69 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
70 1 my ($self, $response) = @_;
71 return Twilio::Rest::Events::V1::Subscription::SubscribedEventPage->new($self->{version},
72 1 $response, $self->{solution});
73 }
74  
75 3 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
76 3 my ($self, $type) = @_;
77 return Twilio::Rest::Events::V1::Subscription::SubscribedEventContext->new($self->{version},
78 3 $self->{solution}{subscription_sid}, $type);
79 }
80  
81 package Twilio::Rest::Events::V1::Subscription::SubscribedEventPage;
82  
83 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
84  
85 1 ▶sub records_key { return 'types' }
Subroutine records_key: called CC=1 SCAR=0.0
86  
87 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
88 1 my ($self, $payload) = @_;
89 return Twilio::Rest::Events::V1::Subscription::SubscribedEventInstance->new($self->{version},
90 1 $payload, $self->{solution}{subscription_sid});
91 }
92  
93 package Twilio::Rest::Events::V1::Subscription::SubscribedEventContext;
94  
95 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
96  
97 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
98  
99 3 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
100 3 my ($class, $version, $subscription_sid, $type) = @_;
101 3 my $self = $class->SUPER::new($version);
102 3 $self->{solution} = { subscription_sid => $subscription_sid, type => $type };
103 3 $self->{uri} = join q{}, '/Subscriptions/', Twilio::Serialize::path_segment($subscription_sid),
104 '/SubscribedEvents/', Twilio::Serialize::path_segment($type);
105 3 return $self;
106 }
107  
108 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
109 1 my ($self) = @_;
110 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
111 1 return 1;
112 }
113  
114 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
115 1 my ($self) = @_;
116  
117 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
118 1 return $self->_build_instance($response);
119 }
120  
121 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
122 1 my ($self, $options) = @_;
123 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
124  
125 1 my $data = { SchemaVersion => $options->{schema_version}, };
126  
127 my $response =
128 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
129 1 return $self->_build_instance($response);
130 }
131  
132 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
133 2 my ($self, $response) = @_;
134 return Twilio::Rest::Events::V1::Subscription::SubscribedEventInstance->new(
135 $self->{version}, $response->get_content,
136 $self->{solution}{subscription_sid},
137 $self->{solution}{type}
138 2 );
139 }
140  
141 package Twilio::Rest::Events::V1::Subscription::SubscribedEventInstance;
142  
143 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
144  
145 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
146  
147 5 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
148 5 my ($class, $version, $payload, $subscription_sid, $type) = @_;
149 5 my $self = $class->SUPER::new($version, $payload);
150 $self->{solution} =
151 5 ▶ { subscription_sid => $subscription_sid, type => $type // $self->{properties}{type} };
Condition66%2/3
$type // $self->{"properties"}{"type"}
l!l&&r!l&&!r
230
MC/DC0%0/2
$type // $self->{"properties"}{"type"}
$type $self->{"properties"}{"type"}
Truth table66%2/3
A // B
A= $typeB= $self->{"properties"}{"type"}
ABresult
1X1
011
000
152 5 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::Events::V1::Subscription::SubscribedEventContext->new(
173 $self->{version},
174 $self->{solution}{subscription_sid},
175 $self->{solution}{type}
176 0 );
177 }
178  
179 5 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
180 5 ▶sub schema_version { return $_[0]{properties}{schema_version} }
Subroutine schema_version: called CC=1 SCAR=0.0
181 5 ▶sub subscription_sid { return $_[0]{properties}{subscription_sid} }
Subroutine subscription_sid: called CC=1 SCAR=0.0
182 5 ▶sub type { return $_[0]{properties}{type} }
Subroutine type: called CC=1 SCAR=0.0
183 5 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
184  
185 2 1;
186  
187 __END__
« Twilio/Rest/PreviewIam/Versionless/Organization.pm ↑ Summary Twilio/Rest/Marketplace/V1/InstalledAddOn.pm »