DRI/Protocol/EPP/Extensions/Nomulus/Metadata.pm

filter: Statementstmt 41.0% 16 / 39 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 5 / 10 Podpod 0.0% 0 / 5 totaltotal 31.8% 21 / 66 CC 7 SCAR 32.3
CC
7
Cov
31%
build
56.0
register_commands
2.0
capabilities_add
2.0
CRAP 25.3
« DRI/Protocol/EPP/Extensions/SIDN/Host.pm ↑ Summary DRI/Protocol/EPP/Extensions/DNSBE/Contact.pm »
1 ## Domain Registry Interface, Nomulus Metadata Extension Mapping for EPP
2 ##
3 ## Copyright (c) 2017-2018 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::Nomulus::Metadata;
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 1 ▶use feature 'state';
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 1 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 1 ▶use Net::DRI::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 ####################################################################################################
25  
26 sub register_commands
27 {
28 0 ▶ my ($class,$version)=@_;
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
29 0 state $rd = {};
30 0 $rd->{create} = $rd->{update} = $rd->{delete} = [ \&build, undef ];
31 0 state $cmds = { 'domain' => $rd };
32 0 return $cmds;
33 }
34  
35 0 ▶sub capabilities_add { return ['domain_update','metadata',['set']]; }
Subroutine capabilities_add: not called CC=1 SCAR=6.9
Pod undocumented
36  
37 sub setup
38 {
39 0 ▶ my ($class,$po,$version)=@_;
Subroutine setup: not called CC=1 SCAR=6.9
Pod undocumented
40 0 state $ns = { 'metadata' => 'urn:google:params:xml:ns:metadata-1.0' };
41 0 $po->ns($ns);
42 0 return;
43 }
44  
45 0 ▶sub implements { return 'https://github.com/google/nomulus/blob/5012893c1d761d60591f165a1c5640624b28df9d/java/google/registry/xml/xsd/metadata.xsd'; }
Subroutine implements: not called CC=1 SCAR=6.9
Pod undocumented
46  
47 ####################################################################################################
48  
49 sub build
50 {
51 0 ▶ my ($epp,$domain,$rd)=@_;
Subroutine build: not called CC=7 SCAR=40.3
Pod undocumented
52  
53 0 my $metadata = $epp->extract_argument('metadata', $rd );
54 0 ▶ return unless defined $metadata;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $metadata 0 0 0
55  
56 0 my @data;
57 0 ▶ push @data, [ 'metadata:reason', $metadata->{'reason'} ] if Net::DRI::Util::has_key($metadata, 'reason');
Branch: 1 branch
BranchTrueFalseTotal
if Net::DRI::Util::has_key($metadata, "reason") 0 0 0
58 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('requested_by_registrar must be defined') unless Net::DRI::Util::has_key($metadata, 'requested_by_registrar');
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::has_key($metadata, "requested_by_registrar") 0 0 0
59 0 ▶ push @data, [ 'metadata:requestedByRegistrar', $metadata->{'requested_by_registrar'} ? 'true' : 'false' ];
Branch: 1 branch
BranchTrueFalseTotal
$metadata->{'requested_by_registrar'} ? : 0 0 0
60 0 ▶ push @data, [ 'metadata:anchorTenant', $metadata->{'anchor_tenant'} ? 'true' : 'false' ] if Net::DRI::Util::has_key($metadata, 'anchor_tenant');
Branch: 2 branches
BranchTrueFalseTotal
if Net::DRI::Util::has_key($metadata, "anchor_tenant") 0 0 0
$metadata->{'anchor_tenant'} ? : 0 0 0
61  
62 0 my $mes=$epp->message();
63 0 my $eid=$mes->command_extension_register('metadata', 'metadata');
64 0 $mes->command_extension($eid, \@data);
65 0 return;
66 }
67  
68 ####################################################################################################
69 1 1;
70  
71 __END__
72  
73 =pod
74  
75 =head1 NAME
76  
77 Net::DRI::Protocol::EPP::Extensions::Nomulus::Metadata - EPP Metadata Nomulus Extension mapping for Net::DRI
78  
79 =head1 DESCRIPTION
80  
81 Please see the README file for details.
82  
83 From Google documentation:
84 Domain name extension schema for annotating EPP operations with metadata.
85 This is a proprietary, internal-only, non-public extension only for use
86 inside the Google registry.
87  
88 =head1 SUPPORT
89  
90 For now, support questions should be sent to:
91  
92 E<lt>netdri@dotandco.comE<gt>
93  
94 Please also see the SUPPORT file in the distribution.
95  
96 =head1 SEE ALSO
97  
98 E<lt>http://www.dotandco.com/services/software/Net-DRI/E<gt>
99  
100 =head1 AUTHOR
101  
102 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
103  
104 =head1 COPYRIGHT
105  
106 Copyright (c) 2017-2018 Patrick Mevzek <netdri@dotandco.com>.
107 All rights reserved.
108  
109 This program is free software; you can redistribute it and/or modify
110 it under the terms of the GNU General Public License as published by
111 the Free Software Foundation; either version 2 of the License, or
112 (at your option) any later version.
113  
114 See the LICENSE file that comes with this distribution for more details.
115  
116 =cut
« DRI/Protocol/EPP/Extensions/SIDN/Host.pm ↑ Summary DRI/Protocol/EPP/Extensions/DNSBE/Contact.pm »