Twilio/Rest/IpMessaging/V2/Service/Binding.pm

filter: Statementstmt 85.0% 74 / 87 Branchbran n/a Conditioncond 60.0% 3 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 84.2% 32 / 38 Podpod n/a totaltotal 81.9% 109 / 133 CC 3 SCAR 2.2
CC
3
Cov
84%
page
2.0
new
2.0
read
2.0
CRAP 1.3
« Twilio/Rest/Chat/V2/Service/User/UserBinding.pm ↑ Summary Twilio/Rest/IpMessaging/V2/Service/User/UserBinding.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::IpMessaging::V2::Service::Binding;
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::IpMessaging::V2::Service::BindingList;
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 3 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 3 my ($class, $version, $service_sid) = @_;
17 3 my $self = $class->SUPER::new($version);
18 3 $self->{solution} = { service_sid => $service_sid };
19 3 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid), '/Bindings';
20 3 return $self;
21 }
22  
23 0 ▶sub read {
Subroutine read: not called CC=1 SCAR=6.9
24 0 my ($self, @arguments) = @_;
25 0 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 1 ▶sub page {
Subroutine page: called CC=2 SCAR=7.0
34 1 my ($self, $options, $page_size, $page_token, $page_number) = @_;
35 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
36  
37 my $params = {
38 BindingType => $options->{binding_type},
39 Identity => $options->{identity},
40 1 PageToken => $page_token,
41 Page => $page_number,
42 PageSize => $page_size,
43 };
44  
45 1 my $response = $self->{version}->page('GET', $self->{uri}, { params => $params });
46 1 return $self->_build_page($response);
47 }
48  
49 0 ▶sub get_page {
Subroutine get_page: not called CC=1 SCAR=6.9
50 0 my ($self, $target_url) = @_;
51 0 my $client = $self->{version}->get_domain->get_client;
52 0 return $self->_build_page($client->request('GET', $target_url));
53 }
54  
55 1 ▶sub _build_page {
Subroutine _build_page: called CC=1 SCAR=0.0
56 1 my ($self, $response) = @_;
57 return Twilio::Rest::IpMessaging::V2::Service::BindingPage->new($self->{version}, $response,
58 1 $self->{solution});
59 }
60  
61 2 ▶sub get_context {
Subroutine get_context: called CC=1 SCAR=0.0
62 2 my ($self, $sid) = @_;
63 return Twilio::Rest::IpMessaging::V2::Service::BindingContext->new($self->{version},
64 2 $self->{solution}{service_sid}, $sid);
65 }
66  
67 package Twilio::Rest::IpMessaging::V2::Service::BindingPage;
68  
69 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
70  
71 1 ▶sub records_key { return 'bindings' }
Subroutine records_key: called CC=1 SCAR=0.0
72  
73 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
74 1 my ($self, $payload) = @_;
75 return Twilio::Rest::IpMessaging::V2::Service::BindingInstance->new($self->{version}, $payload,
76 1 $self->{solution}{service_sid});
77 }
78  
79 package Twilio::Rest::IpMessaging::V2::Service::BindingContext;
80  
81 2 ▶use parent 'Twilio::InstanceContext';
Subroutine BEGIN: called CC=1 SCAR=0.0
82  
83 2 ▶use Twilio::Serialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
84  
85 2 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
86 2 my ($class, $version, $service_sid, $sid) = @_;
87 2 my $self = $class->SUPER::new($version);
88 2 $self->{solution} = { service_sid => $service_sid, sid => $sid };
89 2 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid),
90 '/Bindings/', Twilio::Serialize::path_segment($sid);
91 2 return $self;
92 }
93  
94 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
95 1 my ($self) = @_;
96 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
97 1 return 1;
98 }
99  
100 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
101 1 my ($self) = @_;
102  
103 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
104 1 return $self->_build_instance($response);
105 }
106  
107 1 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
108 1 my ($self, $response) = @_;
109 return Twilio::Rest::IpMessaging::V2::Service::BindingInstance->new(
110 $self->{version}, $response->get_content,
111 $self->{solution}{service_sid}, $self->{solution}{sid}
112 1 );
113 }
114  
115 package Twilio::Rest::IpMessaging::V2::Service::BindingInstance;
116  
117 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
118  
119 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
120  
121 2 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
122 2 my ($class, $version, $payload, $service_sid, $sid) = @_;
123 2 my $self = $class->SUPER::new($version, $payload);
124 2 ▶ $self->{solution} = { service_sid => $service_sid, sid => $sid // $self->{properties}{sid} };
Condition66%2/3
$sid // $self->{"properties"}{"sid"}
l!l&&r!l&&!r
110
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
125 2 return $self;
126 }
127  
128 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
129 0 my ($self, @arguments) = @_;
130 0 return $self->_context->delete(@arguments);
131 }
132  
133 0 ▶sub fetch {
Subroutine fetch: not called CC=1 SCAR=6.9
134 0 my ($self, @arguments) = @_;
135 0 return $self->_context->fetch(@arguments);
136 }
137  
138 0 ▶sub _context {
Subroutine _context: not called CC=1 SCAR=6.9
139 0 my ($self) = @_;
140 return Twilio::Rest::IpMessaging::V2::Service::BindingContext->new(
141 $self->{version},
142 $self->{solution}{service_sid},
143 $self->{solution}{sid}
144 0 );
145 }
146  
147 2 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
148 2 ▶sub binding_type { return $_[0]{properties}{binding_type} }
Subroutine binding_type: called CC=1 SCAR=0.0
149 2 ▶sub credential_sid { return $_[0]{properties}{credential_sid} }
Subroutine credential_sid: called CC=1 SCAR=0.0
150 2 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
151 2 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
152 2 ▶sub endpoint { return $_[0]{properties}{endpoint} }
Subroutine endpoint: called CC=1 SCAR=0.0
153 2 ▶sub identity { return $_[0]{properties}{identity} }
Subroutine identity: called CC=1 SCAR=0.0
154 2 ▶sub links { return $_[0]{properties}{links} }
Subroutine links: called CC=1 SCAR=0.0
155 2 ▶sub message_types { return $_[0]{properties}{message_types} }
Subroutine message_types: called CC=1 SCAR=0.0
156 2 ▶sub service_sid { return $_[0]{properties}{service_sid} }
Subroutine service_sid: called CC=1 SCAR=0.0
157 2 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
158 2 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
159  
160 2 1;
161  
162 __END__
« Twilio/Rest/Chat/V2/Service/User/UserBinding.pm ↑ Summary Twilio/Rest/IpMessaging/V2/Service/User/UserBinding.pm »