Twilio/Rest/Lookups/V2/LookupOverride.pm

filter: Statementstmt 86.3% 63 / 73 Branchbran n/a Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 82.1% 23 / 28 Podpod n/a totaltotal 82.0% 87 / 106 CC 2 SCAR 2.2
CC
2
Cov
84%
new
2.1
create
2.0
delete
2.0
CRAP 1.2
« Twilio/Rest/IpMessaging/V2/Service/User/UserBinding.pm ↑ Summary Twilio/Rest/Api/V2010/Account/Recording/Transcription.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Lookups::V2::LookupOverride;
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::Lookups::V2::LookupOverrideList;
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, $phone_number) = @_;
17 4 my $self = $class->SUPER::new($version);
18 4 $self->{solution} = { phone_number => $phone_number };
19 4 $self->{uri} = join q{}, '/PhoneNumbers/', Twilio::Serialize::path_segment($phone_number),
20 '/Overrides';
21 4 return $self;
22 }
23  
24 4 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
25 4 my ($self, $field) = @_;
26 return Twilio::Rest::Lookups::V2::LookupOverrideContext->new($self->{version},
27 4 $self->{solution}{phone_number}, $field);
28 }
29  
30 package Twilio::Rest::Lookups::V2::LookupOverrideContext;
31  
32 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
33  
34 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
35  
36 4 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
37 4 my ($class, $version, $phone_number, $field) = @_;
38 4 my $self = $class->SUPER::new($version);
39 4 $self->{solution} = { phone_number => $phone_number, field => $field };
40 4 $self->{uri} = join q{}, '/PhoneNumbers/', Twilio::Serialize::path_segment($phone_number),
41 '/Overrides/', Twilio::Serialize::path_segment($field);
42 4 return $self;
43 }
44  
45 1 ▶sub create {
Subroutine create: called CC=1 SCAR=0.0
46 1 my ($self, $body) = @_;
47  
48 1 my $data = Twilio::Serialize::json_body($body, {});
49  
50 my $response = $self->{version}->handle_request(
51 'POST',
52 $self->{uri},
53 1 'create',
54 {
55 data => $data,
56 headers => { 'Content-Type' => 'application/json', }
57 }
58 );
59 1 return $self->_build_instance($response);
60 }
61  
62 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
63 1 my ($self) = @_;
64 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
65 1 return 1;
66 }
67  
68 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
69 1 my ($self) = @_;
70  
71 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
72 1 return $self->_build_instance($response);
73 }
74  
75 1 ▶sub update {
Subroutine update: called CC=1 SCAR=0.0
76 1 my ($self, $body) = @_;
77  
78 1 my $data = Twilio::Serialize::json_body($body, {});
79  
80 my $response = $self->{version}->handle_request(
81 'PUT',
82 $self->{uri},
83 1 'update',
84 {
85 data => $data,
86 headers => { 'Content-Type' => 'application/json', }
87 }
88 );
89 1 return $self->_build_instance($response);
90 }
91  
92 3 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
93 3 my ($self, $response) = @_;
94 return Twilio::Rest::Lookups::V2::LookupOverrideInstance->new(
95 $self->{version}, $response->get_content,
96 $self->{solution}{phone_number}, $self->{solution}{field}
97 3 );
98 }
99  
100 package Twilio::Rest::Lookups::V2::LookupOverrideInstance;
101  
102 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
103  
104 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
105  
106 3 ▶sub new {
Subroutine new: called CC=2 SCAR=7.4
107 3 my ($class, $version, $payload, $phone_number, $field) = @_;
108 3 my $self = $class->SUPER::new($version, $payload);
109 $self->{solution} =
110 3 ▶ { phone_number => $phone_number, field => $field // $self->{properties}{field} };
Condition33%1/3
$field // $self->{"properties"}{"field"}
l!l&&r!l&&!r
300
MC/DC0%0/2
$field // $self->{"properties"}{"field"}
$field $self->{"properties"}{"field"}
Truth table33%1/3
A // B
A= $fieldB= $self->{"properties"}{"field"}
ABresult
1X1
011
000
111 3 return $self;
112 }
113  
114 0 ▶sub create {
Subroutine create: not called CC=1 SCAR=6.9
115 0 my ($self, @arguments) = @_;
116 0 return $self->_context->create(@arguments);
117 }
118  
119 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
120 0 my ($self, @arguments) = @_;
121 0 return $self->_context->delete(@arguments);
122 }
123  
124 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
125 0 my ($self, @arguments) = @_;
126 0 return $self->_context->fetch(@arguments);
127 }
128  
129 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
130 0 my ($self, @arguments) = @_;
131 0 return $self->_context->update(@arguments);
132 }
133  
134 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
135 0 my ($self) = @_;
136 return Twilio::Rest::Lookups::V2::LookupOverrideContext->new(
137 $self->{version},
138 $self->{solution}{phone_number},
139 $self->{solution}{field}
140 0 );
141 }
142  
143 3 ▶sub original_line_type { return $_[0]{properties}{original_line_type} }
Subroutine original_line_type: called CC=1 SCAR=0.0
144 3 ▶sub overridden_by_account_sid { return $_[0]{properties}{overridden_by_account_sid} }
Subroutine overridden_by_account_sid: called CC=1 SCAR=0.0
145 3 ▶sub overridden_line_type { return $_[0]{properties}{overridden_line_type} }
Subroutine overridden_line_type: called CC=1 SCAR=0.0
146 3 ▶sub override_reason { return $_[0]{properties}{override_reason} }
Subroutine override_reason: called CC=1 SCAR=0.0
147  
148 3 ▶sub override_timestamp {
Subroutine override_timestamp: called CC=1 SCAR=0.0
149 3 return Twilio::Deserialize::date_time($_[0]{properties}{override_timestamp});
150 }
151 3 ▶sub phone_number { return $_[0]{properties}{phone_number} }
Subroutine phone_number: called CC=1 SCAR=0.0
152  
153 2 1;
154  
155 __END__
« Twilio/Rest/IpMessaging/V2/Service/User/UserBinding.pm ↑ Summary Twilio/Rest/Api/V2010/Account/Recording/Transcription.pm »