DRI/Protocol/EPP/Extensions/Afilias/Trademark.pm

filter: Statementstmt 23.2% 10 / 43 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 50.0% 3 / 6 Podpod 0.0% 0 / 3 totaltotal 17.1% 13 / 76 CC 14 SCAR 41.9
CC
14
Cov
16%
create
110.0
info_parse
30.0
register_commands
2.0
CRAP 66.1
« DRI/DRD/RESTENA.pm ↑ Summary DRI/Protocol/EPP/Extensions/FCCN/Domain.pm »
1 ## Domain Registry Interface, Afilias Trademark extension (for .INFO .MOBI .IN)
2 ##
3 ## Copyright (c) 2010,2013,2016 Patrick Mevzek <netdri@dotandco.com>. All rights reserved.
4 ##
5 ## This file is part of Net::DRI
6 ##
7 ## Net::DRI is free software; you can redistribute it and/or modify
8 ## it under the terms of the GNU General Public License as published by
9 ## the Free Software Foundation; either version 2 of the License, or
10 ## (at your option) any later version.
11 ##
12 ## See the LICENSE file that comes with this distribution for more details.
13 ####################################################################################################
14  
15 package Net::DRI::Protocol::EPP::Extensions::Afilias::Trademark;
16  
17 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 1 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 ####################################################################################################
23  
24 sub register_commands
25 {
26 0 ▶ my ($class,$version)=@_;
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
27 0 my %tmp=(
28 create => [ \&create, undef ],
29 ## update
30 info => [ undef, \&info_parse ]
31 );
32  
33 0 return { 'domain' => \%tmp };
34 }
35  
36 ## Namespace should be set in calling superclass, as it differs in each TLD !
37 ##
38 ## INFO requires: name, country, number, date
39 ## MOBI requires: name, country, number, regDate, appDate
40 ## IN requires: name, country, number, date, ownerCountry
41  
42 ####################################################################################################
43  
44 sub create
45 {
46 0 ▶ my ($epp,$domain,$rd)=@_;
Subroutine create: not called CC=10 SCAR=47.0
Pod undocumented
47  
48 0 ▶ return unless Net::DRI::Util::has_key($rd,'trademark');
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::has_key($rd, "trademark") 0 0 0
49 0 my $rt=$rd->{trademark};
50  
51 0 my @t;
52 0 foreach my $k (qw/name country number/)
53 {
54 0 ▶ next unless exists $rt->{$k} && length $rt->{$k};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $rt->{$k} and length $rt->{$k} 0 0 0
Condition0%0/3
exists $rt->{$k} and length $rt->{$k}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $rt->{$k} and length $rt->{$k}
exists $rt->{$k} length $rt->{$k}
Truth table0%0/3
A and B
A= exists $rt->{$k}B= length $rt->{$k}
ABresult
0X0
100
111
55 0 push @t,['trademark:'.$k,$rt->{$k}];
56 }
57 0 foreach my $k (qw/date regDate appDate/)
58 {
59 0 ▶ next unless exists $rt->{$k};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $rt->{$k} 0 0 0
60 0 Net::DRI::Util::check_isa($rt->{$k},'DateTime');
61 0 push @t,['trademark:'.$k,$rt->{$k}->set_time_zone('UTC')->ymd()];
62 }
63 0 foreach my $k (qw/ownerCountry/)
64 {
65 0 ▶ next unless exists $rt->{$k} && length $rt->{$k};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $rt->{$k} and length $rt->{$k} 0 0 0
Condition0%0/3
exists $rt->{$k} and length $rt->{$k}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $rt->{$k} and length $rt->{$k}
exists $rt->{$k} length $rt->{$k}
Truth table0%0/3
A and B
A= exists $rt->{$k}B= length $rt->{$k}
ABresult
0X0
100
111
66 0 push @t,['trademark:'.$k,$rt->{$k}];
67 }
68  
69 0 my $mes=$epp->message();
70 0 my $eid=$mes->command_extension_register('trademark', 'create');
71 0 $mes->command_extension($eid,\@t);
72 0 return;
73 }
74  
75 sub info_parse
76 {
77 0 ▶ my ($po,$otype,$oaction,$oname,$rinfo)=@_;
Subroutine info_parse: not called CC=5 SCAR=34.0
Pod undocumented
78 0 my $mes=$po->message();
79 0 my $infdata=$mes->get_extension('trademark','infData');
80 0 ▶ return unless defined $infdata;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $infdata 0 0 0
81  
82 0 my %t;
83 0 foreach my $el (Net::DRI::Util::xml_list_children($infdata))
84 {
85 0 my ($n,$c)=@$el;
86 0 ▶ if ($n=~m/^(?:name|country|number|ownerCountry)$/)
Branch: 2 branches
BranchTrueFalseTotal
if ($n =~ /^(?:name|country|number|ownerCountry)$/) { } 0 0 0
elsif ($n =~ /^(?:date|appDate|regDate)$/) { } 0 0 0
87 {
88 0 $t{$n}=$c->textContent();
89 } elsif ($n=~m/^(?:date|appDate|regDate)$/)
90 {
91 0 $t{$n}=$po->parse_iso8601($c->textContent());
92 }
93 }
94  
95 0 $rinfo->{$otype}->{$oname}->{trademark}=\%t;
96 0 return;
97 }
98  
99 ####################################################################################################
100 1 1;
101  
102 __END__
103  
104 =pod
105  
106 =head1 NAME
107  
108 Net::DRI::Protocol::EPP::Extensions::Afilias::Trademark - Afilias Trademark EPP Extension for Net::DRI
109  
110 =head1 DESCRIPTION
111  
112 Please see the README file for details.
113  
114 =head1 SUPPORT
115  
116 For now, support questions should be sent to:
117  
118 E<lt>netdri@dotandco.comE<gt>
119  
120 Please also see the SUPPORT file in the distribution.
121  
122 =head1 SEE ALSO
123  
124 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
125  
126 =head1 AUTHOR
127  
128 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
129  
130 =head1 COPYRIGHT
131  
132 Copyright (c) 2010,2013,2016 Patrick Mevzek <netdri@dotandco.com>. All rights reserved.
133 All rights reserved.
134  
135 This program is free software; you can redistribute it and/or modify
136 it under the terms of the GNU General Public License as published by
137 the Free Software Foundation; either version 2 of the License, or
138 (at your option) any later version.
139  
140 See the LICENSE file that comes with this distribution for more details.
141  
142 =cut
« DRI/DRD/RESTENA.pm ↑ Summary DRI/Protocol/EPP/Extensions/FCCN/Domain.pm »