Twilio/Rest/Api/V2010/Account/Usage/Trigger.pm

filter: Statementstmt 85.4% 88 / 103 Branchbran n/a Conditioncond 55.5% 5 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 84.4% 38 / 45 Podpod n/a totaltotal 80.8% 131 / 162 CC 5 SCAR 2.7
CC
5
Cov
83%
create
2.0
page
2.0
update
2.0
CRAP 1.3
« Twilio/Rest/Voice/V1/ByocTrunk.pm ↑ Summary Twilio/Rest/Messaging/V1/Service/DestinationAlphaSender.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Api::V2010::Account::Usage::Trigger;
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::Api::V2010::Account::Usage::TriggerList;
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, $account_sid) = @_;
17 6 my $self = $class->SUPER::new($version);
18 6 $self->{solution} = { account_sid => $account_sid };
19 6 $self->{uri} = join q{}, '/Accounts/', Twilio::Serialize::path_segment($account_sid),
20 '/Usage/Triggers.json';
21 6 return $self;
22 }
23  
24 1 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
25 1 my ($self, $callback_url, $trigger_value, $usage_category, $options) = @_;
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 CallbackUrl => $callback_url,
30 TriggerValue => $trigger_value,
31 UsageCategory => $usage_category,
32 CallbackMethod => $options->{callback_method},
33 FriendlyName => $options->{friendly_name},
34 Recurring => $options->{recurring},
35 TriggerBy => $options->{trigger_by},
36 1 };
37  
38 my $response =
39 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
40 return Twilio::Rest::Api::V2010::Account::Usage::TriggerInstance->new($self->{version},
41 1 $response->get_content, $self->{solution}{account_sid});
42 }
43  
44 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
45 0 my ($self, @arguments) = @_;
46 0 return $self->read_records(@arguments);
47 }
48  
49 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
50 0 my ($self, @arguments) = @_;
51 0 return $self->stream_records(@arguments);
52 }
53  
54 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
55 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
56 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
57  
58 my $params = {
59 Recurring => $options->{recurring},
60 TriggerBy => $options->{trigger_by},
61 UsageCategory => $options->{usage_category},
62 1 PageToken => $page_token,
63 Page => $page_number,
64 PageSize => $page_size,
65 };
66  
67 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
68 1 return $self->_build_page($response);
69 }
70  
71 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
72 0 my ($self, $target_url) = @_;
73 0 my $client = $self->{version}->get_domain->get_client;
74 0 return $self->_build_page($client->request('GET', $target_url));
75 }
76  
77 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
78 1 my ($self, $response) = @_;
79 return Twilio::Rest::Api::V2010::Account::Usage::TriggerPage->new($self->{version}, $response,
80 1 $self->{solution});
81 }
82  
83 4 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
84 4 my ($self, $sid) = @_;
85 return Twilio::Rest::Api::V2010::Account::Usage::TriggerContext->new($self->{version},
86 4 $self->{solution}{account_sid}, $sid);
87 }
88  
89 package Twilio::Rest::Api::V2010::Account::Usage::TriggerPage;
90  
91 3 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
92  
93 1 ▶sub records_key { return 'usage_triggers' }
Subroutine records_key: called CC=1 SCAR=0.0
94  
95 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
96 1 my ($self, $payload) = @_;
97 return Twilio::Rest::Api::V2010::Account::Usage::TriggerInstance->new($self->{version}, $payload,
98 1 $self->{solution}{account_sid});
99 }
100  
101 package Twilio::Rest::Api::V2010::Account::Usage::TriggerContext;
102  
103 3 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
104  
105 3 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
106  
107 4 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
108 4 my ($class, $version, $account_sid, $sid) = @_;
109 4 my $self = $class->SUPER::new($version);
110 4 $self->{solution} = { account_sid => $account_sid, sid => $sid };
111 4 $self->{uri} = join q{}, '/Accounts/', Twilio::Serialize::path_segment($account_sid),
112 '/Usage/Triggers/', Twilio::Serialize::path_segment($sid), '.json';
113 4 return $self;
114 }
115  
116 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
117 1 my ($self) = @_;
118 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
119 1 return 1;
120 }
121  
122 2 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
123 2 my ($self) = @_;
124  
125 2 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
126 2 return $self->_build_instance($response);
127 }
128  
129 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
130 1 my ($self, $options) = @_;
131 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
132  
133 my $data = {
134 CallbackMethod => $options->{callback_method},
135 CallbackUrl => $options->{callback_url},
136 FriendlyName => $options->{friendly_name},
137 1 };
138  
139 my $response =
140 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
141 1 return $self->_build_instance($response);
142 }
143  
144 3 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
145 3 my ($self, $response) = @_;
146 return Twilio::Rest::Api::V2010::Account::Usage::TriggerInstance->new(
147 $self->{version}, $response->get_content,
148 $self->{solution}{account_sid}, $self->{solution}{sid}
149 3 );
150 }
151  
152 package Twilio::Rest::Api::V2010::Account::Usage::TriggerInstance;
153  
154 3 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
155  
156 3 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
157  
158 5 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
159 5 my ($class, $version, $payload, $account_sid, $sid) = @_;
160 5 my $self = $class->SUPER::new($version, $payload);
161 5 ▶ $self->{solution} = { account_sid => $account_sid, sid => $sid // $self->{properties}{sid} };
Condition66%2/3
$sid // $self->{"properties"}{"sid"}
l!l&&r!l&&!r
320
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
162 5 return $self;
163 }
164  
165 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
166 0 my ($self, @arguments) = @_;
167 0 return $self->_context->delete(@arguments);
168 }
169  
170 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
171 0 my ($self, @arguments) = @_;
172 0 return $self->_context->fetch(@arguments);
173 }
174  
175 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
176 0 my ($self, @arguments) = @_;
177 0 return $self->_context->update(@arguments);
178 }
179  
180 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
181 0 my ($self) = @_;
182 return Twilio::Rest::Api::V2010::Account::Usage::TriggerContext->new(
183 $self->{version},
184 $self->{solution}{account_sid},
185 $self->{solution}{sid}
186 0 );
187 }
188  
189 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
190 4 ▶sub api_version { return $_[0]{properties}{api_version} }
Subroutine api_version: called CC=1 SCAR=0.0
191 4 ▶sub callback_method { return $_[0]{properties}{callback_method} }
Subroutine callback_method: called CC=1 SCAR=0.0
192 4 ▶sub callback_url { return $_[0]{properties}{callback_url} }
Subroutine callback_url: called CC=1 SCAR=0.0
193 4 ▶sub current_value { return $_[0]{properties}{current_value} }
Subroutine current_value: called CC=1 SCAR=0.0
194 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
195 4 ▶sub date_fired { return Twilio::Deserialize::date_time($_[0]{properties}{date_fired}) }
Subroutine date_fired: called CC=1 SCAR=0.0
196 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
197 4 ▶sub friendly_name { return $_[0]{properties}{friendly_name} }
Subroutine friendly_name: called CC=1 SCAR=0.0
198 4 ▶sub recurring { return $_[0]{properties}{recurring} }
Subroutine recurring: called CC=1 SCAR=0.0
199 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
200 4 ▶sub trigger_by { return $_[0]{properties}{trigger_by} }
Subroutine trigger_by: called CC=1 SCAR=0.0
201 4 ▶sub trigger_value { return $_[0]{properties}{trigger_value} }
Subroutine trigger_value: called CC=1 SCAR=0.0
202 4 ▶sub uri { return $_[0]{properties}{uri} }
Subroutine uri: called CC=1 SCAR=0.0
203 4 ▶sub usage_category { return $_[0]{properties}{usage_category} }
Subroutine usage_category: called CC=1 SCAR=0.0
204 4 ▶sub usage_record_uri { return $_[0]{properties}{usage_record_uri} }
Subroutine usage_record_uri: called CC=1 SCAR=0.0
205  
206 3 1;
207  
208 __END__
« Twilio/Rest/Voice/V1/ByocTrunk.pm ↑ Summary Twilio/Rest/Messaging/V1/Service/DestinationAlphaSender.pm »