| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | ## Domain Registry Interface, .JOBS contact extension | 
| 2 |  |  |  |  |  |  | ## | 
| 3 |  |  |  |  |  |  | ## Copyright (c) 2008,2013 Tonnerre Lombard . | 
| 4 |  |  |  |  |  |  | ##                    All rights reserved. | 
| 5 |  |  |  |  |  |  | ## | 
| 6 |  |  |  |  |  |  | ## This file is part of Net::DRI | 
| 7 |  |  |  |  |  |  | ## | 
| 8 |  |  |  |  |  |  | ## Net::DRI is free software; you can redistribute it and/or modify | 
| 9 |  |  |  |  |  |  | ## it under the terms of the GNU General Public License as published by | 
| 10 |  |  |  |  |  |  | ## the Free Software Foundation; either version 2 of the License, or | 
| 11 |  |  |  |  |  |  | ## (at your option) any later version. | 
| 12 |  |  |  |  |  |  | ## | 
| 13 |  |  |  |  |  |  | ## See the LICENSE file that comes with this distribution for more details. | 
| 14 |  |  |  |  |  |  | #################################################################################################### | 
| 15 |  |  |  |  |  |  |  | 
| 16 |  |  |  |  |  |  | package Net::DRI::Protocol::EPP::Extensions::VeriSign::JobsContact; | 
| 17 |  |  |  |  |  |  |  | 
| 18 | 1 |  |  | 1 |  | 907 | use strict; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 27 |  | 
| 19 | 1 |  |  | 1 |  | 3 | use warnings; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 20 |  | 
| 20 |  |  |  |  |  |  |  | 
| 21 | 1 |  |  | 1 |  | 3 | use Net::DRI::Util; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 657 |  | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | =pod | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  | =head1 NAME | 
| 26 |  |  |  |  |  |  |  | 
| 27 |  |  |  |  |  |  | Net::DRI::Protocol::EPP::Extensions::VeriSign::JobsContact - .JOBS EPP contact extensions for Net::DRI | 
| 28 |  |  |  |  |  |  |  | 
| 29 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 30 |  |  |  |  |  |  |  | 
| 31 |  |  |  |  |  |  | Please see the README file for details. | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | =head1 SUPPORT | 
| 34 |  |  |  |  |  |  |  | 
| 35 |  |  |  |  |  |  | For now, support questions should be sent to: | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  | Edevelopment@sygroup.chE | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  | Please also see the SUPPORT file in the distribution. | 
| 40 |  |  |  |  |  |  |  | 
| 41 |  |  |  |  |  |  | =head1 SEE ALSO | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | Ehttp://www.dotandco.com/services/software/Net-DRI/E and | 
| 44 |  |  |  |  |  |  | Ehttp://oss.bdsprojects.net/projects/netdri/E | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | =head1 AUTHOR | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | Tonnerre Lombard Etonnerre.lombard@sygroup.chE | 
| 49 |  |  |  |  |  |  |  | 
| 50 |  |  |  |  |  |  | =head1 COPYRIGHT | 
| 51 |  |  |  |  |  |  |  | 
| 52 |  |  |  |  |  |  | Copyright (c) 2008,2013 Tonnerre Lombard . | 
| 53 |  |  |  |  |  |  | All rights reserved. | 
| 54 |  |  |  |  |  |  |  | 
| 55 |  |  |  |  |  |  | This program is free software; you can redistribute it and/or modify | 
| 56 |  |  |  |  |  |  | it under the terms of the GNU General Public License as published by | 
| 57 |  |  |  |  |  |  | the Free Software Foundation; either version 2 of the License, or | 
| 58 |  |  |  |  |  |  | (at your option) any later version. | 
| 59 |  |  |  |  |  |  |  | 
| 60 |  |  |  |  |  |  | See the LICENSE file that comes with this distribution for more details. | 
| 61 |  |  |  |  |  |  |  | 
| 62 |  |  |  |  |  |  | =cut | 
| 63 |  |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  | #################################################################################################### | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  | sub register_commands | 
| 67 |  |  |  |  |  |  | { | 
| 68 | 0 |  |  | 0 | 0 |  | my ($class,$version)=@_; | 
| 69 | 0 |  |  |  |  |  | my %contacttmp=( | 
| 70 |  |  |  |  |  |  | create =>		[ \&create, undef ], | 
| 71 |  |  |  |  |  |  | update =>		[ \&update, undef ], | 
| 72 |  |  |  |  |  |  | info =>		[ undef, \&info_parse ] | 
| 73 |  |  |  |  |  |  | ); | 
| 74 |  |  |  |  |  |  |  | 
| 75 | 0 |  |  |  |  |  | return { 'contact' => \%contacttmp }; | 
| 76 |  |  |  |  |  |  | } | 
| 77 |  |  |  |  |  |  |  | 
| 78 |  |  |  |  |  |  | our @NS=('http://www.verisign.com/epp/jobsContact-1.0','http://www.verisign.com/epp/jobsContact-1.0 jobsContact-1.0.xsd'); | 
| 79 |  |  |  |  |  |  |  | 
| 80 |  |  |  |  |  |  | #################################################################################################### | 
| 81 |  |  |  |  |  |  |  | 
| 82 |  |  |  |  |  |  | ############ Transform commands | 
| 83 |  |  |  |  |  |  |  | 
| 84 |  |  |  |  |  |  | sub add_job | 
| 85 |  |  |  |  |  |  | { | 
| 86 | 0 |  |  | 0 | 0 |  | my ($cmd, $epp, $contact, $rd) = @_; | 
| 87 | 0 |  |  |  |  |  | my $mes = $epp->message(); | 
| 88 | 0 |  |  |  |  |  | my $info; | 
| 89 |  |  |  |  |  |  | my @jobdata; | 
| 90 |  |  |  |  |  |  |  | 
| 91 | 0 | 0 |  |  |  |  | return unless Net::DRI::Util::isa_contact($contact, 'Net::DRI::Data::Contact::JOBS'); | 
| 92 | 0 |  |  |  |  |  | $info = $contact->jobinfo(); | 
| 93 | 0 | 0 | 0 |  |  |  | return unless (defined($info) && (ref($info) eq 'HASH') && keys(%$info)); | 
|  |  |  | 0 |  |  |  |  | 
| 94 |  |  |  |  |  |  | push(@jobdata, ['jobsContact:title', $info->{title}]) | 
| 95 | 0 | 0 | 0 |  |  |  | if (defined($info->{title}) && length($info->{title})); | 
| 96 |  |  |  |  |  |  | push(@jobdata, ['jobsContact:website', $info->{website}]) | 
| 97 | 0 | 0 | 0 |  |  |  | if (defined($info->{website}) && length($info->{website})); | 
| 98 |  |  |  |  |  |  | push(@jobdata, ['jobsContact:industryType', $info->{industry}]) | 
| 99 | 0 | 0 | 0 |  |  |  | if (defined($info->{industry}) && length($info->{industry})); | 
| 100 |  |  |  |  |  |  | push(@jobdata, ['jobsContact:isAdminContact', | 
| 101 |  |  |  |  |  |  | (defined($info->{admin}) && $info->{admin} ? 'Yes' : 'No')]) | 
| 102 | 0 | 0 | 0 |  |  |  | if (defined($info->{admin}) && length($info->{admin})); | 
|  |  | 0 | 0 |  |  |  |  | 
| 103 |  |  |  |  |  |  | push(@jobdata, ['jobsContact:isAssociationMember', | 
| 104 |  |  |  |  |  |  | (defined($info->{member}) && $info->{member} ? 'Yes' : 'No')]) | 
| 105 | 0 | 0 | 0 |  |  |  | if (defined($info->{member}) && length($info->{member})); | 
|  |  | 0 | 0 |  |  |  |  | 
| 106 |  |  |  |  |  |  |  | 
| 107 | 0 | 0 |  |  |  |  | return unless (@jobdata); | 
| 108 |  |  |  |  |  |  |  | 
| 109 | 0 |  |  |  |  |  | my $eid = $mes->command_extension_register('jobsContact:' . $cmd,sprintf('xmlns:jobsContact="%s" xsi:schemaLocation="%s"',@NS)); | 
| 110 | 0 |  |  |  |  |  | $mes->command_extension($eid, \@jobdata); | 
| 111 | 0 |  |  |  |  |  | return; | 
| 112 |  |  |  |  |  |  | } | 
| 113 |  |  |  |  |  |  |  | 
| 114 |  |  |  |  |  |  | sub create | 
| 115 |  |  |  |  |  |  | { | 
| 116 | 0 |  |  | 0 | 0 |  | my (@args)=@_; | 
| 117 | 0 |  |  |  |  |  | return add_job('create', @args); | 
| 118 |  |  |  |  |  |  | } | 
| 119 |  |  |  |  |  |  |  | 
| 120 |  |  |  |  |  |  | sub update | 
| 121 |  |  |  |  |  |  | { | 
| 122 | 0 |  |  | 0 | 0 |  | my (@args)=@_; | 
| 123 | 0 |  |  |  |  |  | return add_job('update', @args); | 
| 124 |  |  |  |  |  |  | } | 
| 125 |  |  |  |  |  |  |  | 
| 126 |  |  |  |  |  |  | sub info_parse | 
| 127 |  |  |  |  |  |  | { | 
| 128 | 0 |  |  | 0 | 0 |  | my ($po,$otype,$oaction,$oname,$rinfo)=@_; | 
| 129 | 0 |  |  |  |  |  | my $mes = $po->message(); | 
| 130 | 0 |  |  |  |  |  | my $infdata = $mes->get_extension($NS[0],'infData'); | 
| 131 | 0 | 0 |  |  |  |  | return unless (defined($infdata)); | 
| 132 |  |  |  |  |  |  |  | 
| 133 | 0 |  |  |  |  |  | my $jobinfo = {}; | 
| 134 | 0 |  |  |  |  |  | my $c; | 
| 135 |  |  |  |  |  |  |  | 
| 136 | 0 |  |  |  |  |  | $c = $infdata->getChildrenByTagNameNS($NS[0], 'title'); | 
| 137 | 0 | 0 |  |  |  |  | $jobinfo->{title} = $c->shift()->getFirstChild()->getData() if ($c); | 
| 138 |  |  |  |  |  |  |  | 
| 139 | 0 |  |  |  |  |  | $c = $infdata->getChildrenByTagNameNS($NS[0], 'website'); | 
| 140 | 0 | 0 |  |  |  |  | $jobinfo->{website} = $c->shift()->getFirstChild()->getData() if ($c); | 
| 141 |  |  |  |  |  |  |  | 
| 142 | 0 |  |  |  |  |  | $c = $infdata->getChildrenByTagNameNS($NS[0], 'industryType'); | 
| 143 | 0 | 0 |  |  |  |  | $jobinfo->{industry} = $c->shift()->getFirstChild()->getData() if ($c); | 
| 144 |  |  |  |  |  |  |  | 
| 145 | 0 |  |  |  |  |  | $c = $infdata->getChildrenByTagNameNS($NS[0], 'isAdminContact'); | 
| 146 | 0 | 0 |  |  |  |  | $jobinfo->{admin} = (lc($c->shift()->getFirstChild()->getData()) eq 'yes')? 1 : 0 if ($c); | 
|  |  | 0 |  |  |  |  |  | 
| 147 |  |  |  |  |  |  |  | 
| 148 | 0 |  |  |  |  |  | $c = $infdata->getChildrenByTagNameNS($NS[0], 'isAssociationMember'); | 
| 149 | 0 | 0 |  |  |  |  | $jobinfo->{member} = (lc($c->shift()->getFirstChild()->getData()) eq 'yes')? 1 : 0 if ($c); | 
|  |  | 0 |  |  |  |  |  | 
| 150 |  |  |  |  |  |  |  | 
| 151 | 0 |  |  |  |  |  | my $contact = $rinfo->{$otype}->{$oname}->{self}; | 
| 152 | 0 |  |  |  |  |  | $contact->jobinfo($jobinfo); | 
| 153 | 0 |  |  |  |  |  | return; | 
| 154 |  |  |  |  |  |  | } | 
| 155 |  |  |  |  |  |  |  | 
| 156 |  |  |  |  |  |  | #################################################################################################### | 
| 157 |  |  |  |  |  |  | 1; |