Twilio/Rest/Wireless/V1/Command.pm

filter: Statementstmt 85.8% 79 / 92 Branchbran n/a Conditioncond 57.1% 4 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 84.6% 33 / 39 Podpod n/a totaltotal 81.6% 116 / 142 CC 4 SCAR 2.5
CC
4
Cov
84%
create
2.0
page
2.0
new
2.0
CRAP 1.3
« Twilio/Rest/Pricing/V2/Voice/Country.pm ↑ Summary Twilio/Rest/Api/V2010/Account/Application.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Wireless::V1::Command;
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::Wireless::V1::CommandList;
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} = '/Commands';
20 4 return $self;
21 }
22  
23 1 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
24 1 my ($self, $command, $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 my $data = {
28 Command => $command,
29 CallbackMethod => $options->{callback_method},
30 CallbackUrl => $options->{callback_url},
31 CommandMode => $options->{command_mode},
32 DeliveryReceiptRequested =>
33 Twilio::Serialize::boolean_to_string($options->{delivery_receipt_requested}),
34 IncludeSid => $options->{include_sid},
35 Sim => $options->{sim},
36 1 };
37  
38 my $response =
39 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
40 1 return Twilio::Rest::Wireless::V1::CommandInstance->new($self->{version}, $response->get_content);
41 }
42  
43 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
44 0 my ($self, @arguments) = @_;
45 0 return $self->read_records(@arguments);
46 }
47  
48 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
49 0 my ($self, @arguments) = @_;
50 0 return $self->stream_records(@arguments);
51 }
52  
53 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
54 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
55 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
56  
57 my $params = {
58 Direction => $options->{direction},
59 Sim => $options->{sim},
60 Status => $options->{status},
61 Transport => $options->{transport},
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::Wireless::V1::CommandPage->new($self->{version}, $response,
80 1 $self->{solution});
81 }
82  
83 2 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
84 2 my ($self, $sid) = @_;
85 2 return Twilio::Rest::Wireless::V1::CommandContext->new($self->{version}, $sid);
86 }
87  
88 package Twilio::Rest::Wireless::V1::CommandPage;
89  
90 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
91  
92 1 ▶sub records_key { return 'commands' }
Subroutine records_key: called CC=1 SCAR=0.0
93  
94 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
95 1 my ($self, $payload) = @_;
96 1 return Twilio::Rest::Wireless::V1::CommandInstance->new($self->{version}, $payload);
97 }
98  
99 package Twilio::Rest::Wireless::V1::CommandContext;
100  
101 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
102  
103 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
104  
105 2 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
106 2 my ($class, $version, $sid) = @_;
107 2 my $self = $class->SUPER::new($version);
108 2 $self->{solution} = { sid => $sid };
109 2 $self->{uri} = join q{}, '/Commands/', Twilio::Serialize::path_segment($sid);
110 2 return $self;
111 }
112  
113 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
114 1 my ($self) = @_;
115 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
116 1 return 1;
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 _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
127 1 my ($self, $response) = @_;
128 return Twilio::Rest::Wireless::V1::CommandInstance->new($self->{version}, $response->get_content,
129 1 $self->{solution}{sid});
130 }
131  
132 package Twilio::Rest::Wireless::V1::CommandInstance;
133  
134 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
135  
136 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
137  
138 3 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
139 3 my ($class, $version, $payload, $sid) = @_;
140 3 my $self = $class->SUPER::new($version, $payload);
141 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
142 3 return $self;
143 }
144  
145 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
146 0 my ($self, @arguments) = @_;
147 0 return $self->_context->delete(@arguments);
148 }
149  
150 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
151 0 my ($self, @arguments) = @_;
152 0 return $self->_context->fetch(@arguments);
153 }
154  
155 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
156 0 my ($self) = @_;
157 0 return Twilio::Rest::Wireless::V1::CommandContext->new($self->{version}, $self->{solution}{sid});
158 }
159  
160 3 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
161 3 ▶sub command { return $_[0]{properties}{command} }
Subroutine command: called CC=1 SCAR=0.0
162 3 ▶sub command_mode { return $_[0]{properties}{command_mode} }
Subroutine command_mode: called CC=1 SCAR=0.0
163 3 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
164 3 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
165 3 ▶sub delivery_receipt_requested { return $_[0]{properties}{delivery_receipt_requested} }
Subroutine delivery_receipt_requested: called CC=1 SCAR=0.0
166 3 ▶sub direction { return $_[0]{properties}{direction} }
Subroutine direction: called CC=1 SCAR=0.0
167 3 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
168 3 ▶sub sim_sid { return $_[0]{properties}{sim_sid} }
Subroutine sim_sid: called CC=1 SCAR=0.0
169 3 ▶sub status { return $_[0]{properties}{status} }
Subroutine status: called CC=1 SCAR=0.0
170 3 ▶sub transport { return $_[0]{properties}{transport} }
Subroutine transport: called CC=1 SCAR=0.0
171 3 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
172  
173 2 1;
174  
175 __END__
« Twilio/Rest/Pricing/V2/Voice/Country.pm ↑ Summary Twilio/Rest/Api/V2010/Account/Application.pm »