blib/lib/Net/CampaignMonitor.pm

filter: Statementstmt 21.2% 135 / 636 Branchbran 13.9% 26 / 186 Conditioncond 3.0% 9 / 291 MC/DCmcdc 1.4% 2 / 141 Subroutinesub 20.0% 21 / 105 Podpod 92.3% 85 / 92 totaltotal 19.1% 278 / 1451 CC 192 SCAR 45.5
CC
192
Cov
15%
list_active
182.0
list_unconfirmed
182.0
list_unsubscribed
182.0
CRAP 94.5
↑ Summary
1 package Net::CampaignMonitor;
2  
3 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 10 ▶use 5.008005;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 10 ▶use MIME::Base64;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 10 ▶use REST::Client;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 10 ▶use Params::Util qw{_STRING _NONNEGINT _POSINT _HASH _HASHLIKE _ARRAY};
Subroutine BEGIN: called CC=1 SCAR=0.0
9 10 ▶use JSON;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 10 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 10 ▶use URI;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 10 ▶use URI::Escape;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 10 ▶use version; our $VERSION = version->declare("v2.2.2");
Subroutine BEGIN: called CC=1 SCAR=0.0
15 10 our $CAMPAIGN_MONITOR_DOMAIN = 'api.createsend.com';
16  
17 2 ▶sub authorize_url {
Subroutine authorize_url: called CC=3 SCAR=11.0
Pod documented
18 2 my $class = shift;
19 2 my ($args) = @_;
20 2 ▶ unless(Params::Util::_HASH($args)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_HASH($args)) 2 0 2
21 2 $args = { @_ };
22 }
23 2 my $self = bless($args, $class);
24  
25 2 my $uri = URI->new('https://'.$Net::CampaignMonitor::CAMPAIGN_MONITOR_DOMAIN.'/oauth');
26  
27 2 my @query = map { $_ => $self->{$_} } qw(client_id redirect_uri scope);
28 2 ▶ push @query, state => $self->{state} if exists $self->{state};
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"state"} 1 1 2
29 2 $uri->query_form(\@query);
30  
31 2 return $uri->as_string;
32 }
33  
34 1 ▶sub exchange_token {
Subroutine exchange_token: called CC=4 SCAR=14.1
Pod documented
35 1 my $class = shift;
36 1 my ($args) = @_;
37 1 ▶ unless(Params::Util::_HASH($args)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_HASH($args)) 1 0 1
38 1 $args = { @_ };
39 }
40 1 my $self = bless($args, $class);
41 1 my $oauth_client = Net::CampaignMonitor->create_oauth_client();
42  
43 1 my $body = 'grant_type=authorization_code';
44 1 $body .= "&$_=" . uri_escape($self->{$_}) for qw(client_id client_secret redirect_uri code);
45  
46 1 $oauth_client->POST('https://'.$Net::CampaignMonitor::CAMPAIGN_MONITOR_DOMAIN.'/oauth/token',
47 $body, {'Content-type' => 'application/x-www-form-urlencoded'});
48 1 my $result = $self->decode($oauth_client->responseContent());
49  
50 1 ▶ if (exists $result->{error}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $result->{"error"}) 1 0 1
51 1 croak 'Error exchanging OAuth code for access token. '.$result->{error}.': '.$result->{error_description};
52 }
53 0 return $result;
54 }
55  
56 2 ▶sub new {
Subroutine new: called CC=13 SCAR=29.4
Pod documented
57 2 my $class = shift;
58 2 my ($args) = @_;
59 2 ▶ unless(Params::Util::_HASH($args)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_HASH($args)) 0 2 2
60 0 ▶ if (@_ % 2 == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ % 2 == 0) { } 0 0 0
61 0 $args = { @_ };
62 } else {
63 0 croak 'Error parsing constructor arguments, no hashref and odd number of arguments supplied';
64 }
65 }
66 2 my $self = bless($args, $class);
67 2 $self->{format} = 'json';
68 2 $self->{useragent} = 'createsend-perl-'.$Net::CampaignMonitor::VERSION;
69 2 ▶ unless( Params::Util::_STRING($self->{domain}) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_STRING($self->{"domain"})) 2 0 2
70 2 $self->{domain} = $Net::CampaignMonitor::CAMPAIGN_MONITOR_DOMAIN;
71 }
72  
73 2 my $uri = URI->new;
74 2 ▶ $self->{secure} = 1 unless defined $self->{secure};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"secure"} 0 2 2
75 2 ▶ $uri->scheme($self->{secure} ? 'https' : 'http');
Branch: 1 branch
BranchTrueFalseTotal
$self->{'secure'} ? : 2 0 2
76 2 $uri->host($self->{domain});
77 2 $self->{base_uri} = $uri;
78  
79 2 $self->{base_path} = ['api', 'v3'];
80  
81 2 ▶ unless( Params::Util::_POSINT($self->{timeout}) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_POSINT($self->{"timeout"})) 2 0 2
82 2 $self->{timeout} = 600;
83 }
84  
85 2 ▶ if ( (exists $self->{api_key} ) && !( Params::Util::_STRING( $self->{api_key} )) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"api_key"} and not &Params::Util::_STRING($self->{"api_key"})) 0 2 2
Condition33%1/3
exists $self->{"api_key"} and not &Params::Util::_STRING($self->{"api_key"})
!ll&&!rl&&r
200
MC/DC0%0/2
exists $self->{"api_key"} and not &Params::Util::_STRING($self->{"api_key"})
exists $self->{"api_key"} not &Params::Util::_STRING($self->{"api_key"})
Truth table33%1/3
A and not(B)
A= exists $self->{"api_key"}B= not &Params::Util::_STRING($self->{"api_key"})
ABresult
0X0
100
111
86 0 Carp::croak("Missing or invalid api key");
87 }
88  
89 2 ▶ if ( (exists $self->{access_token} ) && !( Params::Util::_STRING( $self->{access_token} )) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"access_token"} and not &Params::Util::_STRING($self->{"access_token"})) 0 2 2
Condition66%2/3
exists $self->{"access_token"} and not &Params::Util::_STRING($self->{"access_token"})
!ll&&!rl&&r
110
MC/DC0%0/2
exists $self->{"access_token"} and not &Params::Util::_STRING($self->{"access_token"})
exists $self->{"access_token"} not &Params::Util::_STRING($self->{"access_token"})
Truth table66%2/3
A and not(B)
A= exists $self->{"access_token"}B= not &Params::Util::_STRING($self->{"access_token"})
ABresult
0X0
100
111
90 0 Carp::croak("Missing or invalid OAuth access token");
91 }
92  
93 2 ▶ if ( exists $self->{api_key} || exists $self->{access_token} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{'api_key'} or exists $self->{'access_token'}) { } 1 1 2
Condition66%2/3
exists $self->{"api_key"} or exists $self->{"access_token"}
l!l&&r!l&&!r
011
MC/DC50%1/2
exists $self->{"api_key"} or exists $self->{"access_token"}
exists $self->{"api_key"} exists $self->{"access_token"}
Truth table66%2/3
A or B
A= exists $self->{"api_key"}B= exists $self->{"access_token"}
ABresult
1X1
011
000
94 # Create and initialise the rest client
95 1 $self->{client} = $self->create_rest_client();
96 1 $self->account_systemdate();
97 1 return $self;
98 }
99 else {
100 1 return $self;
101 }
102 }
103  
104 1 ▶sub create_rest_client {
Subroutine create_rest_client: called CC=3 SCAR=11.7
Pod undocumented
105 1 my ($self) = @_;
106  
107 1 my $ua = LWP::UserAgent->new;
108 1 $ua->agent($self->{useragent});
109 1 ▶ if (exists $self->{access_token}) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $self->{'access_token'}) { } 1 0 1
elsif (exists $self->{'api_key'}) { } 0 0 0
110 1 $ua->default_header('Authorization' => 'Bearer '.$self->{access_token});
111 } elsif (exists $self->{api_key}) {
112 0 $ua->default_header('Authorization' => 'Basic '.encode_base64($self->{api_key}.':x'));
113 }
114 1 my $client = REST::Client->new({useragent => $ua});
115 1 $client->setFollow(1);
116 1 $client->setTimeout($self->{timeout});
117 1 return $client;
118 }
119  
120 2 ▶sub create_oauth_client {
Subroutine create_oauth_client: called CC=1 SCAR=0.0
Pod undocumented
121 2 my $ua = LWP::UserAgent->new;
122 2 my $client = REST::Client->new({useragent => $ua});
123 2 $client->setFollow(1);
124 2 $client->setTimeout(600);
125 2 return $client;
126 }
127  
128 2 ▶sub refresh_token {
Subroutine refresh_token: called CC=5 SCAR=18.0
Pod documented
129 2 my ($self) = @_;
130  
131 2 ▶ if (!exists $self->{refresh_token} ||
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $self->{"refresh_token"} or exists $self->{"refresh_token"} and not &Params::Util::_STRING($self->{"refresh_token"})) 1 1 2
Condition50%3/6
not exists $self->{"refresh_token"} or exists $self->{"refresh_token"} and not &Params::Util::_STRING($self->{"refresh_token"})
l!l&&r!l&&!r
101
exists $self->{"refresh_token"} and not &Params::Util::_STRING($self->{"refresh_token"})
!ll&&!rl&&r
010
MC/DC33%1/3
not exists $self->{"refresh_token"} or exists $self->{"refresh_token"} and not &Params::Util::_STRING($self->{"refresh_token"})
not exists $self->{"refresh_token"} exists $self->{"refresh_token"} not &Params::Util::_STRING($self->{"refresh_token"})
Truth table50%2/4
not(A) or B and not(C)
A= not exists $self->{"refresh_token"}B= exists $self->{"refresh_token"}C= not &Params::Util::_STRING($self->{"refresh_token"})
ABCresult
1XX1
0111
00X0
0100
132 (exists $self->{refresh_token} && !(Params::Util::_STRING($self->{refresh_token})))) {
133 1 croak 'Error refreshing OAuth token. No refresh token exists.';
134 }
135 1 my $oauth_client = Net::CampaignMonitor->create_oauth_client();
136 1 my $body = 'grant_type=refresh_token&refresh_token='.uri_escape($self->{refresh_token});
137 1 $oauth_client->POST('https://'.$Net::CampaignMonitor::CAMPAIGN_MONITOR_DOMAIN.'/oauth/token', $body,
138 {'Content-type' => 'application/x-www-form-urlencoded'});
139 1 my $result = $self->decode($oauth_client->responseContent());
140  
141 1 ▶ if (exists $result->{error}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $result->{"error"}) 1 0 1
142 1 croak 'Error refreshing OAuth token. '.$result->{error}.': '.$result->{error_description};
143 }
144  
145 # Set the access token and refresh token, and re-create the client
146 0 $self->{access_token} = $result->{access_token};
147 0 $self->{refresh_token} = $result->{refresh_token};
148 0 $self->{client} = $self->create_rest_client();
149 0 return $result;
150 }
151  
152 3 ▶sub decode {
Subroutine decode: called CC=2 SCAR=7.4
Pod undocumented
153 3 my $self = shift;
154 3 my $json = JSON->new->allow_nonref;
155  
156 3 ▶ if ( length $_[0] == 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $_[0] == 0) { } 0 3 3
157 0 return {};
158 }
159 else {
160 3 return $json->decode( $_[0] );
161 }
162 }
163  
164 1 ▶sub account_systemdate {
Subroutine account_systemdate: called CC=1 SCAR=0.0
Pod documented
165 1 my ($self) = @_;
166 1 $self->_rest(GET => 'systemdate');
167  
168 1 return $self->_build_results();
169 }
170  
171 0 ▶sub account_billingdetails {
Subroutine account_billingdetails: not called CC=1 SCAR=6.9
Pod documented
172 0 my ($self) = @_;
173 0 $self->_rest(GET => 'billingdetails');
174  
175 0 return $self->_build_results();
176 }
177  
178 0 ▶sub account_clients {
Subroutine account_clients: not called CC=2 SCAR=17.9
Pod documented
179 0 ▶ if (scalar(@_) == 1) { # Get the list of clients
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @_ == 1) { } 0 0 0
180 0 my ($self) = @_;
181 0 $self->_rest(GET => 'clients');
182  
183 0 return $self->_build_results();
184 }
185 else { # Create a new client
186 0 my ($self, %request) = @_;
187  
188 0 $self->_rest(POST => 'clients', undef, \%request);
189  
190 0 return $self->_build_results();
191 }
192 }
193  
194 0 ▶sub account_countries {
Subroutine account_countries: not called CC=1 SCAR=6.9
Pod documented
195 0 my ($self) = @_;
196 0 $self->_rest(GET => 'countries');
197  
198 0 return $self->_build_results();
199 }
200  
201 0 ▶sub account_timezones {
Subroutine account_timezones: not called CC=1 SCAR=6.9
Pod documented
202 0 my ($self) = @_;
203 0 $self->_rest(GET => 'timezones');
204  
205 0 return $self->_build_results();
206 }
207  
208 0 ▶sub account_apikey {
Subroutine account_apikey: not called CC=1 SCAR=6.9
Pod documented
209 0 my ($self, $siteurl, $username, $password) = @_;
210  
211 0 my $ua = LWP::UserAgent->new;
212 0 $ua->agent($self->{useragent});
213 0 $ua->default_header('Authorization' => 'Basic '.encode_base64($username.':'.$password));
214 0 my $api_client = REST::Client->new({useragent => $ua});
215  
216 0 $api_client->setFollow(1);
217 0 $api_client->setTimeout(60);
218  
219 0 my $uri = $self->_build_uri('format', { siteurl => $siteurl });
220 0 $api_client->GET($uri->as_string);
221  
222 0 return $self->_build_results($api_client);
223 }
224  
225 0 ▶sub account_addadmin{
Subroutine account_addadmin: not called CC=1 SCAR=6.9
Pod documented
226 0 my ($self, %request) = @_;
227  
228 0 $self->_rest(POST => 'admins', undef, \%request);
229  
230 0 return $self->_build_results();
231 }
232  
233 0 ▶sub account_updateadmin{
Subroutine account_updateadmin: not called CC=1 SCAR=6.9
Pod documented
234 0 my ($self, %request) = @_;
235 0 my $email = delete $request{email};
236  
237 0 my $json_request = encode_json \%request;
238  
239 0 $self->_rest(PUT => 'admins', { email => $email }, $json_request);
240  
241 0 return $self->_build_results();
242 }
243  
244 0 ▶sub account_getadmins {
Subroutine account_getadmins: not called CC=1 SCAR=6.9
Pod documented
245 0 my ($self) = @_;
246 0 $self->_rest(GET => 'admins');
247  
248 0 return $self->_build_results();
249 }
250  
251 0 ▶sub account_getadmin {
Subroutine account_getadmin: not called CC=1 SCAR=6.9
Pod documented
252 0 my ($self, $email) = @_;
253  
254 0 $self->_rest(GET => 'admins', { email => $email });
255  
256 0 return $self->_build_results();
257 }
258  
259 0 ▶sub account_deleteadmin {
Subroutine account_deleteadmin: not called CC=1 SCAR=6.9
Pod documented
260 0 my ($self, $email) = @_;
261  
262 0 $self->_rest(DELETE => 'admins', { email => $email });
263  
264 0 return $self->_build_results();
265 }
266  
267 0 ▶sub account_setprimarycontact {
Subroutine account_setprimarycontact: not called CC=1 SCAR=6.9
Pod undocumented
268 0 my ($self, $email) = @_;
269  
270 0 $self->_rest(PUT => 'primarycontact', { email => $email });
271  
272 0 return $self->_build_results();
273 }
274  
275 0 ▶sub account_getprimarycontact {
Subroutine account_getprimarycontact: not called CC=1 SCAR=6.9
Pod documented
276 0 my ($self) = @_;
277  
278 0 $self->_rest(GET => 'primarycontact');
279  
280 0 return $self->_build_results();
281 }
282  
283 0 ▶sub account_externalsession {
Subroutine account_externalsession: not called CC=1 SCAR=6.9
Pod documented
284 0 my ($self, %request) = @_;
285  
286 0 $self->_rest(PUT => 'externalsession', undef, \%request);
287  
288 0 return $self->_build_results();
289 }
290  
291 0 ▶sub client_clientid {
Subroutine client_clientid: not called CC=1 SCAR=6.9
Pod documented
292 0 my ($self, $client_id) = @_;
293  
294 0 $self->_rest(GET => [ clients => $client_id ]);
295  
296 0 return $self->_build_results();
297 }
298  
299 0 ▶sub client_campaigns {
Subroutine client_campaigns: not called CC=1 SCAR=6.9
Pod documented
300 0 my ($self, $client_id) = @_;
301  
302 0 $self->_rest(GET => [ clients => $client_id, 'campaigns' ]);
303  
304 0 return $self->_build_results();
305 }
306  
307 0 ▶sub client_drafts {
Subroutine client_drafts: not called CC=1 SCAR=6.9
Pod documented
308 0 my ($self, $client_id) = @_;
309  
310 0 $self->_rest(GET => [ clients => $client_id, 'drafts' ]);
311  
312 0 return $self->_build_results();
313 }
314  
315 0 ▶sub client_scheduled {
Subroutine client_scheduled: not called CC=1 SCAR=6.9
Pod undocumented
316 0 my ($self, $client_id) = @_;
317  
318 0 $self->_rest(GET => [ clients => $client_id, 'scheduled' ]);
319  
320 0 return $self->_build_results();
321 }
322  
323 0 ▶sub client_lists {
Subroutine client_lists: not called CC=1 SCAR=6.9
Pod documented
324 0 my ($self, $client_id) = @_;
325  
326 0 $self->_rest(GET => [ clients => $client_id, 'lists' ]);
327  
328 0 return $self->_build_results();
329 }
330  
331 0 ▶sub client_listsforemail {
Subroutine client_listsforemail: not called CC=1 SCAR=6.9
Pod documented
332 0 my ($self, %request) = @_;
333 0 my $client_id = $request{clientid};
334 0 my $email = $request{email};
335  
336 0 $self->_rest(GET => [ clients => $client_id, 'listsforemail' ], { email => $email });
337  
338 0 return $self->_build_results();
339 }
340  
341 0 ▶sub client_segments {
Subroutine client_segments: not called CC=1 SCAR=6.9
Pod documented
342 0 my ($self, $client_id) = @_;
343  
344 0 $self->_rest(GET => [ clients => $client_id, 'segments' ]);
345  
346 0 return $self->_build_results();
347 }
348  
349 0 ▶sub client_suppressionlist {
Subroutine client_suppressionlist: not called CC=12 SCAR=50.5
Pod undocumented
350 0 my ($self, %input) = @_;
351 0 my $client_id = delete $input{clientid};
352  
353 0 ▶ unless( Params::Util::_POSINT($input{page}) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_POSINT($input{"page"})) 0 0 0
354 0 $input{page} = 1;
355 }
356 0 ▶ unless( Params::Util::_POSINT($input{pagesize}) && $input{pagesize} >= 10 && $input{pagesize} <= 1000) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000) 0 0 0
Condition0%0/6
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000
!ll&&!rl&&r
000
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10
!ll&&!rl&&r
000
MC/DC0%0/3
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000
&Params::Util::_POSINT($input{"pagesize"}) $input{"pagesize"} >= 10 $input{"pagesize"} <= 1000
Truth table0%0/4
A and B and C
A= &Params::Util::_POSINT($input{"pagesize"})B= $input{"pagesize"} >= 10C= $input{"pagesize"} <= 1000
ABCresult
0XX0
10X0
1100
1111
357 0 $input{pagesize} = 1000;
358 }
359 0 ▶ unless( Params::Util::_STRING($input{orderfield}) && ($input{orderfield} eq 'email' || $input{orderfield} eq 'name' || $input{orderfield} eq 'date')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date") 0 0 0
Condition0%0/9
&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date"
!ll&&!rl&&r
000
$input{"orderfield"} eq "email" or $input{"orderfield"} eq "name" or $input{"orderfield"} eq "date"
l!l&&r!l&&!r
000
$input{"orderfield"} eq "email" or $input{"orderfield"} eq "name"
l!l&&r!l&&!r
000
MC/DC0%0/4
&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date"
&Params::Util::_STRING($input{"orderfield"}) $input{"orderfield"} eq "email" $input{"orderfield"} eq "name" $input{"orderfield"} eq "date"
Truth table0%0/5
A and B or C or D
A= &Params::Util::_STRING($input{"orderfield"})B= $input{"orderfield"} eq "email"C= $input{"orderfield"} eq "name"D= $input{"orderfield"} eq "date"
ABCDresult
0XXX0
10000
11XX1
101X1
10011
360 0 $input{orderfield} = 'email';
361 }
362 0 ▶ unless( Params::Util::_STRING($input{orderdirection}) && ($input{orderdirection} eq 'asc' || $input{orderdirection} eq 'desc')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc") 0 0 0
Condition0%0/6
&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc"
!ll&&!rl&&r
000
$input{"orderdirection"} eq "asc" or $input{"orderdirection"} eq "desc"
l!l&&r!l&&!r
000
MC/DC0%0/3
&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc"
&Params::Util::_STRING($input{"orderdirection"}) $input{"orderdirection"} eq "asc" $input{"orderdirection"} eq "desc"
Truth table0%0/4
A and B or C
A= &Params::Util::_STRING($input{"orderdirection"})B= $input{"orderdirection"} eq "asc"C= $input{"orderdirection"} eq "desc"
ABCresult
0XX0
1000
11X1
1011
363 0 $input{orderdirection} = 'asc';
364 }
365  
366 0 $self->_rest(GET => [ clients => $client_id, 'suppressionlist' ], \%input);
367  
368 0 return $self->_build_results();
369 }
370  
371 0 ▶sub client_suppress {
Subroutine client_suppress: not called CC=1 SCAR=6.9
Pod documented
372 0 my ($self, %request) = @_;
373 0 my $client_id = delete $request{clientid};
374  
375 0 $self->_rest(POST => [ clients => $client_id, 'suppress' ], undef, \%request);
376  
377 0 return $self->_build_results();
378 }
379  
380 0 ▶sub client_unsuppress {
Subroutine client_unsuppress: not called CC=1 SCAR=6.9
Pod documented
381 0 my ($self, %request) = @_;
382 0 my $client_id = delete $request{clientid};
383 0 my $email = delete $request{email};
384  
385 0 $self->_rest(PUT => [ clients => $client_id, 'unsuppress' ], { email => $email }, \%request);
386  
387 0 return $self->_build_results();
388 }
389  
390 0 ▶sub client_templates {
Subroutine client_templates: not called CC=1 SCAR=6.9
Pod documented
391 0 my ($self, $client_id) = @_;
392  
393 0 $self->_rest(GET => [ clients => $client_id, 'templates' ]);
394  
395 0 return $self->_build_results();
396 }
397  
398 0 ▶sub client_setbasics {
Subroutine client_setbasics: not called CC=1 SCAR=6.9
Pod documented
399 0 my ($self, %request) = @_;
400 0 my $client_id = delete $request{clientid};
401  
402 0 $self->_rest(PUT => [ clients => $client_id, 'setbasics' ], undef, \%request);
403  
404 0 return $self->_build_results();
405 }
406  
407 0 ▶sub client_setpaygbilling {
Subroutine client_setpaygbilling: not called CC=1 SCAR=6.9
Pod documented
408 0 my ($self, %request) = @_;
409 0 my $client_id = delete $request{clientid};
410  
411 0 $self->_rest(PUT => [ clients => $client_id, 'setpaygbilling' ], undef, \%request);
412  
413 0 return $self->_build_results();
414 }
415  
416 0 ▶sub client_setmonthlybilling {
Subroutine client_setmonthlybilling: not called CC=1 SCAR=6.9
Pod documented
417 0 my ($self, %request) = @_;
418 0 my $client_id = delete $request{clientid};
419  
420 0 $self->_rest(PUT => [ clients => $client_id, 'setmonthlybilling' ], undef, \%request);
421  
422 0 return $self->_build_results();
423 }
424  
425 0 ▶sub client_transfercredits {
Subroutine client_transfercredits: not called CC=1 SCAR=6.9
Pod documented
426 0 my ($self, %request) = @_;
427 0 my $client_id = delete $request{clientid};
428  
429 0 $self->_rest(POST => [ clients => $client_id, 'credits' ], undef, \%request);
430  
431 0 return $self->_build_results();
432 }
433  
434 0 ▶sub client_delete {
Subroutine client_delete: not called CC=1 SCAR=6.9
Pod documented
435 0 my ($self, $client_id) = @_;
436  
437 0 $self->_rest(DELETE => [ clients => $client_id ]);
438  
439 0 return $self->_build_results();
440 }
441  
442 0 ▶sub client_addperson {
Subroutine client_addperson: not called CC=1 SCAR=6.9
Pod documented
443 0 my ($self, %request) = @_;
444 0 my $client_id = delete $request{clientid};
445  
446 0 $self->_rest(POST => [ clients => $client_id, 'people' ], undef, \%request);
447  
448 0 return $self->_build_results();
449 }
450  
451 0 ▶sub client_updateperson {
Subroutine client_updateperson: not called CC=1 SCAR=6.9
Pod documented
452 0 my ($self, %request) = @_;
453 0 my $client_id = delete $request{clientid};
454 0 my $email = delete $request{email};
455  
456 0 $self->_rest(PUT => [ clients => $client_id, 'people' ], { email => $email }, \%request);
457  
458 0 return $self->_build_results();
459 }
460  
461 0 ▶sub client_getpeople {
Subroutine client_getpeople: not called CC=1 SCAR=6.9
Pod documented
462 0 my ($self, $client_id) = @_;
463  
464 0 $self->_rest(GET => [ clients => $client_id, 'people' ]);
465  
466 0 return $self->_build_results();
467 }
468  
469 0 ▶sub client_getperson {
Subroutine client_getperson: not called CC=1 SCAR=6.9
Pod documented
470 0 my ($self, %request) = @_;
471 0 my $client_id = $request{clientid};
472 0 my $email = $request{email};
473  
474 0 $self->_rest(GET => [ clients => $client_id, 'people' ], { email => $email });
475  
476 0 return $self->_build_results();
477 }
478  
479 0 ▶sub client_deleteperson {
Subroutine client_deleteperson: not called CC=1 SCAR=6.9
Pod documented
480 0 my ($self, %request) = @_;
481 0 my $client_id = $request{clientid};
482 0 my $email = $request{email};
483  
484 0 $self->_rest(DELETE => [ clients => $client_id, 'people' ], { email => $email });
485  
486 0 return $self->_build_results();
487 }
488  
489 0 ▶sub client_setprimarycontact {
Subroutine client_setprimarycontact: not called CC=1 SCAR=6.9
Pod documented
490 0 my ($self, %request) = @_;
491 0 my $client_id = $request{clientid};
492 0 my $email = $request{email};
493  
494 0 $self->_rest(PUT => [ clients => $client_id, 'primarycontact' ], { email => $email });
495  
496 0 return $self->_build_results();
497 }
498  
499 0 ▶sub client_getprimarycontact {
Subroutine client_getprimarycontact: not called CC=1 SCAR=6.9
Pod documented
500 0 my ($self, $client_id) = @_;
501  
502 0 $self->_rest(GET => [ clients => $client_id, 'primarycontact' ]);
503  
504 0 return $self->_build_results();
505 }
506  
507 0 ▶sub lists { # Create a list
Subroutine lists: not called CC=1 SCAR=6.9
Pod documented
508 0 my ($self, %request) = @_;
509 0 my $client_id = delete $request{clientid};
510  
511 0 $self->_rest(POST => [ lists => $client_id ], undef, \%request);
512  
513 0 return $self->_build_results();
514 }
515  
516 0 ▶sub list_listid {
Subroutine list_listid: not called CC=2 SCAR=17.9
Pod documented
517 0 my $self = shift;
518  
519 0 ▶ if ( @_ == 1 ) { # Get the list details
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 1) { } 0 0 0
520 0 my $list_id = $_[0];
521 0 $self->_rest(GET => [ lists => $list_id ]);
522  
523 0 return $self->_build_results();
524 }
525 else { # Updating a list
526 0 my (%request) = @_;
527 0 my $list_id = delete $request{listid};
528  
529 0 $self->_rest(PUT => [ lists => $list_id ], undef, \%request);
530  
531 0 return $self->_build_results();
532 }
533 }
534  
535 0 ▶sub list_stats {
Subroutine list_stats: not called CC=1 SCAR=6.9
Pod documented
536 0 my ($self, $list_id) = @_;
537  
538 0 $self->_rest(GET => [ lists => $list_id, 'stats' ]);
539  
540 0 return $self->_build_results();
541 }
542  
543 0 ▶sub list_customfields {
Subroutine list_customfields: not called CC=2 SCAR=17.9
Pod documented
544 0 my $self = shift;
545  
546 0 ▶ if (scalar(@_) == 1) { # Get the custom field details
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @_ == 1) { } 0 0 0
547 0 my $list_id = $_[0];
548 0 $self->_rest(GET => [ lists => $list_id, 'customfields' ]);
549  
550 0 return $self->_build_results();
551 }
552 else { # Create a new custom field
553 0 my (%request) = @_;
554 0 my $list_id = delete $request{listid};
555  
556 0 $self->_rest(POST => [ lists => $list_id, 'customfields' ], undef, \%request);
557  
558 0 return $self->_build_results();
559 }
560 }
561  
562 0 ▶sub list_customfields_update {
Subroutine list_customfields_update: not called CC=1 SCAR=6.9
Pod documented
563 0 my ($self, %request) = @_;
564 0 my $list_id = delete $request{listid};
565 0 my $key = delete $request{customfieldkey};
566  
567 0 $self->_rest(PUT => [ lists => $list_id, customfields => $key ], undef, \%request);
568  
569 0 return $self->_build_results();
570 }
571  
572 0 ▶sub list_segments {
Subroutine list_segments: not called CC=1 SCAR=6.9
Pod documented
573 0 my ($self, $list_id) = @_;
574  
575 0 $self->_rest(GET => [ lists => $list_id, 'segments' ]);
576  
577 0 return $self->_build_results();
578 }
579  
580 0 ▶sub list_active {
Subroutine list_active: not called CC=13 SCAR=52.0
Pod documented
581 0 my ($self, %input) = @_;
582 0 my $list_id = delete $input{listid};
583  
584 0 ▶ unless( Params::Util::_STRING($input{date}) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_STRING($input{"date"})) 0 0 0
585 0 $input{date} = '';
586 }
587 0 ▶ unless( Params::Util::_POSINT($input{page}) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_POSINT($input{"page"})) 0 0 0
588 0 $input{page} = 1;
589 }
590 0 ▶ unless( Params::Util::_POSINT($input{pagesize}) && $input{pagesize} >= 10 && $input{pagesize} <= 1000) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000) 0 0 0
Condition0%0/6
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000
!ll&&!rl&&r
000
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10
!ll&&!rl&&r
000
MC/DC0%0/3
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000
&Params::Util::_POSINT($input{"pagesize"}) $input{"pagesize"} >= 10 $input{"pagesize"} <= 1000
Truth table0%0/4
A and B and C
A= &Params::Util::_POSINT($input{"pagesize"})B= $input{"pagesize"} >= 10C= $input{"pagesize"} <= 1000
ABCresult
0XX0
10X0
1100
1111
591 0 $input{pagesize} = 1000;
592 }
593 0 ▶ unless( Params::Util::_STRING($input{orderfield}) && ($input{orderfield} eq 'email' || $input{orderfield} eq 'name' || $input{orderfield} eq 'date')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date") 0 0 0
Condition0%0/9
&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date"
!ll&&!rl&&r
000
$input{"orderfield"} eq "email" or $input{"orderfield"} eq "name" or $input{"orderfield"} eq "date"
l!l&&r!l&&!r
000
$input{"orderfield"} eq "email" or $input{"orderfield"} eq "name"
l!l&&r!l&&!r
000
MC/DC0%0/4
&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date"
&Params::Util::_STRING($input{"orderfield"}) $input{"orderfield"} eq "email" $input{"orderfield"} eq "name" $input{"orderfield"} eq "date"
Truth table0%0/5
A and B or C or D
A= &Params::Util::_STRING($input{"orderfield"})B= $input{"orderfield"} eq "email"C= $input{"orderfield"} eq "name"D= $input{"orderfield"} eq "date"
ABCDresult
0XXX0
10000
11XX1
101X1
10011
594 0 $input{orderfield} = 'date';
595 }
596 0 ▶ unless( Params::Util::_STRING($input{orderdirection}) && ($input{orderdirection} eq 'asc' || $input{orderdirection} eq 'desc')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc") 0 0 0
Condition0%0/6
&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc"
!ll&&!rl&&r
000
$input{"orderdirection"} eq "asc" or $input{"orderdirection"} eq "desc"
l!l&&r!l&&!r
000
MC/DC0%0/3
&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc"
&Params::Util::_STRING($input{"orderdirection"}) $input{"orderdirection"} eq "asc" $input{"orderdirection"} eq "desc"
Truth table0%0/4
A and B or C
A= &Params::Util::_STRING($input{"orderdirection"})B= $input{"orderdirection"} eq "asc"C= $input{"orderdirection"} eq "desc"
ABCresult
0XX0
1000
11X1
1011
597 0 $input{orderdirection} = 'asc';
598 }
599  
600 0 $self->_rest(GET => [ lists => $list_id, 'active' ], \%input);
601  
602 0 return $self->_build_results();
603 }
604  
605 0 ▶sub list_unconfirmed {
Subroutine list_unconfirmed: not called CC=13 SCAR=52.0
Pod documented
606 0 my ($self, %input) = @_;
607 0 my $list_id = delete $input{listid};
608  
609 0 ▶ unless( Params::Util::_STRING($input{date}) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_STRING($input{"date"})) 0 0 0
610 0 $input{date} = '';
611 }
612 0 ▶ unless( Params::Util::_POSINT($input{page}) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_POSINT($input{"page"})) 0 0 0
613 0 $input{page} = 1;
614 }
615 0 ▶ unless( Params::Util::_POSINT($input{pagesize}) && $input{pagesize} >= 10 && $input{pagesize} <= 1000) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000) 0 0 0
Condition0%0/6
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000
!ll&&!rl&&r
000
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10
!ll&&!rl&&r
000
MC/DC0%0/3
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000
&Params::Util::_POSINT($input{"pagesize"}) $input{"pagesize"} >= 10 $input{"pagesize"} <= 1000
Truth table0%0/4
A and B and C
A= &Params::Util::_POSINT($input{"pagesize"})B= $input{"pagesize"} >= 10C= $input{"pagesize"} <= 1000
ABCresult
0XX0
10X0
1100
1111
616 0 $input{pagesize} = 1000;
617 }
618 0 ▶ unless( Params::Util::_STRING($input{orderfield}) && ($input{orderfield} eq 'email' || $input{orderfield} eq 'name' || $input{orderfield} eq 'date')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date") 0 0 0
Condition0%0/9
&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date"
!ll&&!rl&&r
000
$input{"orderfield"} eq "email" or $input{"orderfield"} eq "name" or $input{"orderfield"} eq "date"
l!l&&r!l&&!r
000
$input{"orderfield"} eq "email" or $input{"orderfield"} eq "name"
l!l&&r!l&&!r
000
MC/DC0%0/4
&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date"
&Params::Util::_STRING($input{"orderfield"}) $input{"orderfield"} eq "email" $input{"orderfield"} eq "name" $input{"orderfield"} eq "date"
Truth table0%0/5
A and B or C or D
A= &Params::Util::_STRING($input{"orderfield"})B= $input{"orderfield"} eq "email"C= $input{"orderfield"} eq "name"D= $input{"orderfield"} eq "date"
ABCDresult
0XXX0
10000
11XX1
101X1
10011
619 0 $input{orderfield} = 'date';
620 }
621 0 ▶ unless( Params::Util::_STRING($input{orderdirection}) && ($input{orderdirection} eq 'asc' || $input{orderdirection} eq 'desc')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc") 0 0 0
Condition0%0/6
&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc"
!ll&&!rl&&r
000
$input{"orderdirection"} eq "asc" or $input{"orderdirection"} eq "desc"
l!l&&r!l&&!r
000
MC/DC0%0/3
&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc"
&Params::Util::_STRING($input{"orderdirection"}) $input{"orderdirection"} eq "asc" $input{"orderdirection"} eq "desc"
Truth table0%0/4
A and B or C
A= &Params::Util::_STRING($input{"orderdirection"})B= $input{"orderdirection"} eq "asc"C= $input{"orderdirection"} eq "desc"
ABCresult
0XX0
1000
11X1
1011
622 0 $input{orderdirection} = 'asc';
623 }
624  
625 0 $self->_rest(GET => [ lists => $list_id, 'active' ], \%input);
626  
627 0 return $self->_build_results();
628 }
629  
630 0 ▶sub list_unsubscribed {
Subroutine list_unsubscribed: not called CC=13 SCAR=52.0
Pod documented
631 0 my ($self, %input) = @_;
632 0 my $list_id = delete $input{listid};
633  
634 0 ▶ unless( Params::Util::_STRING($input{date}) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_STRING($input{"date"})) 0 0 0
635 0 $input{date} = '';
636 }
637 0 ▶ unless( Params::Util::_POSINT($input{page}) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_POSINT($input{"page"})) 0 0 0
638 0 $input{page} = 1;
639 }
640 0 ▶ unless( Params::Util::_POSINT($input{pagesize}) && $input{pagesize} >= 10 && $input{pagesize} <= 1000) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000) 0 0 0
Condition0%0/6
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000
!ll&&!rl&&r
000
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10
!ll&&!rl&&r
000
MC/DC0%0/3
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000
&Params::Util::_POSINT($input{"pagesize"}) $input{"pagesize"} >= 10 $input{"pagesize"} <= 1000
Truth table0%0/4
A and B and C
A= &Params::Util::_POSINT($input{"pagesize"})B= $input{"pagesize"} >= 10C= $input{"pagesize"} <= 1000
ABCresult
0XX0
10X0
1100
1111
641 0 $input{pagesize} = 1000;
642 }
643 0 ▶ unless( Params::Util::_STRING($input{orderfield}) && ($input{orderfield} eq 'email' || $input{orderfield} eq 'name' || $input{orderfield} eq 'date')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date") 0 0 0
Condition0%0/9
&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date"
!ll&&!rl&&r
000
$input{"orderfield"} eq "email" or $input{"orderfield"} eq "name" or $input{"orderfield"} eq "date"
l!l&&r!l&&!r
000
$input{"orderfield"} eq "email" or $input{"orderfield"} eq "name"
l!l&&r!l&&!r
000
MC/DC0%0/4
&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date"
&Params::Util::_STRING($input{"orderfield"}) $input{"orderfield"} eq "email" $input{"orderfield"} eq "name" $input{"orderfield"} eq "date"
Truth table0%0/5
A and B or C or D
A= &Params::Util::_STRING($input{"orderfield"})B= $input{"orderfield"} eq "email"C= $input{"orderfield"} eq "name"D= $input{"orderfield"} eq "date"
ABCDresult
0XXX0
10000
11XX1
101X1
10011
644 0 $input{orderfield} = 'date';
645 }
646 0 ▶ unless( Params::Util::_STRING($input{orderdirection}) && ($input{orderdirection} eq 'asc' || $input{orderdirection} eq 'desc')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc") 0 0 0
Condition0%0/6
&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc"
!ll&&!rl&&r
000
$input{"orderdirection"} eq "asc" or $input{"orderdirection"} eq "desc"
l!l&&r!l&&!r
000
MC/DC0%0/3
&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc"
&Params::Util::_STRING($input{"orderdirection"}) $input{"orderdirection"} eq "asc" $input{"orderdirection"} eq "desc"
Truth table0%0/4
A and B or C
A= &Params::Util::_STRING($input{"orderdirection"})B= $input{"orderdirection"} eq "asc"C= $input{"orderdirection"} eq "desc"
ABCresult
0XX0
1000
11X1
1011
647 0 $input{orderdirection} = 'asc';
648 }
649  
650 0 $self->_rest(GET => [ lists => $list_id, 'unsubscribed' ], \%input);
651  
652 0 return $self->_build_results();
653 }
654  
655 0 ▶sub list_deleted {
Subroutine list_deleted: not called CC=13 SCAR=52.0
Pod documented
656 0 my ($self, %input) = @_;
657 0 my $list_id = delete $input{listid};
658  
659 0 ▶ unless( Params::Util::_STRING($input{date}) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_STRING($input{"date"})) 0 0 0
660 0 $input{date} = '';
661 }
662 0 ▶ unless( Params::Util::_POSINT($input{page}) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_POSINT($input{"page"})) 0 0 0
663 0 $input{page} = 1;
664 }
665 0 ▶ unless( Params::Util::_POSINT($input{pagesize}) && $input{pagesize} >= 10 && $input{pagesize} <= 1000) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000) 0 0 0
Condition0%0/6
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000
!ll&&!rl&&r
000
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10
!ll&&!rl&&r
000
MC/DC0%0/3
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000
&Params::Util::_POSINT($input{"pagesize"}) $input{"pagesize"} >= 10 $input{"pagesize"} <= 1000
Truth table0%0/4
A and B and C
A= &Params::Util::_POSINT($input{"pagesize"})B= $input{"pagesize"} >= 10C= $input{"pagesize"} <= 1000
ABCresult
0XX0
10X0
1100
1111
666 0 $input{pagesize} = 1000;
667 }
668 0 ▶ unless( Params::Util::_STRING($input{orderfield}) && ($input{orderfield} eq 'email' || $input{orderfield} eq 'name' || $input{orderfield} eq 'date')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date") 0 0 0
Condition0%0/9
&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date"
!ll&&!rl&&r
000
$input{"orderfield"} eq "email" or $input{"orderfield"} eq "name" or $input{"orderfield"} eq "date"
l!l&&r!l&&!r
000
$input{"orderfield"} eq "email" or $input{"orderfield"} eq "name"
l!l&&r!l&&!r
000
MC/DC0%0/4
&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date"
&Params::Util::_STRING($input{"orderfield"}) $input{"orderfield"} eq "email" $input{"orderfield"} eq "name" $input{"orderfield"} eq "date"
Truth table0%0/5
A and B or C or D
A= &Params::Util::_STRING($input{"orderfield"})B= $input{"orderfield"} eq "email"C= $input{"orderfield"} eq "name"D= $input{"orderfield"} eq "date"
ABCDresult
0XXX0
10000
11XX1
101X1
10011
669 0 $input{orderfield} = 'date';
670 }
671 0 ▶ unless( Params::Util::_STRING($input{orderdirection}) && ($input{orderdirection} eq 'asc' || $input{orderdirection} eq 'desc')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc") 0 0 0
Condition0%0/6
&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc"
!ll&&!rl&&r
000
$input{"orderdirection"} eq "asc" or $input{"orderdirection"} eq "desc"
l!l&&r!l&&!r
000
MC/DC0%0/3
&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc"
&Params::Util::_STRING($input{"orderdirection"}) $input{"orderdirection"} eq "asc" $input{"orderdirection"} eq "desc"
Truth table0%0/4
A and B or C
A= &Params::Util::_STRING($input{"orderdirection"})B= $input{"orderdirection"} eq "asc"C= $input{"orderdirection"} eq "desc"
ABCresult
0XX0
1000
11X1
1011
672 0 $input{orderdirection} = 'asc';
673 }
674  
675 0 $self->_rest(GET => [ lists => $list_id, 'deleted' ], \%input);
676  
677 0 return $self->_build_results();
678 }
679  
680 0 ▶sub list_bounced {
Subroutine list_bounced: not called CC=13 SCAR=52.0
Pod documented
681 0 my ($self, %input) = @_;
682 0 my $list_id = delete $input{listid};
683  
684 0 ▶ unless( Params::Util::_STRING($input{date}) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_STRING($input{"date"})) 0 0 0
685 0 $input{date} = '';
686 }
687 0 ▶ unless( Params::Util::_POSINT($input{page}) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_POSINT($input{"page"})) 0 0 0
688 0 $input{page} = 1;
689 }
690 0 ▶ unless( Params::Util::_POSINT($input{pagesize}) && $input{pagesize} >= 10 && $input{pagesize} <= 1000) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000) 0 0 0
Condition0%0/6
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000
!ll&&!rl&&r
000
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10
!ll&&!rl&&r
000
MC/DC0%0/3
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000
&Params::Util::_POSINT($input{"pagesize"}) $input{"pagesize"} >= 10 $input{"pagesize"} <= 1000
Truth table0%0/4
A and B and C
A= &Params::Util::_POSINT($input{"pagesize"})B= $input{"pagesize"} >= 10C= $input{"pagesize"} <= 1000
ABCresult
0XX0
10X0
1100
1111
691 0 $input{pagesize} = 1000;
692 }
693 0 ▶ unless( Params::Util::_STRING($input{orderfield}) && ($input{orderfield} eq 'email' || $input{orderfield} eq 'name' || $input{orderfield} eq 'date')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date") 0 0 0
Condition0%0/9
&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date"
!ll&&!rl&&r
000
$input{"orderfield"} eq "email" or $input{"orderfield"} eq "name" or $input{"orderfield"} eq "date"
l!l&&r!l&&!r
000
$input{"orderfield"} eq "email" or $input{"orderfield"} eq "name"
l!l&&r!l&&!r
000
MC/DC0%0/4
&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date"
&Params::Util::_STRING($input{"orderfield"}) $input{"orderfield"} eq "email" $input{"orderfield"} eq "name" $input{"orderfield"} eq "date"
Truth table0%0/5
A and B or C or D
A= &Params::Util::_STRING($input{"orderfield"})B= $input{"orderfield"} eq "email"C= $input{"orderfield"} eq "name"D= $input{"orderfield"} eq "date"
ABCDresult
0XXX0
10000
11XX1
101X1
10011
694 0 $input{orderfield} = 'date';
695 }
696 0 ▶ unless( Params::Util::_STRING($input{orderdirection}) && ($input{orderdirection} eq 'asc' || $input{orderdirection} eq 'desc')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc") 0 0 0
Condition0%0/6
&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc"
!ll&&!rl&&r
000
$input{"orderdirection"} eq "asc" or $input{"orderdirection"} eq "desc"
l!l&&r!l&&!r
000
MC/DC0%0/3
&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc"
&Params::Util::_STRING($input{"orderdirection"}) $input{"orderdirection"} eq "asc" $input{"orderdirection"} eq "desc"
Truth table0%0/4
A and B or C
A= &Params::Util::_STRING($input{"orderdirection"})B= $input{"orderdirection"} eq "asc"C= $input{"orderdirection"} eq "desc"
ABCresult
0XX0
1000
11X1
1011
697 0 $input{orderdirection} = 'asc';
698 }
699  
700 0 $self->_rest(GET => [ lists => $list_id, 'bounced' ], \%input);
701  
702 0 return $self->_build_results();
703 }
704  
705 0 ▶sub list_options {
Subroutine list_options: not called CC=1 SCAR=6.9
Pod documented
706 0 my ($self, %request) = @_;
707 0 my $list_id = delete $request{listid};
708 0 my $customfield_key = delete $request{customfieldkey};
709  
710 0 $self->_rest(PUT => [ lists => $list_id, customfields => $customfield_key, 'options' ], undef, \%request);
711  
712 0 return $self->_build_results();
713 }
714  
715 0 ▶sub list_delete_customfieldkey {
Subroutine list_delete_customfieldkey: not called CC=1 SCAR=6.9
Pod documented
716 0 my ($self, %request) = @_;
717 0 my $list_id = $request{listid};
718 0 my $customfield_key = $request{customfieldkey};
719  
720 0 $self->_rest(DELETE => [ lists => $list_id, customfields => $customfield_key ]);
721  
722 0 return $self->_build_results();
723 }
724  
725 0 ▶sub list_delete {
Subroutine list_delete: not called CC=1 SCAR=6.9
Pod documented
726 0 my ($self, $list_id) = @_;
727  
728 0 $self->_rest(DELETE => [ lists => $list_id ]);
729  
730 0 return $self->_build_results();
731 }
732  
733 0 ▶sub list_webhooks {
Subroutine list_webhooks: not called CC=2 SCAR=17.9
Pod documented
734 0 my $self = shift;
735  
736 0 ▶ if (scalar(@_) == 1) { #get the list of webhooks
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @_ == 1) { } 0 0 0
737 0 my $list_id = $_[0];
738 0 $self->_rest(GET => [ lists => $list_id, 'webhooks' ]);
739  
740 0 return $self->_build_results();
741 }
742 else { #create a new webhook
743 0 my (%request) = @_;
744 0 my $list_id = delete $request{listid};
745  
746 0 $self->_rest(POST => [ lists => $list_id, 'webhooks' ], undef, \%request);
747  
748 0 return $self->_build_results();
749 }
750 }
751  
752 0 ▶sub list_test {
Subroutine list_test: not called CC=1 SCAR=6.9
Pod documented
753 0 my ($self, %request) = @_;
754 0 my $list_id = $request{listid};
755 0 my $webhook_id = $request{webhookid};
756  
757 0 $self->_rest(GET => [ lists => $list_id, webhooks => $webhook_id, 'test' ]);
758  
759 0 return $self->_build_results();
760 }
761  
762 0 ▶sub list_delete_webhook {
Subroutine list_delete_webhook: not called CC=1 SCAR=6.9
Pod documented
763 0 my ($self, %request) = @_;
764 0 my $list_id = $request{listid};
765 0 my $webhook_id = $request{webhookid};
766  
767 0 $self->_rest(DELETE => [ lists => $list_id, webhooks => $webhook_id ]);
768  
769 0 return $self->_build_results();
770 }
771  
772 0 ▶sub list_activate {
Subroutine list_activate: not called CC=1 SCAR=6.9
Pod documented
773 0 my ($self, %request) = @_;
774 0 my $list_id = $request{listid};
775 0 my $webhook_id = $request{webhookid};
776  
777 0 $self->_rest(PUT => [ lists => $list_id, webhooks => $webhook_id, 'activate' ]);
778  
779 0 return $self->_build_results();
780 }
781  
782 0 ▶sub list_deactivate {
Subroutine list_deactivate: not called CC=1 SCAR=6.9
Pod documented
783 0 my ($self, %request) = @_;
784 0 my $list_id = $request{listid};
785 0 my $webhook_id = $request{webhookid};
786  
787 0 $self->_rest(PUT => [ lists => $list_id, webhooks => $webhook_id, 'deactivate' ]);
788  
789 0 return $self->_build_results();
790 }
791  
792 0 ▶sub segments {
Subroutine segments: not called CC=1 SCAR=6.9
Pod documented
793 0 my ($self, %request) = @_;
794 0 my $list_id = delete $request{listid};
795  
796 0 $self->_rest(POST => [ segments => $list_id ], undef, \%request);
797  
798 0 return $self->_build_results();
799 }
800  
801 0 ▶sub segment_segmentid {
Subroutine segment_segmentid: not called CC=2 SCAR=17.9
Pod documented
802 0 my $self = shift;
803  
804 0 ▶ if (scalar(@_) == 1) { #get the segment details
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @_ == 1) { } 0 0 0
805 0 my $segment_id = $_[0];
806 0 $self->_rest(GET => [ segments => $segment_id ]);
807  
808 0 return $self->_build_results();
809 }
810 else { #update the segment
811 0 my (%request) = @_;
812 0 my $segment_id = delete $request{segmentid};
813  
814 0 $self->_rest(PUT => [ segments => $segment_id ], undef, \%request);
815  
816 0 return $self->_build_results();
817 }
818 }
819  
820 0 ▶sub segment_rules {
Subroutine segment_rules: not called CC=1 SCAR=6.9
Pod documented
821 0 my ($self, %request) = @_;
822 0 my $segment_id = delete $request{segmentid};
823  
824 0 $self->_rest(POST => [ segments => $segment_id, 'rules' ], undef, \%request);
825  
826 0 return $self->_build_results();
827 }
828  
829 0 ▶sub segment_active {
Subroutine segment_active: not called CC=13 SCAR=52.0
Pod documented
830 0 my ($self, %input) = @_;
831 0 my $segment_id = delete $input{segmentid};
832  
833 0 ▶ unless( Params::Util::_STRING($input{date}) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_STRING($input{"date"})) 0 0 0
834 0 $input{date} = '';
835 }
836 0 ▶ unless( Params::Util::_POSINT($input{page}) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_POSINT($input{"page"})) 0 0 0
837 0 $input{page} = 1;
838 }
839 0 ▶ unless( Params::Util::_POSINT($input{pagesize}) && $input{pagesize} >= 10 && $input{pagesize} <= 1000) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000) 0 0 0
Condition0%0/6
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000
!ll&&!rl&&r
000
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10
!ll&&!rl&&r
000
MC/DC0%0/3
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000
&Params::Util::_POSINT($input{"pagesize"}) $input{"pagesize"} >= 10 $input{"pagesize"} <= 1000
Truth table0%0/4
A and B and C
A= &Params::Util::_POSINT($input{"pagesize"})B= $input{"pagesize"} >= 10C= $input{"pagesize"} <= 1000
ABCresult
0XX0
10X0
1100
1111
840 0 $input{pagesize} = 1000;
841 }
842 0 ▶ unless( Params::Util::_STRING($input{orderfield}) && ($input{orderfield} eq 'email' || $input{orderfield} eq 'name' || $input{orderfield} eq 'date')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date") 0 0 0
Condition0%0/9
&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date"
!ll&&!rl&&r
000
$input{"orderfield"} eq "email" or $input{"orderfield"} eq "name" or $input{"orderfield"} eq "date"
l!l&&r!l&&!r
000
$input{"orderfield"} eq "email" or $input{"orderfield"} eq "name"
l!l&&r!l&&!r
000
MC/DC0%0/4
&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date"
&Params::Util::_STRING($input{"orderfield"}) $input{"orderfield"} eq "email" $input{"orderfield"} eq "name" $input{"orderfield"} eq "date"
Truth table0%0/5
A and B or C or D
A= &Params::Util::_STRING($input{"orderfield"})B= $input{"orderfield"} eq "email"C= $input{"orderfield"} eq "name"D= $input{"orderfield"} eq "date"
ABCDresult
0XXX0
10000
11XX1
101X1
10011
843 0 $input{orderfield} = 'date';
844 }
845 0 ▶ unless( Params::Util::_STRING($input{orderdirection}) && ($input{orderdirection} eq 'asc' || $input{orderdirection} eq 'desc')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc") 0 0 0
Condition0%0/6
&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc"
!ll&&!rl&&r
000
$input{"orderdirection"} eq "asc" or $input{"orderdirection"} eq "desc"
l!l&&r!l&&!r
000
MC/DC0%0/3
&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc"
&Params::Util::_STRING($input{"orderdirection"}) $input{"orderdirection"} eq "asc" $input{"orderdirection"} eq "desc"
Truth table0%0/4
A and B or C
A= &Params::Util::_STRING($input{"orderdirection"})B= $input{"orderdirection"} eq "asc"C= $input{"orderdirection"} eq "desc"
ABCresult
0XX0
1000
11X1
1011
846 0 $input{orderdirection} = 'asc';
847 }
848  
849 0 $self->_rest(GET => [ segments => $segment_id, 'active' ], \%input);
850  
851 0 return $self->_build_results();
852 }
853  
854 0 ▶sub segment_delete {
Subroutine segment_delete: not called CC=1 SCAR=6.9
Pod documented
855 0 my ($self, $segment_id) = @_;
856  
857 0 $self->_rest(DELETE => [ segments => $segment_id ]);
858  
859 0 return $self->_build_results();
860 }
861  
862 0 ▶sub segment_delete_rules {
Subroutine segment_delete_rules: not called CC=1 SCAR=6.9
Pod documented
863 0 my ($self, $segment_id) = @_;
864  
865 0 $self->_rest(DELETE => [ segments => $segment_id, 'rules' ]);
866  
867 0 return $self->_build_results();
868 }
869  
870 0 ▶sub subscribers {
Subroutine subscribers: not called CC=2 SCAR=17.9
Pod documented
871 0 my ($self, %request) = @_;
872 0 my $list_id = delete $request{listid};
873  
874 0 ▶ if ($request{email}) { # Get subscribers details
Branch: 1 branch
BranchTrueFalseTotal
if ($request{'email'}) { } 0 0 0
875 0 $self->_rest(GET => [ subscribers => $list_id ], { email => $request{email} });
876  
877 0 return $self->_build_results();
878 }
879 else { # Add subscriber
880  
881 0 $self->_rest(POST => [ subscribers => $list_id ], undef, \%request);
882  
883 0 return $self->_build_results();
884 }
885 }
886  
887 0 ▶sub subscribers_update {
Subroutine subscribers_update: not called CC=1 SCAR=6.9
Pod documented
888 0 my ($self, %request) = @_;
889 0 my $list_id = delete $request{listid};
890 0 my $email = delete $request{email};
891  
892 0 $self->_rest(PUT => [ subscribers => $list_id ], { email => $email }, \%request);
893  
894 0 return $self->_build_results();
895 }
896  
897 0 ▶sub subscribers_import {
Subroutine subscribers_import: not called CC=1 SCAR=6.9
Pod documented
898 0 my ($self, %request) = @_;
899 0 my $list_id = delete $request{listid};
900  
901 0 $self->_rest(POST => [ subscribers => $list_id, 'import' ], undef, \%request);
902  
903 0 return $self->_build_results();
904 }
905  
906 0 ▶sub subscribers_history {
Subroutine subscribers_history: not called CC=1 SCAR=6.9
Pod documented
907 0 my ($self, %request) = @_;
908 0 my $list_id = $request{listid};
909 0 my $email = $request{email};
910  
911 0 $self->_rest(GET => [ subscribers => $list_id, 'history' ], { email => $email });
912  
913 0 return $self->_build_results();
914 }
915  
916 0 ▶sub subscribers_unsubscribe {
Subroutine subscribers_unsubscribe: not called CC=1 SCAR=6.9
Pod documented
917 0 my ($self, %request) = @_;
918 0 my $list_id = delete $request{listid};
919  
920 0 $self->_rest(POST => [ subscribers => $list_id, 'unsubscribe' ], undef, \%request);
921  
922 0 return $self->_build_results();
923 }
924  
925 0 ▶sub subscribers_delete {
Subroutine subscribers_delete: not called CC=1 SCAR=6.9
Pod documented
926 0 my ($self, %request) = @_;
927 0 my $list_id = $request{listid};
928 0 my $email = $request{email};
929  
930 0 $self->_rest(DELETE => [ subscribers => $list_id ], { email => $email });
931  
932 0 return $self->_build_results();
933 }
934  
935 0 ▶sub templates {
Subroutine templates: not called CC=4 SCAR=30.0
Pod documented
936 0 my $self = shift;
937  
938 0 ▶ if ( @_ == 1 ) { #get the template details
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 1) { } 0 0 0
939 0 my $template_id = $_[0];
940 0 $self->_rest(GET => [ templates => $template_id ]);
941  
942 0 return $self->_build_results();
943 }
944 else {
945 0 my (%request) = @_;
946 0 ▶ if ( $request{templateid} ) { #update the template
Branch: 2 branches
BranchTrueFalseTotal
if ($request{'templateid'}) { } 0 0 0
elsif ($request{'clientid'}) { } 0 0 0
947 0 my $template_id = delete $request{templateid};
948  
949 0 $self->_rest(PUT => [ templates => $template_id ], undef, \%request);
950  
951 0 return $self->_build_results();
952 }
953 elsif ( $request{clientid} ) { #create a template
954 0 my $client_id = delete $request{clientid};
955  
956 0 $self->_rest(POST => [ templates => $client_id ], undef, \%request);
957  
958 0 return $self->_build_results();
959 }
960 }
961 }
962  
963 0 ▶sub templates_delete {
Subroutine templates_delete: not called CC=1 SCAR=6.9
Pod documented
964 0 my ($self, $template_id) = @_;
965  
966 0 $self->_rest(DELETE => [ templates => $template_id ]);
967  
968 0 return $self->_build_results();
969 }
970  
971 0 ▶sub campaigns {
Subroutine campaigns: not called CC=1 SCAR=6.9
Pod documented
972 0 my ($self, %request) = @_;
973 0 my $client_id = delete $request{clientid};
974  
975 0 $self->_rest(POST => [ campaigns => $client_id ], undef, \%request);
976  
977 0 return $self->_build_results();
978 }
979  
980 0 ▶sub campaigns_fromtemplate {
Subroutine campaigns_fromtemplate: not called CC=1 SCAR=6.9
Pod documented
981 0 my ($self, %request) = @_;
982 0 my $client_id = delete $request{clientid};
983  
984 0 $self->_rest(POST => [ campaigns => $client_id, 'fromtemplate' ], undef, \%request);
985  
986 0 return $self->_build_results();
987 }
988  
989 0 ▶sub campaigns_send {
Subroutine campaigns_send: not called CC=1 SCAR=6.9
Pod documented
990 0 my ($self, %request) = @_;
991 0 my $campaign_id = delete $request{campaignid};
992  
993 0 $self->_rest(POST => [ campaigns => $campaign_id, 'send' ], undef, \%request);
994  
995 0 return $self->_build_results();
996 }
997  
998 0 ▶sub campaigns_unschedule {
Subroutine campaigns_unschedule: not called CC=1 SCAR=6.9
Pod documented
999 0 my ($self, %request) = @_;
1000 0 my $campaign_id = delete $request{campaignid};
1001  
1002 0 $self->_rest(POST => [ campaigns => $campaign_id, 'unschedule' ], undef, \%request);
1003  
1004 0 return $self->_build_results();
1005 }
1006  
1007 0 ▶sub campaigns_sendpreview {
Subroutine campaigns_sendpreview: not called CC=1 SCAR=6.9
Pod documented
1008 0 my ($self, %request) = @_;
1009 0 my $campaign_id = delete $request{campaignid};
1010  
1011 0 $self->_rest(POST => [ campaigns => $campaign_id, 'sendpreview' ], undef, \%request);
1012  
1013 0 return $self->_build_results();
1014 }
1015  
1016 0 ▶sub campaigns_summary {
Subroutine campaigns_summary: not called CC=1 SCAR=6.9
Pod documented
1017 0 my ($self, $campaign_id) = @_;
1018  
1019 0 $self->_rest(GET => [ campaigns => $campaign_id, 'summary' ]);
1020  
1021 0 return $self->_build_results();
1022 }
1023  
1024 0 ▶sub campaigns_emailclientusage {
Subroutine campaigns_emailclientusage: not called CC=1 SCAR=6.9
Pod undocumented
1025 0 my ($self, $campaign_id) = @_;
1026  
1027 0 $self->_rest(GET => [ campaigns => $campaign_id, 'emailclientusage' ]);
1028  
1029 0 return $self->_build_results();
1030 }
1031  
1032 0 ▶sub campaigns_listsandsegments {
Subroutine campaigns_listsandsegments: not called CC=1 SCAR=6.9
Pod documented
1033 0 my ($self, $campaign_id) = @_;
1034  
1035 0 $self->_rest(GET => [ campaigns => $campaign_id, 'listsandsegments' ]);
1036  
1037 0 return $self->_build_results();
1038 }
1039  
1040 0 ▶sub campaigns_recipients {
Subroutine campaigns_recipients: not called CC=12 SCAR=50.5
Pod documented
1041 0 my ($self, %input) = @_;
1042 0 my $campaign_id = delete $input{campaignid};
1043  
1044 0 ▶ unless( Params::Util::_POSINT($input{page}) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_POSINT($input{"page"})) 0 0 0
1045 0 $input{page} = 1;
1046 }
1047 0 ▶ unless( Params::Util::_POSINT($input{pagesize}) && $input{pagesize} >= 10 && $input{pagesize} <= 1000) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000) 0 0 0
Condition0%0/6
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000
!ll&&!rl&&r
000
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10
!ll&&!rl&&r
000
MC/DC0%0/3
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000
&Params::Util::_POSINT($input{"pagesize"}) $input{"pagesize"} >= 10 $input{"pagesize"} <= 1000
Truth table0%0/4
A and B and C
A= &Params::Util::_POSINT($input{"pagesize"})B= $input{"pagesize"} >= 10C= $input{"pagesize"} <= 1000
ABCresult
0XX0
10X0
1100
1111
1048 0 $input{pagesize} = 1000;
1049 }
1050 0 ▶ unless( Params::Util::_STRING($input{orderfield}) && ($input{orderfield} eq 'email' || $input{orderfield} eq 'name' || $input{orderfield} eq 'date')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date") 0 0 0
Condition0%0/9
&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date"
!ll&&!rl&&r
000
$input{"orderfield"} eq "email" or $input{"orderfield"} eq "name" or $input{"orderfield"} eq "date"
l!l&&r!l&&!r
000
$input{"orderfield"} eq "email" or $input{"orderfield"} eq "name"
l!l&&r!l&&!r
000
MC/DC0%0/4
&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date"
&Params::Util::_STRING($input{"orderfield"}) $input{"orderfield"} eq "email" $input{"orderfield"} eq "name" $input{"orderfield"} eq "date"
Truth table0%0/5
A and B or C or D
A= &Params::Util::_STRING($input{"orderfield"})B= $input{"orderfield"} eq "email"C= $input{"orderfield"} eq "name"D= $input{"orderfield"} eq "date"
ABCDresult
0XXX0
10000
11XX1
101X1
10011
1051 0 $input{orderfield} = 'date';
1052 }
1053 0 ▶ unless( Params::Util::_STRING($input{orderdirection}) && ($input{orderdirection} eq 'asc' || $input{orderdirection} eq 'desc')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc") 0 0 0
Condition0%0/6
&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc"
!ll&&!rl&&r
000
$input{"orderdirection"} eq "asc" or $input{"orderdirection"} eq "desc"
l!l&&r!l&&!r
000
MC/DC0%0/3
&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc"
&Params::Util::_STRING($input{"orderdirection"}) $input{"orderdirection"} eq "asc" $input{"orderdirection"} eq "desc"
Truth table0%0/4
A and B or C
A= &Params::Util::_STRING($input{"orderdirection"})B= $input{"orderdirection"} eq "asc"C= $input{"orderdirection"} eq "desc"
ABCresult
0XX0
1000
11X1
1011
1054 0 $input{orderdirection} = 'asc';
1055 }
1056  
1057 0 $self->_rest(GET => [ campaigns => $campaign_id, 'recipients' ], \%input);
1058  
1059 0 return $self->_build_results();
1060 }
1061  
1062 0 ▶sub campaigns_bounces {
Subroutine campaigns_bounces: not called CC=12 SCAR=50.5
Pod documented
1063 0 my ($self, %input) = @_;
1064 0 my $campaign_id = delete $input{campaignid};
1065  
1066 0 ▶ unless( Params::Util::_POSINT($input{page}) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_POSINT($input{"page"})) 0 0 0
1067 0 $input{page} = 1;
1068 }
1069 0 ▶ unless( Params::Util::_POSINT($input{pagesize}) && $input{pagesize} >= 10 && $input{pagesize} <= 1000) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000) 0 0 0
Condition0%0/6
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000
!ll&&!rl&&r
000
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10
!ll&&!rl&&r
000
MC/DC0%0/3
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000
&Params::Util::_POSINT($input{"pagesize"}) $input{"pagesize"} >= 10 $input{"pagesize"} <= 1000
Truth table0%0/4
A and B and C
A= &Params::Util::_POSINT($input{"pagesize"})B= $input{"pagesize"} >= 10C= $input{"pagesize"} <= 1000
ABCresult
0XX0
10X0
1100
1111
1070 0 $input{pagesize} = 1000;
1071 }
1072 0 ▶ unless( Params::Util::_STRING($input{orderfield}) && ($input{orderfield} eq 'email' || $input{orderfield} eq 'name' || $input{orderfield} eq 'date')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date") 0 0 0
Condition0%0/9
&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date"
!ll&&!rl&&r
000
$input{"orderfield"} eq "email" or $input{"orderfield"} eq "name" or $input{"orderfield"} eq "date"
l!l&&r!l&&!r
000
$input{"orderfield"} eq "email" or $input{"orderfield"} eq "name"
l!l&&r!l&&!r
000
MC/DC0%0/4
&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date"
&Params::Util::_STRING($input{"orderfield"}) $input{"orderfield"} eq "email" $input{"orderfield"} eq "name" $input{"orderfield"} eq "date"
Truth table0%0/5
A and B or C or D
A= &Params::Util::_STRING($input{"orderfield"})B= $input{"orderfield"} eq "email"C= $input{"orderfield"} eq "name"D= $input{"orderfield"} eq "date"
ABCDresult
0XXX0
10000
11XX1
101X1
10011
1073 0 $input{orderfield} = 'date';
1074 }
1075 0 ▶ unless( Params::Util::_STRING($input{orderdirection}) && ($input{orderdirection} eq 'asc' || $input{orderdirection} eq 'desc')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc") 0 0 0
Condition0%0/6
&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc"
!ll&&!rl&&r
000
$input{"orderdirection"} eq "asc" or $input{"orderdirection"} eq "desc"
l!l&&r!l&&!r
000
MC/DC0%0/3
&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc"
&Params::Util::_STRING($input{"orderdirection"}) $input{"orderdirection"} eq "asc" $input{"orderdirection"} eq "desc"
Truth table0%0/4
A and B or C
A= &Params::Util::_STRING($input{"orderdirection"})B= $input{"orderdirection"} eq "asc"C= $input{"orderdirection"} eq "desc"
ABCresult
0XX0
1000
11X1
1011
1076 0 $input{orderdirection} = 'asc';
1077 }
1078  
1079 0 $self->_rest(GET => [ campaigns => $campaign_id, 'bounces' ], \%input);
1080  
1081 0 return $self->_build_results();
1082 }
1083  
1084 0 ▶sub campaigns_opens {
Subroutine campaigns_opens: not called CC=12 SCAR=50.5
Pod documented
1085 0 my ($self, %input) = @_;
1086 0 my $campaign_id = delete $input{campaignid};
1087  
1088 0 ▶ unless( Params::Util::_POSINT($input{page}) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_POSINT($input{"page"})) 0 0 0
1089 0 $input{page} = 1;
1090 }
1091 0 ▶ unless( Params::Util::_POSINT($input{pagesize}) && $input{pagesize} >= 10 && $input{pagesize} <= 1000) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000) 0 0 0
Condition0%0/6
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000
!ll&&!rl&&r
000
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10
!ll&&!rl&&r
000
MC/DC0%0/3
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000
&Params::Util::_POSINT($input{"pagesize"}) $input{"pagesize"} >= 10 $input{"pagesize"} <= 1000
Truth table0%0/4
A and B and C
A= &Params::Util::_POSINT($input{"pagesize"})B= $input{"pagesize"} >= 10C= $input{"pagesize"} <= 1000
ABCresult
0XX0
10X0
1100
1111
1092 0 $input{pagesize} = 1000;
1093 }
1094 0 ▶ unless( Params::Util::_STRING($input{orderfield}) && ($input{orderfield} eq 'email' || $input{orderfield} eq 'name' || $input{orderfield} eq 'date')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date") 0 0 0
Condition0%0/9
&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date"
!ll&&!rl&&r
000
$input{"orderfield"} eq "email" or $input{"orderfield"} eq "name" or $input{"orderfield"} eq "date"
l!l&&r!l&&!r
000
$input{"orderfield"} eq "email" or $input{"orderfield"} eq "name"
l!l&&r!l&&!r
000
MC/DC0%0/4
&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date"
&Params::Util::_STRING($input{"orderfield"}) $input{"orderfield"} eq "email" $input{"orderfield"} eq "name" $input{"orderfield"} eq "date"
Truth table0%0/5
A and B or C or D
A= &Params::Util::_STRING($input{"orderfield"})B= $input{"orderfield"} eq "email"C= $input{"orderfield"} eq "name"D= $input{"orderfield"} eq "date"
ABCDresult
0XXX0
10000
11XX1
101X1
10011
1095 0 $input{orderfield} = 'date';
1096 }
1097 0 ▶ unless( Params::Util::_STRING($input{orderdirection}) && ($input{orderdirection} eq 'asc' || $input{orderdirection} eq 'desc')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc") 0 0 0
Condition0%0/6
&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc"
!ll&&!rl&&r
000
$input{"orderdirection"} eq "asc" or $input{"orderdirection"} eq "desc"
l!l&&r!l&&!r
000
MC/DC0%0/3
&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc"
&Params::Util::_STRING($input{"orderdirection"}) $input{"orderdirection"} eq "asc" $input{"orderdirection"} eq "desc"
Truth table0%0/4
A and B or C
A= &Params::Util::_STRING($input{"orderdirection"})B= $input{"orderdirection"} eq "asc"C= $input{"orderdirection"} eq "desc"
ABCresult
0XX0
1000
11X1
1011
1098 0 $input{orderdirection} = 'asc';
1099 }
1100  
1101 0 $self->_rest(GET => [ campaigns => $campaign_id, 'opens' ], \%input);
1102  
1103 0 return $self->_build_results();
1104 }
1105  
1106 0 ▶sub campaigns_clicks {
Subroutine campaigns_clicks: not called CC=12 SCAR=50.5
Pod documented
1107 0 my ($self, %input) = @_;
1108 0 my $campaign_id = delete $input{campaignid};
1109  
1110 0 ▶ unless( Params::Util::_POSINT($input{page}) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_POSINT($input{"page"})) 0 0 0
1111 0 $input{page} = 1;
1112 }
1113 0 ▶ unless( Params::Util::_POSINT($input{pagesize}) && $input{pagesize} >= 10 && $input{pagesize} <= 1000) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000) 0 0 0
Condition0%0/6
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000
!ll&&!rl&&r
000
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10
!ll&&!rl&&r
000
MC/DC0%0/3
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000
&Params::Util::_POSINT($input{"pagesize"}) $input{"pagesize"} >= 10 $input{"pagesize"} <= 1000
Truth table0%0/4
A and B and C
A= &Params::Util::_POSINT($input{"pagesize"})B= $input{"pagesize"} >= 10C= $input{"pagesize"} <= 1000
ABCresult
0XX0
10X0
1100
1111
1114 0 $input{pagesize} = 1000;
1115 }
1116 0 ▶ unless( Params::Util::_STRING($input{orderfield}) && ($input{orderfield} eq 'email' || $input{orderfield} eq 'name' || $input{orderfield} eq 'date')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date") 0 0 0
Condition0%0/9
&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date"
!ll&&!rl&&r
000
$input{"orderfield"} eq "email" or $input{"orderfield"} eq "name" or $input{"orderfield"} eq "date"
l!l&&r!l&&!r
000
$input{"orderfield"} eq "email" or $input{"orderfield"} eq "name"
l!l&&r!l&&!r
000
MC/DC0%0/4
&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date"
&Params::Util::_STRING($input{"orderfield"}) $input{"orderfield"} eq "email" $input{"orderfield"} eq "name" $input{"orderfield"} eq "date"
Truth table0%0/5
A and B or C or D
A= &Params::Util::_STRING($input{"orderfield"})B= $input{"orderfield"} eq "email"C= $input{"orderfield"} eq "name"D= $input{"orderfield"} eq "date"
ABCDresult
0XXX0
10000
11XX1
101X1
10011
1117 0 $input{orderfield} = 'date';
1118 }
1119 0 ▶ unless( Params::Util::_STRING($input{orderdirection}) && ($input{orderdirection} eq 'asc' || $input{orderdirection} eq 'desc')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc") 0 0 0
Condition0%0/6
&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc"
!ll&&!rl&&r
000
$input{"orderdirection"} eq "asc" or $input{"orderdirection"} eq "desc"
l!l&&r!l&&!r
000
MC/DC0%0/3
&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc"
&Params::Util::_STRING($input{"orderdirection"}) $input{"orderdirection"} eq "asc" $input{"orderdirection"} eq "desc"
Truth table0%0/4
A and B or C
A= &Params::Util::_STRING($input{"orderdirection"})B= $input{"orderdirection"} eq "asc"C= $input{"orderdirection"} eq "desc"
ABCresult
0XX0
1000
11X1
1011
1120 0 $input{orderdirection} = 'asc';
1121 }
1122  
1123 0 $self->_rest(GET => [ campaigns => $campaign_id, 'clicks' ], \%input);
1124  
1125 0 return $self->_build_results();
1126 }
1127  
1128 0 ▶sub campaigns_unsubscribes {
Subroutine campaigns_unsubscribes: not called CC=12 SCAR=50.5
Pod documented
1129 0 my ($self, %input) = @_;
1130 0 my $campaign_id = delete $input{campaignid};
1131  
1132 0 ▶ unless( Params::Util::_POSINT($input{page}) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_POSINT($input{"page"})) 0 0 0
1133 0 $input{page} = 1;
1134 }
1135 0 ▶ unless( Params::Util::_POSINT($input{pagesize}) && $input{pagesize} >= 10 && $input{pagesize} <= 1000) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000) 0 0 0
Condition0%0/6
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000
!ll&&!rl&&r
000
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10
!ll&&!rl&&r
000
MC/DC0%0/3
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000
&Params::Util::_POSINT($input{"pagesize"}) $input{"pagesize"} >= 10 $input{"pagesize"} <= 1000
Truth table0%0/4
A and B and C
A= &Params::Util::_POSINT($input{"pagesize"})B= $input{"pagesize"} >= 10C= $input{"pagesize"} <= 1000
ABCresult
0XX0
10X0
1100
1111
1136 0 $input{pagesize} = 1000;
1137 }
1138 0 ▶ unless( Params::Util::_STRING($input{orderfield}) && ($input{orderfield} eq 'email' || $input{orderfield} eq 'name' || $input{orderfield} eq 'date')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date") 0 0 0
Condition0%0/9
&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date"
!ll&&!rl&&r
000
$input{"orderfield"} eq "email" or $input{"orderfield"} eq "name" or $input{"orderfield"} eq "date"
l!l&&r!l&&!r
000
$input{"orderfield"} eq "email" or $input{"orderfield"} eq "name"
l!l&&r!l&&!r
000
MC/DC0%0/4
&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date"
&Params::Util::_STRING($input{"orderfield"}) $input{"orderfield"} eq "email" $input{"orderfield"} eq "name" $input{"orderfield"} eq "date"
Truth table0%0/5
A and B or C or D
A= &Params::Util::_STRING($input{"orderfield"})B= $input{"orderfield"} eq "email"C= $input{"orderfield"} eq "name"D= $input{"orderfield"} eq "date"
ABCDresult
0XXX0
10000
11XX1
101X1
10011
1139 0 $input{orderfield} = 'date';
1140 }
1141 0 ▶ unless( Params::Util::_STRING($input{orderdirection}) && ($input{orderdirection} eq 'asc' || $input{orderdirection} eq 'desc')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc") 0 0 0
Condition0%0/6
&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc"
!ll&&!rl&&r
000
$input{"orderdirection"} eq "asc" or $input{"orderdirection"} eq "desc"
l!l&&r!l&&!r
000
MC/DC0%0/3
&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc"
&Params::Util::_STRING($input{"orderdirection"}) $input{"orderdirection"} eq "asc" $input{"orderdirection"} eq "desc"
Truth table0%0/4
A and B or C
A= &Params::Util::_STRING($input{"orderdirection"})B= $input{"orderdirection"} eq "asc"C= $input{"orderdirection"} eq "desc"
ABCresult
0XX0
1000
11X1
1011
1142 0 $input{orderdirection} = 'asc';
1143 }
1144  
1145 0 $self->_rest(GET => [ campaigns => $campaign_id, 'unsubscribes' ], \%input);
1146  
1147 0 return $self->_build_results();
1148 }
1149  
1150 0 ▶sub campaigns_spam {
Subroutine campaigns_spam: not called CC=12 SCAR=50.5
Pod documented
1151 0 my ($self, %input) = @_;
1152 0 my $campaign_id = delete $input{campaignid};
1153  
1154 0 ▶ unless( Params::Util::_POSINT($input{page}) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_POSINT($input{"page"})) 0 0 0
1155 0 $input{page} = 1;
1156 }
1157 0 ▶ unless( Params::Util::_POSINT($input{pagesize}) && $input{pagesize} >= 10 && $input{pagesize} <= 1000) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000) 0 0 0
Condition0%0/6
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000
!ll&&!rl&&r
000
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10
!ll&&!rl&&r
000
MC/DC0%0/3
&Params::Util::_POSINT($input{"pagesize"}) and $input{"pagesize"} >= 10 and $input{"pagesize"} <= 1000
&Params::Util::_POSINT($input{"pagesize"}) $input{"pagesize"} >= 10 $input{"pagesize"} <= 1000
Truth table0%0/4
A and B and C
A= &Params::Util::_POSINT($input{"pagesize"})B= $input{"pagesize"} >= 10C= $input{"pagesize"} <= 1000
ABCresult
0XX0
10X0
1100
1111
1158 0 $input{pagesize} = 1000;
1159 }
1160 0 ▶ unless( Params::Util::_STRING($input{orderfield}) && ($input{orderfield} eq 'email' || $input{orderfield} eq 'name' || $input{orderfield} eq 'date')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date") 0 0 0
Condition0%0/9
&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date"
!ll&&!rl&&r
000
$input{"orderfield"} eq "email" or $input{"orderfield"} eq "name" or $input{"orderfield"} eq "date"
l!l&&r!l&&!r
000
$input{"orderfield"} eq "email" or $input{"orderfield"} eq "name"
l!l&&r!l&&!r
000
MC/DC0%0/4
&Params::Util::_STRING($input{"orderfield"}) and $input{"orderfield"} eq "email" || $input{"orderfield"} eq "name" || $input{"orderfield"} eq "date"
&Params::Util::_STRING($input{"orderfield"}) $input{"orderfield"} eq "email" $input{"orderfield"} eq "name" $input{"orderfield"} eq "date"
Truth table0%0/5
A and B or C or D
A= &Params::Util::_STRING($input{"orderfield"})B= $input{"orderfield"} eq "email"C= $input{"orderfield"} eq "name"D= $input{"orderfield"} eq "date"
ABCDresult
0XXX0
10000
11XX1
101X1
10011
1161 0 $input{orderfield} = 'date';
1162 }
1163 0 ▶ unless( Params::Util::_STRING($input{orderdirection}) && ($input{orderdirection} eq 'asc' || $input{orderdirection} eq 'desc')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc") 0 0 0
Condition0%0/6
&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc"
!ll&&!rl&&r
000
$input{"orderdirection"} eq "asc" or $input{"orderdirection"} eq "desc"
l!l&&r!l&&!r
000
MC/DC0%0/3
&Params::Util::_STRING($input{"orderdirection"}) and $input{"orderdirection"} eq "asc" || $input{"orderdirection"} eq "desc"
&Params::Util::_STRING($input{"orderdirection"}) $input{"orderdirection"} eq "asc" $input{"orderdirection"} eq "desc"
Truth table0%0/4
A and B or C
A= &Params::Util::_STRING($input{"orderdirection"})B= $input{"orderdirection"} eq "asc"C= $input{"orderdirection"} eq "desc"
ABCresult
0XX0
1000
11X1
1011
1164 0 $input{orderdirection} = 'asc';
1165 }
1166  
1167 0 $self->_rest(GET => [ campaigns => $campaign_id, 'spam' ], \%input);
1168  
1169 0 return $self->_build_results();
1170 }
1171  
1172 0 ▶sub campaigns_delete {
Subroutine campaigns_delete: not called CC=1 SCAR=6.9
Pod documented
1173 0 my ($self, $campaign_id) = @_;
1174  
1175 0 $self->_rest(DELETE => [ campaigns => $campaign_id ]);
1176  
1177 0 return $self->_build_results();
1178 }
1179  
1180 1 ▶sub _build_results {
Subroutine _build_results: called CC=2 SCAR=7.2
1181 1 my ($self, $client) = @_;
1182 1 ▶ $client ||= $self->{client};
Condition33%1/3
$client ||= $self->{"client"}
l!l&&r!l&&!r
010
MC/DC0%0/2
$client ||= $self->{"client"}
$client $self->{"client"}
Truth table33%1/3
A ||= B
A= $clientB= $self->{"client"}
ABresult
1X1
011
000
1183  
1184 my %results = (
1185 response => $self->decode( $client->responseContent() ),
1186 code => $client->responseCode(),
1187 1 headers => +{ map { $_ => scalar $client->responseHeader($_) } $client->responseHeaders() },
1188 );
1189  
1190 1 return \%results;
1191 }
1192  
1193 # The _build_uri method takes two parameters:
1194 # $path is either an array of path components,
1195 # or a string which converts to a 1 element array
1196 # $query is either an array of query_form parameters
1197 # or a hash of same
1198 # A URI object is returned
1199 1 ▶sub _build_uri {
Subroutine _build_uri: called CC=5 SCAR=18.0
1200 1 my ($self, $path, $query) = @_;
1201  
1202 1 ▶ unless (_ARRAY($path)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&_ARRAY($path)) 1 0 1
1203 1 ▶ if (_STRING($path)) {
Branch: 1 branch
BranchTrueFalseTotal
if (&_STRING($path)) { } 1 0 1
1204 1 $path = [ $path ];
1205  
1206 } else {
1207 0 croak "Unable to parse URL recipe";
1208 }
1209 }
1210  
1211 1 my $uri = $self->{base_uri}->clone;
1212  
1213 1 @$path = (@{ $self->{base_path} }, @$path);
1214 # specify the type as a file-extension to the last path segment
1215 1 $path->[-1] .= ".$self->{format}";
1216 1 $uri->path_segments(@$path);
1217  
1218 1 ▶ if (_HASH($query)) {
Branch: 2 branches
BranchTrueFalseTotal
if (&_HASH($query)) { } 0 1 1
elsif (&_ARRAY($query)) { } 0 1 1
1219 0 $uri->query_form([ map { $_ => $query->{$_} } sort keys %$query ], '&');
1220  
1221 } elsif (_ARRAY($query)) {
1222 0 $uri->query_form($query, '&');
1223 }
1224  
1225 1 return $uri;
1226 }
1227  
1228 # The _rest method takes either a list of parameters or a single hashref
1229 # If a list, they are interpreted in order as method, path, query, body, headers
1230 # where method is the HTTP/REST method to use
1231 # path is the path component of the URL to call, appended to the REST API base
1232 # it can also be an array reference used to construct the path
1233 # query is the query component of the URL to call, it can be a hashref
1234 # body is the body of the HTTP request, for PUT/PATCH/POST methods
1235 # it can be a hashref which will be json encoded
1236 #
1237 # If the first parameter to this function is a hashref, the values correspond to
1238 # keys of those names: method, path, query, body, headers
1239 #
1240 # The method and path parameters are required
1241 #
1242 # A call to the REST::Client instance is built and performed, the result
1243 # of which is returned.
1244 1 ▶sub _rest {
Subroutine _rest: called CC=5 SCAR=19.2
1245 1 my $self = shift;
1246 1 my $params;
1247 1 ▶ if (Params::Util::_HASH($_[0])) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Params::Util::_HASH($_[0])) { } 0 1 1
1248 0 $params = shift;
1249  
1250 } else {
1251 1 $params = {};
1252 1 @$params{qw(method path query body headers)} = @_;
1253 }
1254  
1255 1 my $method = $params->{method};
1256 1 my $uri = $self->_build_uri($params->{path}, $params->{query});
1257  
1258 1 my @args = ($uri->as_string);
1259 1 ▶ if ($method =~ /^(?:PUT|PATCH|POST)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($method =~ /^(?:PUT|PATCH|POST)$/) 0 1 1
1260 0 ▶ if (ref $params->{body}) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $params->{'body'}) { } 0 0 0
1261 0 my $body = encode_json $params->{body};
1262 0 push @args, $body;
1263  
1264 } else {
1265 0 push @args, $params->{body};
1266 }
1267 }
1268  
1269 1 ▶ push @args, $params->{headers} if defined $params->{headers};
Branch: 1 branch
BranchTrueFalseTotal
if defined $params->{"headers"} 0 1 1
1270  
1271 1 return $self->{client}->$method(@args);
1272 }
1273  
1274 10 1;
1275  
1276 __END__
↑ Summary