Twilio/Rest/Preview/Wireless/Sim.pm

filter: Statementstmt 87.5% 91 / 104 Branchbran n/a Conditioncond 57.1% 4 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 88.0% 44 / 50 Podpod n/a totaltotal 84.2% 139 / 165 CC 4 SCAR 2.1
CC
4
Cov
86%
page
2.0
update
2.0
new
2.0
CRAP 1.2
« Twilio/Rest/Wireless/V1/UsageRecord.pm ↑ Summary Twilio/Rest/Insights/V2/Inbound.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Preview::Wireless::Sim;
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::Preview::Wireless::SimList;
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 5 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 5 my ($class, $version) = @_;
17 5 my $self = $class->SUPER::new($version);
18 5 $self->{solution} = {};
19 5 $self->{uri} = '/Sims';
20 5 return $self;
21 }
22  
23 1 ▶sub read {
Subroutine read: called CC=1 SCAR=0.0
24 1 my ($self, @arguments) = @_;
25 1 return $self->read_records(@arguments);
26 }
27  
28 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
29 0 my ($self, @arguments) = @_;
30 0 return $self->stream_records(@arguments);
31 }
32  
33 2 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
34 2 my ($self, $options, $page_size, $page_token, $page_number) = @_;
35 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
36  
37 my $params = {
38 EId => $options->{e_id},
39 Iccid => $options->{iccid},
40 RatePlan => $options->{rate_plan},
41 SimRegistrationCode => $options->{sim_registration_code},
42 Status => $options->{status},
43 2 PageToken => $page_token,
44 Page => $page_number,
45 PageSize => $page_size,
46 };
47  
48 2 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
49 2 return $self->_build_page($response);
50 }
51  
52 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
53 0 my ($self, $target_url) = @_;
54 0 my $client = $self->{version}->get_domain->get_client;
55 0 return $self->_build_page($client->request('GET', $target_url));
56 }
57  
58 2 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
59 2 my ($self, $response) = @_;
60 return Twilio::Rest::Preview::Wireless::SimPage->new($self->{version}, $response,
61 2 $self->{solution});
62 }
63  
64 3 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
65 3 my ($self, $sid) = @_;
66 3 return Twilio::Rest::Preview::Wireless::SimContext->new($self->{version}, $sid);
67 }
68  
69 package Twilio::Rest::Preview::Wireless::SimPage;
70  
71 3 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
72  
73 2 ▶sub records_key { return 'sims' }
Subroutine records_key: called CC=1 SCAR=0.0
74  
75 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
76 1 my ($self, $payload) = @_;
77 1 return Twilio::Rest::Preview::Wireless::SimInstance->new($self->{version}, $payload);
78 }
79  
80 package Twilio::Rest::Preview::Wireless::SimContext;
81  
82 3 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
83  
84 3 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
85  
86 3 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
87 3 my ($class, $version, $sid) = @_;
88 3 my $self = $class->SUPER::new($version);
89 3 $self->{solution} = { sid => $sid };
90 3 $self->{uri} = join q{}, '/Sims/', Twilio::Serialize::path_segment($sid);
91 3 return $self;
92 }
93  
94 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
95 1 my ($self) = @_;
96  
97 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
98 1 return $self->_build_instance($response);
99 }
100  
101 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
102 1 my ($self, $options) = @_;
103 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
104  
105 my $data = {
106 CallbackMethod => $options->{callback_method},
107 CallbackUrl => $options->{callback_url},
108 CommandsCallbackMethod => $options->{commands_callback_method},
109 CommandsCallbackUrl => $options->{commands_callback_url},
110 FriendlyName => $options->{friendly_name},
111 RatePlan => $options->{rate_plan},
112 SmsFallbackMethod => $options->{sms_fallback_method},
113 SmsFallbackUrl => $options->{sms_fallback_url},
114 SmsMethod => $options->{sms_method},
115 SmsUrl => $options->{sms_url},
116 Status => $options->{status},
117 UniqueName => $options->{unique_name},
118 VoiceFallbackMethod => $options->{voice_fallback_method},
119 VoiceFallbackUrl => $options->{voice_fallback_url},
120 VoiceMethod => $options->{voice_method},
121 VoiceUrl => $options->{voice_url},
122 1 };
123  
124 my $response =
125 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
126 1 return $self->_build_instance($response);
127 }
128  
129 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
130 2 my ($self, $response) = @_;
131 return Twilio::Rest::Preview::Wireless::SimInstance->new($self->{version},
132 2 $response->get_content, $self->{solution}{sid});
133 }
134  
135 1 ▶sub usage {
Subroutine usage: called CC=1 SCAR=0.0
136 1 my ($self) = @_;
137 1 require Twilio::Rest::Preview::Wireless::Sim::Usage;
138 return Twilio::Rest::Preview::Wireless::Sim::UsageContext->new($self->{version},
139 1 $self->{solution}{sid});
140 }
141  
142 package Twilio::Rest::Preview::Wireless::SimInstance;
143  
144 3 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
145  
146 3 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
147  
148 3 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
149 3 my ($class, $version, $payload, $sid) = @_;
150 3 my $self = $class->SUPER::new($version, $payload);
151 3 ▶ $self->{solution} = { sid => $sid // $self->{properties}{sid} };
Condition66%2/3
$sid // $self->{"properties"}{"sid"}
l!l&&r!l&&!r
210
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
152 3 return $self;
153 }
154  
155 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
156 0 my ($self, @arguments) = @_;
157 0 return $self->_context->fetch(@arguments);
158 }
159  
160 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
161 0 my ($self, @arguments) = @_;
162 0 return $self->_context->update(@arguments);
163 }
164  
165 0 ▶sub usage {
Subroutine usage: not called CC=1 SCAR=6.9
166 0 my ($self, @arguments) = @_;
167 0 return $self->_context->usage(@arguments);
168 }
169  
170 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
171 0 my ($self) = @_;
172 0 return Twilio::Rest::Preview::Wireless::SimContext->new($self->{version}, $self->{solution}{sid});
173 }
174  
175 3 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
176 3 ▶sub commands_callback_method { return $_[0]{properties}{commands_callback_method} }
Subroutine commands_callback_method: called CC=1 SCAR=0.0
177 3 ▶sub commands_callback_url { return $_[0]{properties}{commands_callback_url} }
Subroutine commands_callback_url: called CC=1 SCAR=0.0
178 3 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
179 3 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
180 3 ▶sub e_id { return $_[0]{properties}{e_id} }
Subroutine e_id: called CC=1 SCAR=0.0
181 3 ▶sub friendly_name { return $_[0]{properties}{friendly_name} }
Subroutine friendly_name: called CC=1 SCAR=0.0
182 3 ▶sub iccid { return $_[0]{properties}{iccid} }
Subroutine iccid: called CC=1 SCAR=0.0
183 3 ▶sub links { return $_[0]{properties}{links} }
Subroutine links: called CC=1 SCAR=0.0
184 3 ▶sub rate_plan_sid { return $_[0]{properties}{rate_plan_sid} }
Subroutine rate_plan_sid: called CC=1 SCAR=0.0
185 3 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
186 3 ▶sub sms_fallback_method { return $_[0]{properties}{sms_fallback_method} }
Subroutine sms_fallback_method: called CC=1 SCAR=0.0
187 3 ▶sub sms_fallback_url { return $_[0]{properties}{sms_fallback_url} }
Subroutine sms_fallback_url: called CC=1 SCAR=0.0
188 3 ▶sub sms_method { return $_[0]{properties}{sms_method} }
Subroutine sms_method: called CC=1 SCAR=0.0
189 3 ▶sub sms_url { return $_[0]{properties}{sms_url} }
Subroutine sms_url: called CC=1 SCAR=0.0
190 3 ▶sub status { return $_[0]{properties}{status} }
Subroutine status: called CC=1 SCAR=0.0
191 3 ▶sub unique_name { return $_[0]{properties}{unique_name} }
Subroutine unique_name: called CC=1 SCAR=0.0
192 3 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
193 3 ▶sub voice_fallback_method { return $_[0]{properties}{voice_fallback_method} }
Subroutine voice_fallback_method: called CC=1 SCAR=0.0
194 3 ▶sub voice_fallback_url { return $_[0]{properties}{voice_fallback_url} }
Subroutine voice_fallback_url: called CC=1 SCAR=0.0
195 3 ▶sub voice_method { return $_[0]{properties}{voice_method} }
Subroutine voice_method: called CC=1 SCAR=0.0
196 3 ▶sub voice_url { return $_[0]{properties}{voice_url} }
Subroutine voice_url: called CC=1 SCAR=0.0
197  
198 3 1;
199  
200 __END__
« Twilio/Rest/Wireless/V1/UsageRecord.pm ↑ Summary Twilio/Rest/Insights/V2/Inbound.pm »