Webservice/OVH/Email/Domain/Domain.pm

filter: Statementstmt 13.6% 26 / 190 Branchbran 0.0% 0 / 62 Conditioncond 0.0% 0 / 33 MC/DCmcdc 0.0% 0 / 22 Subroutinesub 23.5% 8 / 34 Podpod 68.0% 17 / 25 totaltotal 13.9% 51 / 366 CC 46 SCAR 31.6
CC
46
Cov
9%
redirections
72.0
redirection
42.0
account
42.0
CRAP 23.5
« Webservice/OVH/Cloud/Project/SSH.pm ↑ Summary Webservice/OVH/Cloud/Project/Instance/Group.pm »
1 package Webservice::OVH::Email::Domain::Domain;
2  
3 =encoding utf-8
4  
5 =head1 NAME
6  
7 Webservice::OVH::Email::Domain::Domain
8  
9 =head1 SYNOPSIS
10  
11 use Webservice::OVH;
12
13 my $ovh = Webservice::OVH->new_from_json("credentials.json");
14
15 my $email_domain = $ovh->email->domain->domain('testdomain.de');
16  
17 =head1 DESCRIPTION
18  
19 Provides access to api email-domain methods like mailinglists, accounts and redirections.
20  
21 =head1 METHODS
22  
23 =cut
24  
25 36 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 36 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 36 ▶use Carp qw{ carp croak };
Subroutine BEGIN: called CC=1 SCAR=0.0
28  
29 36 our $VERSION = 0.48;
30  
31 36 ▶use Webservice::OVH::Email::Domain::Domain::Redirection;
Subroutine BEGIN: called CC=1 SCAR=0.0
32 36 ▶use Webservice::OVH::Email::Domain::Domain::Account;
Subroutine BEGIN: called CC=1 SCAR=0.0
33 36 ▶use Webservice::OVH::Email::Domain::Domain::MailingList;
Subroutine BEGIN: called CC=1 SCAR=0.0
34 36 ▶use Webservice::OVH::Email::Domain::Domain::Task;
Subroutine BEGIN: called CC=1 SCAR=0.0
35 36 ▶use Webservice::OVH::Helper;
Subroutine BEGIN: called CC=1 SCAR=0.0
36  
37 =head2 _new
38  
39 Internal Method to create the domain object.
40 This method is not ment to be called external.
41  
42 =over
43  
44 =item * Parameter: $api_wrapper - ovh api wrapper object, $module - root object
45  
46 =item * Return: L<Webservice::OVH::Email::Domain>
47  
48 =item * Synopsis: Webservice::OVH::Email::Domain->_new($ovh_api_wrapper, $zone_name, $module);
49  
50 =back
51  
52 =cut
53  
54 0 ▶sub _new {
Subroutine _new: not called CC=5 SCAR=34.0
55  
56 0 my ( $class, %params ) = @_;
57  
58 0 ▶ die "Missing module" unless $params{module};
Branch: 1 branch
BranchTrueFalseTotal
unless $params{"module"} 0 0 0
59 0 ▶ die "Missing wrapper" unless $params{wrapper};
Branch: 1 branch
BranchTrueFalseTotal
unless $params{"wrapper"} 0 0 0
60 0 ▶ die "Missing id" unless $params{id};
Branch: 1 branch
BranchTrueFalseTotal
unless $params{"id"} 0 0 0
61  
62 0 my $module = $params{module};
63 0 my $api_wrapper = $params{wrapper};
64 0 my $domain = $params{id};
65  
66 0 ▶ croak "Missing domain name" unless $domain;
Branch: 1 branch
BranchTrueFalseTotal
unless $domain 0 0 0
67  
68 0 my $self = bless {
69 _module => $module,
70 _api_wrapper => $api_wrapper,
71 _name => $domain,
72 _service_infos => undef,
73 _properties => undef,
74 _redirections => {},
75 _accounts => {},
76 _mailing_lists => {},
77 }, $class;
78  
79 0 my $task = Webservice::OVH::Email::Domain::Domain::Task->_new( module => $module, wrapper => $api_wrapper, domain => $self );
80 0 $self->{_task} = $task;
81  
82 0 return $self;
83 }
84  
85 =head2 service_infos
86  
87 Retrieves additional infos about the email-domain.
88 Not part of the properties
89  
90 =over
91  
92 =item * Return: HASH
93  
94 =item * Synopsis: my $info = $email_domain->service_infos;
95  
96 =back
97  
98 =cut
99  
100 0 ▶sub service_infos {
Subroutine service_infos: not called CC=2 SCAR=17.9
Pod documented
101  
102 0 my ($self) = @_;
103  
104 0 my $api = $self->{_api_wrapper};
105 0 my $domain = $self->name;
106 0 my $response_service_info = $api->rawCall( method => 'get', path => "/email/domain/$domain/serviceInfos", noSignature => 0 );
107  
108 0 ▶ croak $response_service_info->error if $response_service_info->error;
Branch: 1 branch
BranchTrueFalseTotal
if $response_service_info->error 0 0 0
109  
110 0 $self->{_service_infos} = $response_service_info->content;
111  
112 0 return $self->{_service_infos};
113 }
114  
115 =head2 quota
116  
117 Retrieves info about quotas.
118 Not part of the properties
119  
120 =over
121  
122 =item * Return: HASH
123  
124 =item * Synopsis: my $info = $email_domain->quota;
125  
126 =back
127  
128 =cut
129  
130 0 ▶sub quota {
Subroutine quota: not called CC=2 SCAR=17.9
Pod documented
131  
132 0 my ($self) = @_;
133  
134 0 my $api = $self->{_api_wrapper};
135 0 my $domain = $self->name;
136 0 my $response = $api->rawCall( method => 'get', path => "/email/domain/$domain/quota", noSignature => 0 );
137  
138 0 ▶ croak $response->error if $response->error;
Branch: 1 branch
BranchTrueFalseTotal
if $response->error 0 0 0
139 0 return $response->content;
140 }
141  
142 =head2 name
143  
144 Name is the unique identifier.
145  
146 =over
147  
148 =item * Return: VALUE
149  
150 =item * Synopsis: my $name = $email_domain->name;
151  
152 =back
153  
154 =cut
155  
156 0 ▶sub name {
Subroutine name: not called CC=1 SCAR=6.9
Pod documented
157  
158 0 my ($self) = @_;
159  
160 0 return $self->{_name};
161 }
162  
163 =head2 properties
164  
165 Retrieves properties of the email-domain.
166 This method updates the intern property variable.
167  
168 =over
169  
170 =item * Return: HASH
171  
172 =item * Synopsis: my $properties = $email_domain->properties;
173  
174 =back
175  
176 =cut
177  
178 0 ▶sub properties {
Subroutine properties: not called CC=2 SCAR=17.9
Pod documented
179  
180 0 my ($self) = @_;
181  
182 0 my $api = $self->{_api_wrapper};
183 0 my $domain = $self->name;
184 0 my $response_properties = $api->rawCall( method => 'get', path => "/email/domain/$domain", noSignature => 0 );
185 0 ▶ croak $response_properties->error if $response_properties->error;
Branch: 1 branch
BranchTrueFalseTotal
if $response_properties->error 0 0 0
186  
187 0 $self->{_properties} = $response_properties->content;
188  
189 0 return $self->{_properties};
190 }
191  
192 =head2 allowed_account_size
193  
194 Exposed Property Value. Readonly.
195  
196 =over
197  
198 =item * Return: VALUE
199  
200 =item * Synopsis: my $allowed_account_size = $email_domain->allowed_account_size;
201  
202 =back
203  
204 =cut
205  
206 0 ▶sub allowed_account_size {
Subroutine allowed_account_size: not called CC=1 SCAR=6.9
Pod documented
207  
208 0 my ($self) = @_;
209  
210 0 return $self->{_properties}->{allowedAccountSize};
211 }
212  
213 =head2 creation_date
214  
215 Exposed Property Value. Readonly.
216  
217 =over
218  
219 =item * Return: DateTime
220  
221 =item * Synopsis: my $creation_date = $email_domain->creation_date;
222  
223 =back
224  
225 =cut
226  
227 0 ▶sub creation_date {
Subroutine creation_date: not called CC=1 SCAR=6.9
Pod documented
228  
229 0 my ($self) = @_;
230  
231 0 my $str_datetime = $self->{_properties}->{creationDate};
232 0 my $datetime = Webservice::OVH::Helper->parse_datetime($str_datetime);
233 0 return $datetime;
234 }
235  
236 =head2 filerz
237  
238 Exposed Property Value. Readonly.
239  
240 =over
241  
242 =item * Return: VALUE
243  
244 =item * Synopsis: my $filerz = $email_domain->filerz;
245  
246 =back
247  
248 =cut
249  
250 0 ▶sub filerz {
Subroutine filerz: not called CC=1 SCAR=6.9
Pod documented
251  
252 0 my ($self) = @_;
253  
254 0 return $self->{_properties}->{filerz};
255 }
256  
257 =head2 status
258  
259 Exposed Property Value. Readonly.
260  
261 =over
262  
263 =item * Return: VALUE
264  
265 =item * Synopsis: my $status = $email_domain->status;
266  
267 =back
268  
269 =cut
270  
271 0 ▶sub status {
Subroutine status: not called CC=1 SCAR=6.9
Pod documented
272  
273 0 my ($self) = @_;
274  
275 0 return $self->{_properties}->{status};
276 }
277  
278 0 ▶sub redirections_count {
Subroutine redirections_count: not called CC=2 SCAR=17.9
Pod undocumented
279  
280 0 my ($self) = @_;
281  
282 0 my $api = $self->{_api_wrapper};
283 0 my $domain_name = $self->name;
284 0 my $response = $api->rawCall( method => 'get', path => "/email/domain/$domain_name/redirection", noSignature => 0 );
285 0 ▶ croak $response->error if $response->error;
Branch: 1 branch
BranchTrueFalseTotal
if $response->error 0 0 0
286  
287 0 return scalar @{ $response->content };
288 }
289  
290 =head2 redirections
291  
292 Produces an array of all available redirections that are connected to the email-domain.
293  
294 =over
295  
296 =item * Return: L<ARRAY>
297  
298 =item * Synopsis: my $redirections = $email_domain->redirections();
299  
300 =back
301  
302 =cut
303  
304 0 ▶sub redirections {
Subroutine redirections: not called CC=8 SCAR=42.8
Pod documented
305  
306 0 my ( $self, %filter ) = @_;
307  
308 0 ▶ my $filter_from = ( exists $filter{from} && !$filter{from} ) ? "_empty_" : $filter{from};
Branch: 1 branch
BranchTrueFalseTotal
exists $filter{'from'} && !$filter{'from'} ? : 0 0 0
Condition0%0/3
exists $filter{"from"} and not $filter{"from"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $filter{"from"} and not $filter{"from"}
exists $filter{"from"} not $filter{"from"}
Truth table0%0/3
A and not(B)
A= exists $filter{"from"}B= not $filter{"from"}
ABresult
0X0
100
111
309 0 ▶ my $filter_to = ( exists $filter{to} && !$filter{to} ) ? "_empty_" : $filter{to};
Branch: 1 branch
BranchTrueFalseTotal
exists $filter{'to'} && !$filter{'to'} ? : 0 0 0
Condition0%0/3
exists $filter{"to"} and not $filter{"to"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $filter{"to"} and not $filter{"to"}
exists $filter{"to"} not $filter{"to"}
Truth table0%0/3
A and not(B)
A= exists $filter{"to"}B= not $filter{"to"}
ABresult
0X0
100
111
310 0 my $filter = Webservice::OVH::Helper->construct_filter( "from" => $filter_from, "to" => $filter_to );
311  
312 0 my $api = $self->{_api_wrapper};
313 0 my $domain_name = $self->name;
314 0 my $response = $api->rawCall( method => 'get', path => sprintf( "/email/domain/$domain_name/redirection%s", $filter ), noSignature => 0 );
315 0 ▶ croak $response->error if $response->error;
Branch: 1 branch
BranchTrueFalseTotal
if $response->error 0 0 0
316  
317 0 my $redirection_ids = $response->content;
318 0 my $redirections = [];
319  
320 0 foreach my $redirection_id (@$redirection_ids) {
321  
322 0 ▶ my $redirection = $self->{_redirections}{$redirection_id} = $self->{_redirections}{$redirection_id} || Webservice::OVH::Email::Domain::Domain::Redirection->_new_existing( wrapper => $api, domain => $self, id => $redirection_id, module => $self->{_module} );
Condition0%0/3
$self->{'_redirections'}{$redirection_id} || 'Webservice::OVH::Email::Domain::Domain::Redirection'->_new_existing('wrapper', $api, 'domain', $self, 'id', $redirection_id, 'module', $self->{'_module'})
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{'_redirections'}{$redirection_id} || 'Webservice::OVH::Email::Domain::Domain::Redirection'->_new_existing('wrapper', $api, 'domain', $self, 'id', $redirection_id, 'module', $self->{'_module'})
$self->{'_redirections'}{$redirection_id} 'Webservice::OVH::Email::Domain::Domain::Redirection'->_new_existing('wrapper', $api, 'domain', $self, 'id', $redirection_id, 'module', $self->{'_module'})
Truth table0%0/3
A || B
A= $self->{'_redirections'}{$redirection_id}B= 'Webservice::OVH::Email::Domain::Domain::Redirection'->_new_existing('wrapper', $api, 'domain', $self, 'id', $redirection_id, 'module', $self->{'_module'})
ABresult
1X1
011
000
323 0 push @$redirections, $redirection;
324 }
325  
326 0 return $redirections;
327 }
328  
329 0 ▶sub redirection_exists {
Subroutine redirection_exists: not called CC=3 SCAR=24.8
Pod undocumented
330  
331 0 my ( $self, $redirection_id ) = @_;
332  
333 0 ▶ croak "Missing redirection_id" unless $redirection_id;
Branch: 1 branch
BranchTrueFalseTotal
unless $redirection_id 0 0 0
334  
335 0 my $api = $self->{_api_wrapper};
336 0 my $domain_name = $self->name;
337  
338 0 my $response = $api->rawCall( method => 'get', path => "/email/domain/$domain_name/redirection/$redirection_id", noSignature => 0 );
339  
340 0 ▶ return $response->error ? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$response->error ? : 0 0 0
341 }
342  
343 =head2 redirection
344  
345 Returns a single redirection by id
346  
347 =over
348  
349 =item * Parameter: $redirection_id - id
350  
351 =item * Return: L<Webservice::OVH::Email::Domain::Domain::Redirection>
352  
353 =item * Synopsis: my $service = $email_domain->redirection(12345);
354  
355 =back
356  
357 =cut
358  
359 0 ▶sub redirection {
Subroutine redirection: not called CC=6 SCAR=37.4
Pod documented
360  
361 0 my ( $self, $redirection_id ) = @_;
362  
363 0 ▶ croak "Missing redirection_id" unless $redirection_id;
Branch: 1 branch
BranchTrueFalseTotal
unless $redirection_id 0 0 0
364  
365 0 ▶ if ( $self->redirection_exists($redirection_id) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->redirection_exists($redirection_id)) { } 0 0 0
366  
367 0 my $api = $self->{_api_wrapper};
368 0 ▶ my $from_array_redirection = $self->{_redirections}{$redirection_id} if $self->{_redirections}{$redirection_id} && $self->{_redirections}{$redirection_id}->is_valid;
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_redirections"}{$redirection_id} and $self->{"_redirections"}{$redirection_id}->is_valid 0 0 0
Condition0%0/3
$self->{"_redirections"}{$redirection_id} and $self->{"_redirections"}{$redirection_id}->is_valid
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{"_redirections"}{$redirection_id} and $self->{"_redirections"}{$redirection_id}->is_valid
$self->{"_redirections"}{$redirection_id} $self->{"_redirections"}{$redirection_id}->is_valid
Truth table0%0/3
A and B
A= $self->{"_redirections"}{$redirection_id}B= $self->{"_redirections"}{$redirection_id}->is_valid
ABresult
0X0
100
111
369 0 ▶ my $redirection = $self->{_redirections}{$redirection_id} = $from_array_redirection || Webservice::OVH::Email::Domain::Domain::Redirection->_new_existing( wrapper => $api, domain => $self, id => $redirection_id, module => $self->{_module} );
Condition0%0/3
$from_array_redirection || 'Webservice::OVH::Email::Domain::Domain::Redirection'->_new_existing('wrapper', $api, 'domain', $self, 'id', $redirection_id, 'module', $self->{'_module'})
l!l&&r!l&&!r
000
MC/DC0%0/2
$from_array_redirection || 'Webservice::OVH::Email::Domain::Domain::Redirection'->_new_existing('wrapper', $api, 'domain', $self, 'id', $redirection_id, 'module', $self->{'_module'})
$from_array_redirection 'Webservice::OVH::Email::Domain::Domain::Redirection'->_new_existing('wrapper', $api, 'domain', $self, 'id', $redirection_id, 'module', $self->{'_module'})
Truth table0%0/3
A || B
A= $from_array_redirectionB= 'Webservice::OVH::Email::Domain::Domain::Redirection'->_new_existing('wrapper', $api, 'domain', $self, 'id', $redirection_id, 'module', $self->{'_module'})
ABresult
1X1
011
000
370  
371 0 return $redirection;
372  
373 } else {
374  
375 0 return undef;
376 }
377 }
378  
379 =head2 new_redirection
380  
381 Creates a new redirection.
382  
383 =over
384  
385 =item * Parameter: %params - key => value from to local_copy
386  
387 =item * Return: L<Webservice::Email::Domain::Domain::Redirection>
388  
389 =item * Synopsis: my $redirection = $email_domain->new_redirection(from => 'test@test.de', to => 'test2@test.de', local_copy => 'false');
390  
391 =back
392  
393 =cut
394  
395 0 ▶sub new_redirection {
Subroutine new_redirection: not called CC=1 SCAR=6.9
Pod documented
396  
397 0 my ( $self, %params ) = @_;
398  
399 0 my $api = $self->{_api_wrapper};
400 0 my $redirection = Webservice::OVH::Email::Domain::Domain::Redirection->_new( wrapper => $api, domain => $self, module => $self->{_module}, %params );
401  
402 0 return $redirection;
403 }
404  
405 0 ▶sub accounts_count {
Subroutine accounts_count: not called CC=2 SCAR=17.9
Pod undocumented
406  
407 0 my ($self) = @_;
408  
409 0 my $api = $self->{_api_wrapper};
410 0 my $domain_name = $self->name;
411 0 my $response = $api->rawCall( method => 'get', path => "/email/domain/$domain_name/account", noSignature => 0 );
412 0 ▶ croak $response->error if $response->error;
Branch: 1 branch
BranchTrueFalseTotal
if $response->error 0 0 0
413  
414 0 return scalar @{ $response->content };
415 }
416  
417 =head2 accounts
418  
419 Produces an array of all available accounts that are connected to the email-domain.
420  
421 =over
422  
423 =item * Return: L<ARRAY>
424  
425 =item * Synopsis: my $accounts = $email_domain->accounts();
426  
427 =back
428  
429 =cut
430  
431 0 ▶sub accounts {
Subroutine accounts: not called CC=4 SCAR=30.0
Pod documented
432  
433 0 my ($self) = @_;
434  
435 0 my $api = $self->{_api_wrapper};
436 0 my $domain_name = $self->name;
437 0 my $response = $api->rawCall( method => 'get', path => "/email/domain/$domain_name/account", noSignature => 0 );
438 0 ▶ croak $response->error if $response->error;
Branch: 1 branch
BranchTrueFalseTotal
if $response->error 0 0 0
439  
440 0 my $account_names = $response->content;
441 0 my $accounts = [];
442  
443 0 foreach my $account_name (@$account_names) {
444 0 ▶ my $account = $self->{_accounts}{$account_name} = $self->{_accounts}{$account_name} || Webservice::OVH::Email::Domain::Domain::Account->_new_existing( wrapper => $api, domain => $self, id => $account_name, module => $self->{_module} );
Condition0%0/3
$self->{'_accounts'}{$account_name} || 'Webservice::OVH::Email::Domain::Domain::Account'->_new_existing('wrapper', $api, 'domain', $self, 'id', $account_name, 'module', $self->{'_module'})
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{'_accounts'}{$account_name} || 'Webservice::OVH::Email::Domain::Domain::Account'->_new_existing('wrapper', $api, 'domain', $self, 'id', $account_name, 'module', $self->{'_module'})
$self->{'_accounts'}{$account_name} 'Webservice::OVH::Email::Domain::Domain::Account'->_new_existing('wrapper', $api, 'domain', $self, 'id', $account_name, 'module', $self->{'_module'})
Truth table0%0/3
A || B
A= $self->{'_accounts'}{$account_name}B= 'Webservice::OVH::Email::Domain::Domain::Account'->_new_existing('wrapper', $api, 'domain', $self, 'id', $account_name, 'module', $self->{'_module'})
ABresult
1X1
011
000
445 0 push @$accounts, $account;
446 }
447  
448 0 return $accounts;
449 }
450  
451 0 ▶sub account_exists {
Subroutine account_exists: not called CC=3 SCAR=24.8
Pod undocumented
452  
453 0 my ( $self, $account_name ) = @_;
454  
455 0 ▶ croak "Missing account_name" unless $account_name;
Branch: 1 branch
BranchTrueFalseTotal
unless $account_name 0 0 0
456  
457 0 my $api = $self->{_api_wrapper};
458 0 my $domain_name = $self->name;
459  
460 0 my $response = $api->rawCall( method => 'get', path => "/email/domain/$domain_name/account/$account_name", noSignature => 0 );
461  
462 0 ▶ return $response->error ? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$response->error ? : 0 0 0
463 }
464  
465 =head2 account
466  
467 Returns a single account by name
468  
469 =over
470  
471 =item * Parameter: $account_name - name
472  
473 =item * Return: L<Webservice::OVH::Email::Domain::Domain::Account>
474  
475 =item * Synopsis: my $account = $email_domain->account('testaccount');
476  
477 =back
478  
479 =cut
480  
481 0 ▶sub account {
Subroutine account: not called CC=6 SCAR=37.4
Pod documented
482  
483 0 my ( $self, $account_name ) = @_;
484  
485 0 ▶ croak "Missing account_name" unless $account_name;
Branch: 1 branch
BranchTrueFalseTotal
unless $account_name 0 0 0
486  
487 0 $account_name = lc $account_name;
488  
489 0 ▶ if ( $self->account_exists($account_name) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->account_exists($account_name)) { } 0 0 0
490  
491 0 my $api = $self->{_api_wrapper};
492 0 ▶ my $from_array_account = $self->{_accounts}{$account_name} if $self->{_accounts}{$account_name} && $self->{_accounts}{$account_name}->is_valid;
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_accounts"}{$account_name} and $self->{"_accounts"}{$account_name}->is_valid 0 0 0
Condition0%0/3
$self->{"_accounts"}{$account_name} and $self->{"_accounts"}{$account_name}->is_valid
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{"_accounts"}{$account_name} and $self->{"_accounts"}{$account_name}->is_valid
$self->{"_accounts"}{$account_name} $self->{"_accounts"}{$account_name}->is_valid
Truth table0%0/3
A and B
A= $self->{"_accounts"}{$account_name}B= $self->{"_accounts"}{$account_name}->is_valid
ABresult
0X0
100
111
493 0 ▶ my $account = $self->{_accounts}{$account_name} = $from_array_account || Webservice::OVH::Email::Domain::Domain::Account->_new_existing( wrapper => $api, domain => $self, id => $account_name, module => $self->{_module} );
Condition0%0/3
$from_array_account || 'Webservice::OVH::Email::Domain::Domain::Account'->_new_existing('wrapper', $api, 'domain', $self, 'id', $account_name, 'module', $self->{'_module'})
l!l&&r!l&&!r
000
MC/DC0%0/2
$from_array_account || 'Webservice::OVH::Email::Domain::Domain::Account'->_new_existing('wrapper', $api, 'domain', $self, 'id', $account_name, 'module', $self->{'_module'})
$from_array_account 'Webservice::OVH::Email::Domain::Domain::Account'->_new_existing('wrapper', $api, 'domain', $self, 'id', $account_name, 'module', $self->{'_module'})
Truth table0%0/3
A || B
A= $from_array_accountB= 'Webservice::OVH::Email::Domain::Domain::Account'->_new_existing('wrapper', $api, 'domain', $self, 'id', $account_name, 'module', $self->{'_module'})
ABresult
1X1
011
000
494  
495 0 return $account;
496  
497 } else {
498  
499 0 return undef;
500 }
501 }
502  
503 =head2 new_account
504  
505 Creates a new account.
506  
507 =over
508  
509 =item * Parameter: %params - key => value account_name password description size
510  
511 =item * Return: L<Webservice::Email::Domain::Domain::Account>
512  
513 =item * Synopsis: my $account = $email_domain->new_account(account_name => 'testaccount', password => $password, description => 'a test account', size => 5000000 );
514  
515 =back
516  
517 =cut
518  
519 0 ▶sub new_account {
Subroutine new_account: not called CC=1 SCAR=6.9
Pod documented
520  
521 0 my ( $self, %params ) = @_;
522  
523 0 my $api = $self->{_api_wrapper};
524 0 my ( $account, $task ) = Webservice::OVH::Email::Domain::Domain::Account->_new( wrapper => $api, domain => $self, module => $self->{_module}, %params );
525  
526 0 return ( $account, $task );
527 }
528  
529 0 ▶sub mailing_lists_count {
Subroutine mailing_lists_count: not called CC=2 SCAR=17.9
Pod undocumented
530  
531 0 my ($self) = @_;
532  
533 0 my $api = $self->{_api_wrapper};
534 0 my $domain_name = $self->name;
535 0 my $response = $api->rawCall( method => 'get', path => "/email/domain/$domain_name/mailingList", noSignature => 0 );
536 0 ▶ croak $response->error if $response->error;
Branch: 1 branch
BranchTrueFalseTotal
if $response->error 0 0 0
537  
538 0 return scalar @{ $response->content };
539 }
540  
541 0 ▶sub mailing_lists_names {
Subroutine mailing_lists_names: not called CC=2 SCAR=17.9
Pod undocumented
542  
543 0 my ($self) = @_;
544  
545 0 my $api = $self->{_api_wrapper};
546 0 my $domain_name = $self->name;
547 0 my $response = $api->rawCall( method => 'get', path => "/email/domain/$domain_name/mailingList", noSignature => 0 );
548 0 ▶ croak $response->error if $response->error;
Branch: 1 branch
BranchTrueFalseTotal
if $response->error 0 0 0
549  
550 0 return $response->content;
551 }
552  
553 =head2 mailing_lists
554  
555 Produces an array of all available mailing_lists that are connected to the email-domain.
556  
557 =over
558  
559 =item * Return: L<ARRAY>
560  
561 =item * Synopsis: my $mailing_lists = $email_domain->mailing_lists();
562  
563 =back
564  
565 =cut
566  
567 0 ▶sub mailing_lists {
Subroutine mailing_lists: not called CC=4 SCAR=30.0
Pod documented
568  
569 0 my ($self) = @_;
570  
571 0 my $api = $self->{_api_wrapper};
572 0 my $domain_name = $self->name;
573 0 my $response = $api->rawCall( method => 'get', path => "/email/domain/$domain_name/mailingList", noSignature => 0 );
574 0 ▶ croak $response->error if $response->error;
Branch: 1 branch
BranchTrueFalseTotal
if $response->error 0 0 0
575  
576 0 my $mailing_list_names = $response->content;
577 0 my $mailing_lists = [];
578  
579 0 foreach my $mailing_list_name (@$mailing_list_names) {
580  
581 0 ▶ my $mailing_list = $self->{_mailing_lists}{$mailing_list_name} = $self->{_mailing_lists}{$mailing_list_name} || Webservice::OVH::Email::Domain::Domain::MailingList->_new_existing( wrapper => $api, domain => $self, id => $mailing_list_name, module => $self->{_module} );
Condition0%0/3
$self->{'_mailing_lists'}{$mailing_list_name} || 'Webservice::OVH::Email::Domain::Domain::MailingList'->_new_existing('wrapper', $api, 'domain', $self, 'id', $mailing_list_name, 'module', $self->{'_module'})
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{'_mailing_lists'}{$mailing_list_name} || 'Webservice::OVH::Email::Domain::Domain::MailingList'->_new_existing('wrapper', $api, 'domain', $self, 'id', $mailing_list_name, 'module', $self->{'_module'})
$self->{'_mailing_lists'}{$mailing_list_name} 'Webservice::OVH::Email::Domain::Domain::MailingList'->_new_existing('wrapper', $api, 'domain', $self, 'id', $mailing_list_name, 'module', $self->{'_module'})
Truth table0%0/3
A || B
A= $self->{'_mailing_lists'}{$mailing_list_name}B= 'Webservice::OVH::Email::Domain::Domain::MailingList'->_new_existing('wrapper', $api, 'domain', $self, 'id', $mailing_list_name, 'module', $self->{'_module'})
ABresult
1X1
011
000
582 0 push @$mailing_lists, $mailing_list;
583 }
584  
585 0 return $mailing_lists;
586 }
587  
588 0 ▶sub mailinglist_exists {
Subroutine mailinglist_exists: not called CC=3 SCAR=24.8
Pod undocumented
589  
590 0 my ( $self, $mailinglist_name ) = @_;
591  
592 0 ▶ croak "Missing mailinglist_name" unless $mailinglist_name;
Branch: 1 branch
BranchTrueFalseTotal
unless $mailinglist_name 0 0 0
593  
594 0 my $api = $self->{_api_wrapper};
595 0 my $domain_name = $self->name;
596  
597 0 my $response = $api->rawCall( method => 'get', path => "/email/domain/$domain_name/mailingList/$mailinglist_name", noSignature => 0 );
598  
599 0 ▶ return $response->error ? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$response->error ? : 0 0 0
600 }
601  
602 =head2 mailing_list
603  
604 Returns a single account by name
605  
606 =over
607  
608 =item * Parameter: $mailing_list_name - name
609  
610 =item * Return: L<Webservice::OVH::Email::Domain::Domain::MailingList>
611  
612 =item * Synopsis: my $mailing_list = $email_domain->mailing_list('subscriber_list');
613  
614 =back
615  
616 =cut
617  
618 0 ▶sub mailing_list {
Subroutine mailing_list: not called CC=6 SCAR=37.4
Pod documented
619  
620 0 my ( $self, $mailing_list_name ) = @_;
621  
622 0 ▶ croak "Missing mailing_list_name" unless $mailing_list_name;
Branch: 1 branch
BranchTrueFalseTotal
unless $mailing_list_name 0 0 0
623  
624 0 ▶ if ( $self->mailinglist_exists($mailing_list_name) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->mailinglist_exists($mailing_list_name)) { } 0 0 0
625  
626 0 my $api = $self->{_api_wrapper};
627 0 ▶ my $from_array_mailing_list = $self->{_mailing_lists}{$mailing_list_name} if $self->{_mailing_lists}{$mailing_list_name} && $self->{_mailing_lists}{$mailing_list_name}->is_valid;
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_mailing_lists"}{$mailing_list_name} and $self->{"_mailing_lists"}{$mailing_list_name}->is_valid 0 0 0
Condition0%0/3
$self->{"_mailing_lists"}{$mailing_list_name} and $self->{"_mailing_lists"}{$mailing_list_name}->is_valid
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{"_mailing_lists"}{$mailing_list_name} and $self->{"_mailing_lists"}{$mailing_list_name}->is_valid
$self->{"_mailing_lists"}{$mailing_list_name} $self->{"_mailing_lists"}{$mailing_list_name}->is_valid
Truth table0%0/3
A and B
A= $self->{"_mailing_lists"}{$mailing_list_name}B= $self->{"_mailing_lists"}{$mailing_list_name}->is_valid
ABresult
0X0
100
111
628 0 ▶ my $mailing_list = $self->{_mailing_lists}{$mailing_list_name} = $from_array_mailing_list || Webservice::OVH::Email::Domain::Domain::MailingList->_new_existing( wrapper => $api, domain => $self, id => $mailing_list_name, module => $self->{_module} );
Condition0%0/3
$from_array_mailing_list || 'Webservice::OVH::Email::Domain::Domain::MailingList'->_new_existing('wrapper', $api, 'domain', $self, 'id', $mailing_list_name, 'module', $self->{'_module'})
l!l&&r!l&&!r
000
MC/DC0%0/2
$from_array_mailing_list || 'Webservice::OVH::Email::Domain::Domain::MailingList'->_new_existing('wrapper', $api, 'domain', $self, 'id', $mailing_list_name, 'module', $self->{'_module'})
$from_array_mailing_list 'Webservice::OVH::Email::Domain::Domain::MailingList'->_new_existing('wrapper', $api, 'domain', $self, 'id', $mailing_list_name, 'module', $self->{'_module'})
Truth table0%0/3
A || B
A= $from_array_mailing_listB= 'Webservice::OVH::Email::Domain::Domain::MailingList'->_new_existing('wrapper', $api, 'domain', $self, 'id', $mailing_list_name, 'module', $self->{'_module'})
ABresult
1X1
011
000
629  
630 0 return $mailing_list;
631  
632 } else {
633  
634 0 return undef;
635 }
636 }
637  
638 =head2 new_mailing_list
639  
640 Creates a new mailing list.
641  
642 =over
643  
644 =item * Parameter: %params - key => value language name options owner_email reply_to
645  
646 =item * Return: L<Webservice::Email::Domain::Domain::MailingList>
647  
648 =item * Synopsis: my $mailing_list = $email_domain->new_mailing_list(language 'DE', name => 'infos', options => {}, owner_email => 'owner@test.de', reply_to => 'test@test.de' );
649  
650 =back
651  
652 =cut
653  
654 0 ▶sub new_mailing_list {
Subroutine new_mailing_list: not called CC=1 SCAR=6.9
Pod documented
655  
656 0 my ( $self, %params ) = @_;
657  
658 0 my $api = $self->{_api_wrapper};
659 0 my ( $mailing_list, $task ) = Webservice::OVH::Email::Domain::Domain::MailingList->_new( wrapper => $api, domain => $self, module => $self->{_module}, %params );
660  
661 0 return ( $mailing_list, $task );
662 }
663  
664 0 ▶sub task {
Subroutine task: not called CC=1 SCAR=6.9
Pod undocumented
665  
666 0 my ($self) = @_;
667  
668 0 return $self->{_task};
669 }
670  
671 36 1;
« Webservice/OVH/Cloud/Project/SSH.pm ↑ Summary Webservice/OVH/Cloud/Project/Instance/Group.pm »