| 1 | package Net::RRP::Request::Transfer; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use Net::RRP::Request; | ||
| 5 | use Net::RRP::Exception::InvalidCommandOption; | ||
| 6 | use Net::RRP::Exception::InvalidEntityValue; | ||
| 7 | use Net::RRP::Exception::InvalidOptionValue; | ||
| 8 | |||
| 9 | @Net::RRP::Request::Transfer::ISA = qw(Net::RRP::Request); | ||
| 10 | $Net::RRP::Request::Transfer::VERSION = '0.1'; | ||
| 11 | |||
| 12 | =head1 NAME | ||
| 13 | |||
| 14 | Net::RRP::Request::Transfer - rrp transfer request representation. | ||
| 15 | |||
| 16 | =head1 SYNOPSIS | ||
| 17 | |||
| 18 | use Net::RRP::Request::Transfer; | ||
| 19 | my $transferRequest = new Net::RRP::Request::Transfer | ||
| 20 | ( entity => new Net::RRP::Entity::Domain ( DomainName => [ 'domain.ru' ] ), | ||
| 21 | options => { Approve => 'no' } ) | ||
| 22 | my $transferRequest1 = new Net::RRP::Request::Transfer (); | ||
| 23 | $transferRequest1->setEntity ( new Net::RRP::Entity::Domain ( DomainName => [ 'domain.ru' ] ); | ||
| 24 | $transferRequest1->setOption ( Approve => 'no' ); | ||
| 25 | |||
| 26 | =head1 DESCRIPTION | ||
| 27 | |||
| 28 | This is a rrp transfer request representation class. | ||
| 29 | |||
| 30 | =cut | ||
| 31 | |||
| 32 | =head2 getName | ||
| 33 | |||
| 34 | return a 'Transfer' | ||
| 35 | |||
| 36 | =cut | ||
| 37 | |||
| 38 | sub getName { 'Transfer' }; | ||
| 39 | |||
| 40 | =head2 setEntity | ||
| 41 | |||
| 42 | throw Net::RRP::Exception::InvalidEntityValue unless entity is Net::RRP::Entity::Domain | ||
| 43 | |||
| 44 | =cut | ||
| 45 | |||
| 46 | sub setEntity | ||
| 47 | { | ||
| 48 | my ( $this, $entity ) = @_; | ||
| 49 | my $ref = ref ( $entity ) || throw Net::RRP::Exception::InvalidEntityValue (); | ||
| 50 | $ref eq 'Net::RRP::Entity::Domain' || throw throw Net::RRP::Exception::InvalidEntityValue (); | ||
| 51 | $this->SUPER::setEntity ( $entity ); | ||
| 52 | } | ||
| 53 | |||
| 54 | =head2 setOption | ||
| 55 | |||
| 56 | Pass only Approve option and yes/no value | ||
| 57 | |||
| 58 | =cut | ||
| 59 | |||
| 60 | sub setOption | ||
| 61 | { | ||
| 62 | my ( $this, $key, $value ) = @_; | ||
| 63 | throw Net::RRP::Exception::InvalidCommandOption () if lc ( $key ) ne "approve"; | ||
| 64 | throw Net::RRP::Exception::InvalidOptionValue () unless lc ( $value ) =~ /^yes|no$/; | ||
| 65 | $this->SUPER::setOption ( $key => $value ); | ||
| 66 | } | ||
| 67 | |||
| 68 | =head1 AUTHOR AND COPYRIGHT | ||
| 69 | |||
| 70 | Net::RRP::Request::Transfer (C) Michael Kulakov, Zenon N.S.P. 2000 | ||
| 71 | 125124, 19, 1-st Jamskogo polja st, | ||
| 72 | Moscow, Russian Federation | ||
| 73 | |||
| 74 | mkul@cpan.org | ||
| 75 | |||
| 76 | All rights reserved. | ||
| 77 | |||
| 78 | You may distribute this package under the terms of either the GNU | ||
| 79 | General Public License or the Artistic License, as specified in the | ||
| 80 | Perl README file. | ||
| 81 | |||
| 82 | =head1 SEE ALSO | ||
| 83 | |||
| 84 | L<Net::RRP::Request(3)>, L<Net::RRP::Codec(3)>, L<Net::RRP::Entity::Domain(3)>, | ||
| 85 | RFC 2832,L<Net::RRP::Exception::InvalidCommandOption(3)>, | ||
| 86 | L<Net::RRP::Exception::InvalidEntityValue(3)>, L<Net::RRP::Exception::InvalidOptionValue(3)> | ||
| 87 | |||
| 88 | =cut | ||
| 89 | |||
| 90 | 1; | ||
| 91 | |||
| 92 | __END__ |