| 1 | ## Domain Registry Interface, Nomulus Metadata Extension Mapping for EPP | ||||||||||||||
| 2 | ## | ||||||||||||||
| 3 | ## Copyright (c) 2017-2019 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 | 0 | ▶ | { | ||||||||||||
|
Subroutine
register_commands: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||
| 28 | 0 | my ($class,$version)=@_; | |||||||||||||
| 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 | 0 | ▶ | { | ||||||||||||
|
Subroutine
setup: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||
| 39 | 0 | my ($class,$po,$version)=@_; | |||||||||||||
| 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 | 0 | ▶ | { | ||||||||||||
|
Subroutine
build: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||
| 51 | 0 | my ($epp,$domain,$rd)=@_; | |||||||||||||
| 52 | |||||||||||||||
| 53 | 0 | my $metadata = $epp->extract_argument('metadata', $rd ); | |||||||||||||
| 54 | 0 | ▶ | return unless defined $metadata; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 55 | |||||||||||||||
| 56 | 0 | my @data; | |||||||||||||
| 57 | 0 | ▶ | push @data, ['metadata:reason', $metadata->{'reason'} ] if Net::DRI::Util::has_key($metadata, 'reason'); | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 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
| |||||||||||||||
| 59 | 0 | ▶ | push @data, ['metadata:requestedByRegistrar', $metadata->{'requested_by_registrar'} ? 'true' : 'false' ]; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 60 | 0 | ▶ | push @data, ['metadata:anchorTenant', $metadata->{'anchor_tenant'} ? 'true' : 'false' ] if Net::DRI::Util::has_key($metadata, 'anchor_tenant'); | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 61 | |||||||||||||||
| 62 | 0 | $epp->message()->command_extension('metadata', ['metadata', @data]); | |||||||||||||
| 63 | 0 | return; | |||||||||||||
| 64 | } | ||||||||||||||
| 65 | |||||||||||||||
| 66 | #################################################################################################### | ||||||||||||||
| 67 | 1 | 1; | |||||||||||||
| 68 | |||||||||||||||
| 69 | __END__ | ||||||||||||||