File Coverage

blib/lib/XML/SRS/Response.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::Response;
3             BEGIN {
4 1     1   2326 $XML::SRS::Response::VERSION = '0.09';
5             }
6              
7 1     1   501 use Moose;
  0            
  0            
8             use Moose::Util::TypeConstraints;
9             use PRANG::Graph;
10             use XML::SRS::Types;
11             use XML::SRS::Result;
12             use XML::SRS::Error;
13              
14             has_attr "registrar_id" =>
15             is => "ro",
16             isa => "XML::SRS::RegistrarId",
17             xml_required => 0,
18             xml_name => "RegistrarId",
19             ;
20              
21             has_element "results" =>
22             is => "ro",
23             isa => "ArrayRef[XML::SRS::Result|XML::SRS::Error]",
24             xml_nodeName => {
25             Response => "XML::SRS::Result",
26             Error => "XML::SRS::Error",
27             },
28             required => 1,
29             ;
30              
31             sub root_element {"NZSRSResponse"}
32             with 'XML::SRS', 'XML::SRS::Node', 'XML::SRS::Version';
33              
34             sub BUILDARGS {
35             my $inv = shift;
36             my %args = @_;
37             if ( $args{version} ) {
38             %args = (%args, $inv->buildargs_version($args{version}));
39             }
40             \%args;
41             }
42              
43             1;
44              
45             __END__
46              
47             =head1 NAME
48              
49             XML::SRS::Response - Top level SRS response class
50              
51             =head1 SYNOPSIS
52              
53             my $response = XML::SRS->parse($xml);
54            
55             my $results = $response->results;
56            
57             =head1 DESCRIPTION
58              
59             This class represents the top level of an SRS response. If you parse an entire
60             SRS XML response (via XML::SRS->parse()), the object returned will be an
61             instance of this class (unless it was a top level error, in which case it will
62             be an L<XML::SRS::Error>). The root XML element of this class is 'NZSRSResponse'.
63              
64             =head1 ATTRIBUTES
65              
66             Each attribute of this class has an accessor/mutator of the same name as
67             the attribute. Additionally, they can be passed as parameters to the
68             constructor.
69              
70             =head2 registrar_id
71              
72             Optional attribute to containing the effective registrar id of the request.
73             Maps to the RegistrarId XML attribute.
74              
75             =head2 results
76              
77             Required attribute. Accepts an array ref of objects that compose the
78             XML::SRS::Result or XML::SRS::Error objects. These correspond to
79             responses to the individual actions of the original request. For example,
80             if a request containing two Whois transactions was sent, the 'results'
81             array ref will contain two XML::SRS::Result objects (assuming the requests
82             were successful).
83              
84             This maps to the Response XML element. However, as this clashes with the
85             top level 'Response' (i.e. 'NZSRSResponse' XML element), it has been
86             renamed 'result'.
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::Node>, L<XML::SRS::Version>
98              
99