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

filter: Statementstmt 22.8% 13 / 57 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 11.1% 17 / 153 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-2019 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-2019 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 0 ▶{
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
71 0 my ($class,$version)=@_;
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 0 ▶{
Subroutine setup: not called CC=1 SCAR=6.9
Pod undocumented
83 0 my ($class,$po,$version)=@_;
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 0 ▶{
Subroutine add_job: not called CC=20 SCAR=60.4
Pod undocumented
95 0 my ($cmd, $epp, $contact, $rd) = @_;
96 0 my $info;
97 my @jobdata;
98  
99 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
100 0 $info = $contact->jobinfo();
101 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
102 push(@jobdata, ['jobsContact:title', $info->{title}])
103 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
104 push(@jobdata, ['jobsContact:website', $info->{website}])
105 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
106 push(@jobdata, ['jobsContact:industryType', $info->{industry}])
107 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
108 push(@jobdata, ['jobsContact:isAdminContact',
109 (defined($info->{admin}) && $info->{admin} ? 'Yes' : 'No')])
110 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
111 push(@jobdata, ['jobsContact:isAssociationMember',
112 (defined($info->{member}) && $info->{member} ? 'Yes' : 'No')])
113 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
114  
115 0 ▶ return unless (@jobdata);
Branch: 1 branch
BranchTrueFalseTotal
unless @jobdata 0 0 0
116  
117 0 $epp->message()->command_extension('jobsContact', [$cmd, @jobdata]);
118 0 return;
119 }
120  
121 sub create
122 0 ▶{
Subroutine create: not called CC=1 SCAR=6.9
Pod undocumented
123 0 my (@args)=@_;
124 0 return add_job('create', @args);
125 }
126  
127 sub update
128 0 ▶{
Subroutine update: not called CC=1 SCAR=6.9
Pod undocumented
129 0 my (@args)=@_;
130 0 return add_job('update', @args);
131 }
132  
133 sub info_parse
134 0 ▶{
Subroutine info_parse: not called CC=9 SCAR=45.0
Pod undocumented
135 0 my ($po,$otype,$oaction,$oname,$rinfo)=@_;
136 0 my $mes = $po->message();
137 0 my $infdata = $mes->get_extension('jobsContact', 'infData');
138 0 ▶ return unless (defined($infdata));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $infdata 0 0 0
139  
140 0 my $jobinfo = {};
141 0 my $c;
142 0 my $ns = $mes->ns('jobsContact');
143  
144 0 $c = $infdata->getChildrenByTagNameNS($ns, 'title');
145 0 ▶ $jobinfo->{title} = $c->shift()->getFirstChild()->getData() if ($c);
Branch: 1 branch
BranchTrueFalseTotal
if $c 0 0 0
146  
147 0 $c = $infdata->getChildrenByTagNameNS($ns, 'website');
148 0 ▶ $jobinfo->{website} = $c->shift()->getFirstChild()->getData() if ($c);
Branch: 1 branch
BranchTrueFalseTotal
if $c 0 0 0
149  
150 0 $c = $infdata->getChildrenByTagNameNS($ns, 'industryType');
151 0 ▶ $jobinfo->{industry} = $c->shift()->getFirstChild()->getData() if ($c);
Branch: 1 branch
BranchTrueFalseTotal
if $c 0 0 0
152  
153 0 $c = $infdata->getChildrenByTagNameNS($ns, 'isAdminContact');
154 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
155  
156 0 $c = $infdata->getChildrenByTagNameNS($ns, 'isAssociationMember');
157 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
158  
159 0 my $contact = $rinfo->{$otype}->{$oname}->{self};
160 0 $contact->jobinfo($jobinfo);
161 0 return;
162 }
163  
164 ####################################################################################################
165 1 1;
« DRI/Data/Contact/Nominet.pm ↑ Summary DRI/DRD.pm »