Twilio/Rest/Notify/V1/Service/Binding.pm

filter: Statementstmt 86.1% 81 / 94 Branchbran n/a Conditioncond 57.1% 4 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 85.3% 35 / 41 Podpod n/a totaltotal 82.1% 120 / 146 CC 4 SCAR 2.4
CC
4
Cov
84%
create
2.0
page
2.0
new
2.0
CRAP 1.3
« Twilio/Rest/Messaging/V1/Service/AlphaSender.pm ↑ Summary Twilio/Rest/Api/V2010/Account/AuthorizedConnectApp.pm »
1 # Generated by tools/generate.pl from Twilio's OpenAPI specs. Do not edit this file.
2 package Twilio::Rest::Notify::V1::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::Notify::V1::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 4 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
16 4 my ($class, $version, $service_sid) = @_;
17 4 my $self = $class->SUPER::new($version);
18 4 $self->{solution} = { service_sid => $service_sid };
19 4 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid), '/Bindings';
20 4 return $self;
21 }
22  
23 1 ▶sub create {
Subroutine create: called CC=2 SCAR=7.0
24 1 my ($self, $identity, $binding_type, $address, $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 Identity => $identity,
29 BindingType => $binding_type,
30 Address => $address,
31 CredentialSid => $options->{credential_sid},
32 Endpoint => $options->{endpoint},
33 NotificationProtocolVersion => $options->{notification_protocol_version},
34 Tag => $options->{tag},
35 1 };
36  
37 my $response =
38 1 $self->{version}->handle_request('POST', $self->{uri}, 'create', { data => $data });
39 return Twilio::Rest::Notify::V1::Service::BindingInstance->new($self->{version},
40 1 $response->get_content, $self->{solution}{service_sid});
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 EndDate => Twilio::Serialize::iso8601_date($options->{end_date}),
59 Identity => $options->{identity},
60 StartDate => Twilio::Serialize::iso8601_date($options->{start_date}),
61 Tag => $options->{tag},
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::Notify::V1::Service::BindingPage->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 return Twilio::Rest::Notify::V1::Service::BindingContext->new($self->{version},
86 2 $self->{solution}{service_sid}, $sid);
87 }
88  
89 package Twilio::Rest::Notify::V1::Service::BindingPage;
90  
91 2 ▶use parent 'Twilio::Page';
Subroutine BEGIN: called CC=1 SCAR=0.0
92  
93 1 ▶sub records_key { return 'bindings' }
Subroutine records_key: called CC=1 SCAR=0.0
94  
95 1 ▶sub build_instance {
Subroutine build_instance: called CC=1 SCAR=0.0
96 1 my ($self, $payload) = @_;
97 return Twilio::Rest::Notify::V1::Service::BindingInstance->new($self->{version}, $payload,
98 1 $self->{solution}{service_sid});
99 }
100  
101 package Twilio::Rest::Notify::V1::Service::BindingContext;
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 2 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
108 2 my ($class, $version, $service_sid, $sid) = @_;
109 2 my $self = $class->SUPER::new($version);
110 2 $self->{solution} = { service_sid => $service_sid, sid => $sid };
111 2 $self->{uri} = join q{}, '/Services/', Twilio::Serialize::path_segment($service_sid),
112 '/Bindings/', Twilio::Serialize::path_segment($sid);
113 2 return $self;
114 }
115  
116 1 ▶sub delete {
Subroutine delete: called CC=1 SCAR=0.0
117 1 my ($self) = @_;
118 1 $self->{version}->handle_request('DELETE', $self->{uri}, 'delete');
119 1 return 1;
120 }
121  
122 1 ▶sub fetch {
Subroutine fetch: called CC=1 SCAR=0.0
123 1 my ($self) = @_;
124  
125 1 my $response = $self->{version}->handle_request('GET', $self->{uri}, 'fetch');
126 1 return $self->_build_instance($response);
127 }
128  
129 1 ▶sub _build_instance {
Subroutine _build_instance: called CC=1 SCAR=0.0
130 1 my ($self, $response) = @_;
131 return Twilio::Rest::Notify::V1::Service::BindingInstance->new(
132 $self->{version}, $response->get_content,
133 $self->{solution}{service_sid}, $self->{solution}{sid}
134 1 );
135 }
136  
137 package Twilio::Rest::Notify::V1::Service::BindingInstance;
138  
139 2 ▶use parent 'Twilio::InstanceResource';
Subroutine BEGIN: called CC=1 SCAR=0.0
140  
141 2 ▶use Twilio::Deserialize;
Subroutine BEGIN: called CC=1 SCAR=0.0
142  
143 3 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
144 3 my ($class, $version, $payload, $service_sid, $sid) = @_;
145 3 my $self = $class->SUPER::new($version, $payload);
146 3 ▶ $self->{solution} = { service_sid => $service_sid, 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
147 3 return $self;
148 }
149  
150 0 ▶sub delete {
Subroutine delete: not called CC=1 SCAR=6.9
151 0 my ($self, @arguments) = @_;
152 0 return $self->_context->delete(@arguments);
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 _context {
Subroutine _context: not called CC=1 SCAR=6.9
161 0 my ($self) = @_;
162 return Twilio::Rest::Notify::V1::Service::BindingContext->new(
163 $self->{version},
164 $self->{solution}{service_sid},
165 $self->{solution}{sid}
166 0 );
167 }
168  
169 3 ▶sub account_sid { return $_[0]{properties}{account_sid} }
Subroutine account_sid: called CC=1 SCAR=0.0
170 3 ▶sub address { return $_[0]{properties}{address} }
Subroutine address: called CC=1 SCAR=0.0
171 3 ▶sub binding_type { return $_[0]{properties}{binding_type} }
Subroutine binding_type: called CC=1 SCAR=0.0
172 3 ▶sub credential_sid { return $_[0]{properties}{credential_sid} }
Subroutine credential_sid: called CC=1 SCAR=0.0
173 3 ▶sub date_created { return Twilio::Deserialize::date_time($_[0]{properties}{date_created}) }
Subroutine date_created: called CC=1 SCAR=0.0
174 3 ▶sub date_updated { return Twilio::Deserialize::date_time($_[0]{properties}{date_updated}) }
Subroutine date_updated: called CC=1 SCAR=0.0
175 3 ▶sub endpoint { return $_[0]{properties}{endpoint} }
Subroutine endpoint: called CC=1 SCAR=0.0
176 3 ▶sub identity { return $_[0]{properties}{identity} }
Subroutine identity: called CC=1 SCAR=0.0
177 3 ▶sub links { return $_[0]{properties}{links} }
Subroutine links: called CC=1 SCAR=0.0
178 3 ▶sub notification_protocol_version { return $_[0]{properties}{notification_protocol_version} }
Subroutine notification_protocol_version: called CC=1 SCAR=0.0
179 3 ▶sub service_sid { return $_[0]{properties}{service_sid} }
Subroutine service_sid: called CC=1 SCAR=0.0
180 3 ▶sub sid { return $_[0]{properties}{sid} }
Subroutine sid: called CC=1 SCAR=0.0
181 3 ▶sub tags { return $_[0]{properties}{tags} }
Subroutine tags: called CC=1 SCAR=0.0
182 3 ▶sub url { return $_[0]{properties}{url} }
Subroutine url: called CC=1 SCAR=0.0
183  
184 2 1;
185  
186 __END__
« Twilio/Rest/Messaging/V1/Service/AlphaSender.pm ↑ Summary Twilio/Rest/Api/V2010/Account/AuthorizedConnectApp.pm »