Twilio/Rest/Wireless/V1/RatePlan.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/Messaging/V1/Service/DestinationAlphaSender.pm ↑ Summary Twilio/Rest/Supersim/V1/Fleet.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Wireless::V1::RatePlan;
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::RatePlanList;
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 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} = '/RatePlans';
20 5 return $self;
21 }
22  
23 1 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
24 1 my ($self, $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 DataEnabled => Twilio::Serialize::boolean_to_string($options->{data_enabled}),
29 DataLimit => $options->{data_limit},
30 DataLimitStrategy => $options->{data_limit_strategy},
31 DataMetering => $options->{data_metering},
32 FriendlyName => $options->{friendly_name},
33 InternationalRoaming => $options->{international_roaming},
34 InternationalRoamingDataLimit => $options->{international_roaming_data_limit},
35 MessagingEnabled => Twilio::Serialize::boolean_to_string($options->{messaging_enabled}),
36 NationalRoamingDataLimit => $options->{national_roaming_data_limit},
37 NationalRoamingEnabled =>
38 Twilio::Serialize::boolean_to_string($options->{national_roaming_enabled}),
39 UniqueName => $options->{unique_name},
40 1 VoiceEnabled => Twilio::Serialize::boolean_to_string($options->{voice_enabled}),
41 };
42  
43 my $response =
44 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
45 return Twilio::Rest::Wireless::V1::RatePlanInstance->new($self->{version},
46 1 $response->get_content);
47 }
48  
49 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
50 0 my ($self, @arguments) = @_;
51 0 return $self->read_records(@arguments);
52 }
53  
54 0 ▶sub stream {
Subroutine stream: not called CC=1 SCAR=6.9
55 0 my ($self, @arguments) = @_;
56 0 return $self->stream_records(@arguments);
57 }
58  
59 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
60 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
61 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
62  
63 1 my $params = {
64 PageToken => $page_token,
65 Page => $page_number,
66 PageSize => $page_size,
67 };
68  
69 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
70 1 return $self->_build_page($response);
71 }
72  
73 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
74 0 my ($self, $target_url) = @_;
75 0 my $client = $self->{version}->get_domain->get_client;
76 0 return $self->_build_page($client->request('GET', $target_url));
77 }
78  
79 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
80 1 my ($self, $response) = @_;
81 return Twilio::Rest::Wireless::V1::RatePlanPage->new($self->{version}, $response,
82 1 $self->{solution});
83 }
84  
85 3 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
86 3 my ($self, $sid) = @_;
87 3 return Twilio::Rest::Wireless::V1::RatePlanContext->new($self->{version}, $sid);
88 }
89  
90 package Twilio::Rest::Wireless::V1::RatePlanPage;
91  
92 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
93  
94 1 ▶sub records_key { return 'rate_plans' }
Subroutine records_key: called CC=1 SCAR=0.0
95  
96 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
97 1 my ($self, $payload) = @_;
98 1 return Twilio::Rest::Wireless::V1::RatePlanInstance->new($self->{version}, $payload);
99 }
100  
101 package Twilio::Rest::Wireless::V1::RatePlanContext;
102  
103 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
104  
105 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
106  
107 3 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
108 3 my ($class, $version, $sid) = @_;
109 3 my $self = $class->SUPER::new($version);
110 3 $self->{solution} = { sid => $sid };
111 3 $self->{uri} = join q{}, '/RatePlans/', Twilio::Serialize::path_segment($sid);
112 3 return $self;
113 }
114  
115 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
116 1 my ($self) = @_;
117 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
118 1 return 1;
119 }
120  
121 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
122 1 my ($self) = @_;
123  
124 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
125 1 return $self->_build_instance($response);
126 }
127  
128 1 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
129 1 my ($self, $options) = @_;
130 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
131  
132 my $data = {
133 FriendlyName => $options->{friendly_name},
134 UniqueName => $options->{unique_name},
135 1 };
136  
137 my $response =
138 1 $self->{version}->handle_request('POST', $self->{uri}, 'update', { data => $data });
139 1 return $self->_build_instance($response);
140 }
141  
142 2 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
143 2 my ($self, $response) = @_;
144 return Twilio::Rest::Wireless::V1::RatePlanInstance->new($self->{version},
145 2 $response->get_content, $self->{solution}{sid});
146 }
147  
148 package Twilio::Rest::Wireless::V1::RatePlanInstance;
149  
150 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
151  
152 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
153  
154 4 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
155 4 my ($class, $version, $payload, $sid) = @_;
156 4 my $self = $class->SUPER::new($version, $payload);
157 4 ▶ $self->{solution} = { sid => $sid // $self->{properties}{sid} };
Condition66%2/3
$sid // $self->{"properties"}{"sid"}
l!l&&r!l&&!r
220
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
158 4 return $self;
159 }
160  
161 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
162 0 my ($self, @arguments) = @_;
163 0 return $self->_context->delete(@arguments);
164 }
165  
166 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
167 0 my ($self, @arguments) = @_;
168 0 return $self->_context->fetch(@arguments);
169 }
170  
171 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
172 0 my ($self, @arguments) = @_;
173 0 return $self->_context->update(@arguments);
174 }
175  
176 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
177 0 my ($self) = @_;
178 0 return Twilio::Rest::Wireless::V1::RatePlanContext->new($self->{version}, $self->{solution}{sid});
179 }
180  
181 4 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
182 4 ▶sub data_enabled { return $_[0]{properties}{data_enabled} }
Subroutine data_enabled: called CC=1 SCAR=0.0
183 4 ▶sub data_limit { return $_[0]{properties}{data_limit} }
Subroutine data_limit: called CC=1 SCAR=0.0
184 4 ▶sub data_metering { return $_[0]{properties}{data_metering} }
Subroutine data_metering: called CC=1 SCAR=0.0
185 4 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
186 4 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
187 4 ▶sub friendly_name { return $_[0]{properties}{friendly_name} }
Subroutine friendly_name: called CC=1 SCAR=0.0
188 4 ▶sub international_roaming { return $_[0]{properties}{international_roaming} }
Subroutine international_roaming: called CC=1 SCAR=0.0
189 4 ▶sub international_roaming_data_limit { return $_[0]{properties}{international_roaming_data_limit} }
Subroutine international_roaming_data_limit: called CC=1 SCAR=0.0
190 4 ▶sub messaging_enabled { return $_[0]{properties}{messaging_enabled} }
Subroutine messaging_enabled: called CC=1 SCAR=0.0
191 4 ▶sub national_roaming_data_limit { return $_[0]{properties}{national_roaming_data_limit} }
Subroutine national_roaming_data_limit: called CC=1 SCAR=0.0
192 4 ▶sub national_roaming_enabled { return $_[0]{properties}{national_roaming_enabled} }
Subroutine national_roaming_enabled: called CC=1 SCAR=0.0
193 4 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
194 4 ▶sub unique_name { return $_[0]{properties}{unique_name} }
Subroutine unique_name: called CC=1 SCAR=0.0
195 4 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
196 4 ▶sub voice_enabled { return $_[0]{properties}{voice_enabled} }
Subroutine voice_enabled: called CC=1 SCAR=0.0
197  
198 2 1;
199  
200 __END__
« Twilio/Rest/Messaging/V1/Service/DestinationAlphaSender.pm ↑ Summary Twilio/Rest/Supersim/V1/Fleet.pm »