DRI/Protocol/EPP/Extensions/VeriSign/JobsContact.pm

filter: Statementstmt 22.0% 13 / 59 Branchbran 0.0% 0 / 36 Conditioncond 0.0% 0 / 27 MC/DCmcdc 0.0% 0 / 17 Subroutinesub 40.0% 4 / 10 Podpod 0.0% 0 / 6 totaltotal 10.9% 17 / 155 CC 28 SCAR 55.2
CC
28
Cov
11%
add_job
420.0
info_parse
90.0
register_commands
2.0
CRAP 249.2
« DRI/Data/Contact/Nominet.pm ↑ Summary DRI/DRD.pm »
1 ## Domain Registry Interface, .JOBS contact extension
2 ##
3 ## Copyright (c) 2008,2013 Tonnerre Lombard <tonnerre.lombard@sygroup.ch>.
4 ## Copyright (c) 2016,2018 Patrick Mevzek <netdri@dotandco.com>.
5 ## All rights reserved.
6 ##
7 ## This file is part of Net::DRI
8 ##
9 ## Net::DRI is free software; you can redistribute it and/or modify
10 ## it under the terms of the GNU General Public License as published by
11 ## the Free Software Foundation; either version 2 of the License, or
12 ## (at your option) any later version.
13 ##
14 ## See the LICENSE file that comes with this distribution for more details.
15 ####################################################################################################
16  
17 package Net::DRI::Protocol::EPP::Extensions::VeriSign::JobsContact;
18  
19 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 ▶use feature 'state';
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 1 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 =pod
26  
27 =head1 NAME
28  
29 Net::DRI::Protocol::EPP::Extensions::VeriSign::JobsContact - .JOBS EPP contact extensions for Net::DRI
30  
31 =head1 DESCRIPTION
32  
33 Please see the README file for details.
34  
35 =head1 SUPPORT
36  
37 For now, support questions should be sent to:
38  
39 E<lt>development@sygroup.chE<gt>
40  
41 Please also see the SUPPORT file in the distribution.
42  
43 =head1 SEE ALSO
44  
45 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt> and
46 E<lt>http://oss.bdsprojects.net/projects/netdri/E<gt>
47  
48 =head1 AUTHOR
49  
50 Tonnerre Lombard E<lt>tonnerre.lombard@sygroup.chE<gt>
51  
52 =head1 COPYRIGHT
53  
54 Copyright (c) 2008,2013 Tonnerre Lombard <tonnerre.lombard@sygroup.ch>.
55 Copyright (c) 2016,2018 Patrick Mevzek <netdri@dotandco.com>.
56 All rights reserved.
57  
58 This program is free software; you can redistribute it and/or modify
59 it under the terms of the GNU General Public License as published by
60 the Free Software Foundation; either version 2 of the License, or
61 (at your option) any later version.
62  
63 See the LICENSE file that comes with this distribution for more details.
64  
65 =cut
66  
67 ####################################################################################################
68  
69 sub register_commands
70 {
71 0 ▶ my ($class,$version)=@_;
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
72 0 state $cmds = { 'contact' => { 'create' => [ \&create, undef ],
73 'update' => [ \&update, undef ],
74 'info' => [ undef, \&info_parse ],
75 }
76 };
77  
78 0 return $cmds;
79 }
80  
81 sub setup
82 {
83 0 ▶ my ($class,$po,$version)=@_;
Subroutine setup: not called CC=1 SCAR=6.9
Pod undocumented
84 0 state $rns = { 'jobsContact' => 'http://www.verisign.com/epp/jobsContact-1.0' };
85 0 $po->ns($rns);
86 0 return;
87 }
88  
89 ####################################################################################################
90  
91 ############ Transform commands
92  
93 sub add_job
94 {
95 0 ▶ my ($cmd, $epp, $contact, $rd) = @_;
Subroutine add_job: not called CC=20 SCAR=60.4
Pod undocumented
96 0 my $mes = $epp->message();
97 0 my $info;
98 my @jobdata;
99  
100 0 ▶ return unless Net::DRI::Util::isa_contact($contact, 'Net::DRI::Data::Contact::JOBS');
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::isa_contact($contact, "Net::DRI::Data::Contact::JOBS") 0 0 0
101 0 $info = $contact->jobinfo();
102 0 ▶ return unless (defined($info) && (ref($info) eq 'HASH') && keys(%$info));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $info and ref $info eq "HASH" and keys %$info 0 0 0
Condition0%0/6
defined $info and ref $info eq "HASH" and keys %$info
!ll&&!rl&&r
000
defined $info and ref $info eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/3
defined $info and ref $info eq "HASH" and keys %$info
defined $info ref $info eq "HASH" keys %$info
Truth table0%0/4
A and B and C
A= defined $infoB= ref $info eq "HASH"C= keys %$info
ABCresult
0XX0
10X0
1100
1111
103 push(@jobdata, ['jobsContact:title', $info->{title}])
104 0 ▶ if (defined($info->{title}) && length($info->{title}));
Branch: 1 branch
BranchTrueFalseTotal
if defined $info->{"title"} and length $info->{"title"} 0 0 0
Condition0%0/3
defined $info->{"title"} and length $info->{"title"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $info->{"title"} and length $info->{"title"}
defined $info->{"title"} length $info->{"title"}
Truth table0%0/3
A and B
A= defined $info->{"title"}B= length $info->{"title"}
ABresult
0X0
100
111
105 push(@jobdata, ['jobsContact:website', $info->{website}])
106 0 ▶ if (defined($info->{website}) && length($info->{website}));
Branch: 1 branch
BranchTrueFalseTotal
if defined $info->{"website"} and length $info->{"website"} 0 0 0
Condition0%0/3
defined $info->{"website"} and length $info->{"website"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $info->{"website"} and length $info->{"website"}
defined $info->{"website"} length $info->{"website"}
Truth table0%0/3
A and B
A= defined $info->{"website"}B= length $info->{"website"}
ABresult
0X0
100
111
107 push(@jobdata, ['jobsContact:industryType', $info->{industry}])
108 0 ▶ if (defined($info->{industry}) && length($info->{industry}));
Branch: 1 branch
BranchTrueFalseTotal
if defined $info->{"industry"} and length $info->{"industry"} 0 0 0
Condition0%0/3
defined $info->{"industry"} and length $info->{"industry"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $info->{"industry"} and length $info->{"industry"}
defined $info->{"industry"} length $info->{"industry"}
Truth table0%0/3
A and B
A= defined $info->{"industry"}B= length $info->{"industry"}
ABresult
0X0
100
111
109 push(@jobdata, ['jobsContact:isAdminContact',
110 (defined($info->{admin}) && $info->{admin} ? 'Yes' : 'No')])
111 0 ▶ if (defined($info->{admin}) && length($info->{admin}));
Branch: 2 branches
BranchTrueFalseTotal
if defined $info->{"admin"} and length $info->{"admin"} 0 0 0
defined $info->{'admin'} && $info->{'admin'} ? : 0 0 0
Condition0%0/6
defined $info->{"admin"} and length $info->{"admin"}
!ll&&!rl&&r
000
defined $info->{"admin"} and $info->{"admin"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $info->{"admin"} and length $info->{"admin"}
defined $info->{"admin"} length $info->{"admin"}
MC/DC0%0/2
defined $info->{"admin"} and $info->{"admin"}
defined $info->{"admin"} $info->{"admin"}
Truth table0%0/3
A and B
A= defined $info->{"admin"}B= length $info->{"admin"}
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= defined $info->{"admin"}B= $info->{"admin"}
ABresult
0X0
100
111
112 push(@jobdata, ['jobsContact:isAssociationMember',
113 (defined($info->{member}) && $info->{member} ? 'Yes' : 'No')])
114 0 ▶ if (defined($info->{member}) && length($info->{member}));
Branch: 2 branches
BranchTrueFalseTotal
if defined $info->{"member"} and length $info->{"member"} 0 0 0
defined $info->{'member'} && $info->{'member'} ? : 0 0 0
Condition0%0/6
defined $info->{"member"} and length $info->{"member"}
!ll&&!rl&&r
000
defined $info->{"member"} and $info->{"member"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $info->{"member"} and length $info->{"member"}
defined $info->{"member"} length $info->{"member"}
MC/DC0%0/2
defined $info->{"member"} and $info->{"member"}
defined $info->{"member"} $info->{"member"}
Truth table0%0/3
A and B
A= defined $info->{"member"}B= length $info->{"member"}
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= defined $info->{"member"}B= $info->{"member"}
ABresult
0X0
100
111
115  
116 0 ▶ return unless (@jobdata);
Branch: 1 branch
BranchTrueFalseTotal
unless @jobdata 0 0 0
117  
118 0 my $eid = $mes->command_extension_register('jobsContact', $cmd);
119 0 $mes->command_extension($eid, \@jobdata);
120 0 return;
121 }
122  
123 sub create
124 {
125 0 ▶ my (@args)=@_;
Subroutine create: not called CC=1 SCAR=6.9
Pod undocumented
126 0 return add_job('create', @args);
127 }
128  
129 sub update
130 {
131 0 ▶ my (@args)=@_;
Subroutine update: not called CC=1 SCAR=6.9
Pod undocumented
132 0 return add_job('update', @args);
133 }
134  
135 sub info_parse
136 {
137 0 ▶ my ($po,$otype,$oaction,$oname,$rinfo)=@_;
Subroutine info_parse: not called CC=9 SCAR=45.0
Pod undocumented
138 0 my $mes = $po->message();
139 0 my $infdata = $mes->get_extension('jobsContact', 'infData');
140 0 ▶ return unless (defined($infdata));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $infdata 0 0 0
141  
142 0 my $jobinfo = {};
143 0 my $c;
144 0 my $ns = $mes->ns('jobsContact');
145  
146 0 $c = $infdata->getChildrenByTagNameNS($ns, 'title');
147 0 ▶ $jobinfo->{title} = $c->shift()->getFirstChild()->getData() if ($c);
Branch: 1 branch
BranchTrueFalseTotal
if $c 0 0 0
148  
149 0 $c = $infdata->getChildrenByTagNameNS($ns, 'website');
150 0 ▶ $jobinfo->{website} = $c->shift()->getFirstChild()->getData() if ($c);
Branch: 1 branch
BranchTrueFalseTotal
if $c 0 0 0
151  
152 0 $c = $infdata->getChildrenByTagNameNS($ns, 'industryType');
153 0 ▶ $jobinfo->{industry} = $c->shift()->getFirstChild()->getData() if ($c);
Branch: 1 branch
BranchTrueFalseTotal
if $c 0 0 0
154  
155 0 $c = $infdata->getChildrenByTagNameNS($ns, 'isAdminContact');
156 0 ▶ $jobinfo->{admin} = (lc($c->shift()->getFirstChild()->getData()) eq 'yes')? 1 : 0 if ($c);
Branch: 2 branches
BranchTrueFalseTotal
if $c 0 0 0
lc $c->shift->getFirstChild->getData eq 'yes' ? : 0 0 0
157  
158 0 $c = $infdata->getChildrenByTagNameNS($ns, 'isAssociationMember');
159 0 ▶ $jobinfo->{member} = (lc($c->shift()->getFirstChild()->getData()) eq 'yes')? 1 : 0 if ($c);
Branch: 2 branches
BranchTrueFalseTotal
if $c 0 0 0
lc $c->shift->getFirstChild->getData eq 'yes' ? : 0 0 0
160  
161 0 my $contact = $rinfo->{$otype}->{$oname}->{self};
162 0 $contact->jobinfo($jobinfo);
163 0 return;
164 }
165  
166 ####################################################################################################
167 1 1;
« DRI/Data/Contact/Nominet.pm ↑ Summary DRI/DRD.pm »