File Coverage

blib/lib/Net/DRI/Data/Contact/BR.pm
Criterion Covered Total %
statement 12 24 50.0
branch 0 10 0.0
condition 0 5 0.0
subroutine 4 6 66.6
pod 0 2 0.0
total 16 47 34.0


line stmt bran cond sub pod time code
1             ## Domain Registry Interface, Handling of contact data for BR
2             ##
3             ## Copyright (c) 2008,2009,2013 Patrick Mevzek . 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::Data::Contact::BR;
16              
17 1     1   970 use strict;
  1         2  
  1         30  
18 1     1   4 use warnings;
  1         2  
  1         31  
19              
20 1     1   4 use base qw/Net::DRI::Data::Contact/;
  1         1  
  1         70  
21 1     1   4 use Net::DRI::Exception;
  1         1  
  1         156  
22              
23             __PACKAGE__->register_attributes(qw(orgid type associated_contacts associated_domains responsible proxy));
24              
25             =pod
26              
27             =head1 NAME
28              
29             Net::DRI::Data::Contact::BR - Handle BR contact data for Net::DRI
30              
31             =head1 DESCRIPTION
32              
33             This subclass of Net::DRI::Data::Contact adds accessors and validation for
34             BR specific data.
35              
36             =head1 METHODS
37              
38             The following mutators can be called in chain, as they all return the object itself.
39              
40             =head2 orgid()
41              
42             organization id
43              
44             =head2 type()
45              
46             type of contact (admin, billing or member)
47              
48             =head1 SUPPORT
49              
50             For now, support questions should be sent to:
51              
52             Enetdri@dotandco.comE
53              
54             Please also see the SUPPORT file in the distribution.
55              
56             =head1 SEE ALSO
57              
58             http://www.dotandco.com/services/software/Net-DRI/
59              
60             =head1 AUTHOR
61              
62             Patrick Mevzek, Enetdri@dotandco.comE
63              
64             =head1 COPYRIGHT
65              
66             Copyright (c) 2008,2009,2013 Patrick Mevzek .
67             All rights reserved.
68              
69             This program is free software; you can redistribute it and/or modify
70             it under the terms of the GNU General Public License as published by
71             the Free Software Foundation; either version 2 of the License, or
72             (at your option) any later version.
73              
74             See the LICENSE file that comes with this distribution for more details.
75              
76             =cut
77              
78             ####################################################################################################
79              
80             sub validate
81             {
82 0     0 0   my ($self,$change)=@_;
83 0   0       $change||=0;
84 0           my @errs;
85              
86 0           $self->SUPER::validate($change); ## will trigger an Exception if problem
87              
88 0 0         if (!$change)
89             {
90             ## Net::DRI::Exception::usererr_insufficient_parameters('orgid is mandatory') unless $self->orgid();
91             }
92              
93 0 0 0       push @errs,'orgid' if ($self->orgid() && !Net::DRI::Util::xml_is_token($self->orgid(),1,30));
94              
95 0 0         Net::DRI::Exception::usererr_invalid_parameters('Invalid contact information: '.join('/',@errs)) if @errs;
96              
97 0           return 1; ## everything ok.
98             }
99              
100             sub init
101             {
102 0     0 0   my ($self,$what,$ndr)=@_;
103              
104 0 0         if ($what eq 'create')
105             {
106 0 0         $self->srid('auto') unless defined($self->srid()); ## we can not choose the ID for pure contacts (but we can for brorg creations it seems)
107             }
108 0           return;
109             }
110              
111             ####################################################################################################
112             1;