File Coverage

blib/lib/XML/SRS/Request.pm
Criterion Covered Total %
statement 2 4 50.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 4 6 66.6


line stmt bran cond sub pod time code
1              
2             package XML::SRS::Request;
3             BEGIN {
4 1     1   2475 $XML::SRS::Request::VERSION = '0.09';
5             }
6              
7 1     1   527 use Moose;
  0            
  0            
8             use Moose::Util::TypeConstraints;
9             use PRANG::Graph;
10              
11             use XML::SRS::Types;
12              
13             use XML::SRS::Query;
14             use XML::SRS::Action;
15             use XML::SRS::ActionResponse;
16              
17             has_attr "registrar_id" =>
18             is => "ro",
19             isa => "XML::SRS::RegistrarId",
20             xml_name => "RegistrarId",
21             xml_required => 0,
22             ;
23              
24             role_type 'XML::SRS::Action';
25             role_type 'XML::SRS::Query';
26              
27             has_element "requests" =>
28             is => "ro",
29             isa => "ArrayRef[XML::SRS::Action|XML::SRS::Query]",
30             required => 1,
31             ;
32              
33             sub root_element {"NZSRSRequest"}
34             with 'XML::SRS', "XML::SRS::Version";
35              
36             sub BUILDARGS {
37             my $inv = shift;
38             my %args = @_;
39             if ( $args{version} ) {
40             %args = (%args, $inv->buildargs_version($args{version}));
41             }
42             \%args;
43             }
44              
45             1;
46              
47             __END__
48              
49             =head1 NAME
50              
51             XML::SRS::Request - Top level SRS request class
52              
53             =head1 SYNOPSIS
54              
55             my $request = XML::SRS::Request->new(
56             registrar_id => 555,
57             requests => \@requests,
58             );
59            
60             $request->to_xml();
61              
62              
63             =head1 DESCRIPTION
64              
65             This class represents the top level of an SRS request. It can be used to
66             construct an XML document suitable for sending to an SRS server (such as
67             the .nz Domain registry system). The root XML element of this
68             class is 'NZSRSRequest'.
69              
70             =head1 ATTRIBUTES
71              
72             Each attribute of this class has an accessor/mutator of the same name as
73             the attribute. Additionally, they can be passed as parameters to the
74             constructor.
75              
76             =head2 registrar_id
77              
78             Optional attribute to specify the effective registrar id of the request.
79             Maps to the RegistrarId XML attribute.
80              
81             =head2 requests
82              
83             Required attribute. Accepts an array ref of objects that compose the
84             XML::SRS::Action or XML::SRS::Query roles. This equates to a list of
85             SRS transaction objects, i.e. objects representing Whois, DomainCreate,
86             etc.
87              
88             =head1 METHODS
89              
90             =head2 new(%params)
91              
92             Construct a new XML::SRS::Request object. %params specifies the initial
93             values of the attributes.
94              
95             =head1 COMPOSED OF
96              
97             L<XML::SRS>, L<XML::SRS::Version>