DistributionList/Role/Reader.pm

filter: Statementstmt 37.8% 14 / 37 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 45.4% 5 / 11 Podpod 0.0% 0 / 2 totaltotal 27.1% 19 / 70 SCAR 37.2
CC
9
Cov
26%
_check_for_errors
20.0
retrieve
20.0
_list_dlitems
6.0
CRAP 41.3
« Folder/Item.pm ↑ Summary Client.pm »
1 package EWS::DistributionList::Role::Reader;
2 BEGIN {
3 1 ▶ $EWS::DistributionList::Role::Reader::VERSION = '1.143070';
Subroutine BEGIN: called CC=1 SCAR=0.0
4 }
5 1 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use EWS::DistributionList::ResultSet;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 sub _list_messages {
11 0 ▶ my ( $self, $kind, $response ) = @_;
Subroutine _list_messages: not called CC=1 SCAR=6.9
12 0 return @{ $response->{"${kind}Result"}->{ResponseMessages}->{cho_CreateItemResponseMessage} };
13 }
14  
15 sub _check_for_errors {
16 0 ▶ my ( $self, $kind, $response ) = @_;
Subroutine _check_for_errors: not called CC=4 SCAR=30.0
17  
18 0 foreach my $msg ( $self->_list_messages( $kind, $response ) ) {
19 0 ▶ my $code = $msg->{"${kind}ResponseMessage"}->{ResponseCode} || '';
Condition0%0/2
$$msg{"${kind}ResponseMessage"}{'ResponseCode'} || ''
l!l
00
MC/DC0%0/1
$$msg{"${kind}ResponseMessage"}{'ResponseCode'} || ''
$$msg{"${kind}ResponseMessage"}{'ResponseCode'}
Truth table0%0/2
A
A= $$msg{"${kind}ResponseMessage"}{'ResponseCode'}
Aresult
11
00
20 0 ▶ croak "Fault returned from Exchange Server: $code\n"
Branch: 1 branch
BranchTrueFalseTotal
if $code ne "NoError" 0 0 0
21 if $code ne 'NoError';
22 }
23 0 return;
24 }
25  
26 sub _list_dlitems {
27 0 ▶ my ( $self, $kind, $response ) = @_;
Subroutine _list_dlitems: not called CC=2 SCAR=17.9
28  
29 0 ▶ return map { @{ $_->{DLExpansion}->{Mailbox} || [] } }
Branch: 1 branch
BranchTrueFalseTotal
$_->{"DLExpansion"}{"Mailbox"} or [] 0 0 0
30 0 map { $_->{"${kind}ResponseMessage"} } $self->_list_messages( $kind, $response );
31 }
32  
33 sub _get_dls {
34 0 ▶ my ( $self, $opts ) = @_;
Subroutine _get_dls: not called CC=2 SCAR=17.9
35  
36 return $self->client->ExpandDL->(
37 ( exists $opts->{impersonate}
38 ? ( Impersonation => { ConnectingSID => { PrimarySmtpAddress => $opts->{impersonate}, } }, )
39 : ()
40 ),
41 RequestVersion => { Version => $self->client->server_version, },
42 Mailbox => { EmailAddress => $opts->{distribution_email}, },
43 0 ▶ );
Branch: 1 branch
BranchTrueFalseTotal
exists $opts->{'impersonate'} ? : 0 0 0
44 }
45  
46 # find primarysmtp if passed an account id.
47 # then find dls in the account.
48 sub retrieve {
49 0 ▶ my ( $self, $opts ) = @_;
Subroutine retrieve: not called CC=4 SCAR=30.0
Pod undocumented
50  
51 0 my $get_response = $self->_get_dls($opts);
52  
53 0 ▶ if ( exists $get_response->{'ResponseCode'}
Branch: 1 branch
BranchTrueFalseTotal
if (exists $get_response->{"ResponseCode"} and defined $get_response->{"ResponseCode"} and $get_response->{"ResponseCode"} eq "ErrorNonPrimarySmtpAddress") 0 0 0
Condition0%0/6
exists $get_response->{"ResponseCode"} and defined $get_response->{"ResponseCode"} and $get_response->{"ResponseCode"} eq "ErrorNonPrimarySmtpAddress"
!ll&&!rl&&r
000
exists $get_response->{"ResponseCode"} and defined $get_response->{"ResponseCode"}
!ll&&!rl&&r
000
MC/DC0%0/3
exists $get_response->{"ResponseCode"} and defined $get_response->{"ResponseCode"} and $get_response->{"ResponseCode"} eq "ErrorNonPrimarySmtpAddress"
exists $get_response->{"ResponseCode"} defined $get_response->{"ResponseCode"} $get_response->{"ResponseCode"} eq "ErrorNonPrimarySmtpAddress"
Truth table0%0/4
A and B and C
A= exists $get_response->{"ResponseCode"}B= defined $get_response->{"ResponseCode"}C= $get_response->{"ResponseCode"} eq "ErrorNonPrimarySmtpAddress"
ABCresult
0XX0
10X0
1100
1111
54 and defined $get_response->{'ResponseCode'}
55 and $get_response->{'ResponseCode'} eq 'ErrorNonPrimarySmtpAddress' )
56 {
57  
58 0 $self->retrieve( { %{$opts}, distribution_email => $get_response->{DLExpansion}->{Mailbox} } );
59 }
60  
61 0 $self->_check_for_errors( 'ExpandDL', $get_response );
62  
63 0 return EWS::DistributionList::ResultSet->new(
64 { mailboxes => [ $self->_list_dlitems( 'ExpandDL', $get_response ) ] } );
65 }
66  
67 sub expand {
68 0 ▶ return shift->retrieve( { distribution_email => shift } );
Subroutine expand: not called CC=1 SCAR=6.9
Pod undocumented
69 }
70  
71 1 ▶no Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
72 1 1;
« Folder/Item.pm ↑ Summary Client.pm »