lib/Amazon/SQS/Model/ErrorResponse.pm untested

filter: Statementstmt 0.0% 0 / 42 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 12 Podpod 0.0% 0 / 11 totaltotal 0.0% 0 / 69 CC 3 SCAR 11.5
CC
3
Cov
0%
new
6.0
setError
6.0
fromXML
2.0
CRAP 3.1
1 ################################################################################
2 # Copyright 2008 Amazon Technologies, Inc.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 #
5 # You may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at: http://aws.amazon.com/apache2.0
7 # This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
8 # CONDITIONS OF ANY KIND, either express or implied. See the License for the
9 # specific language governing permissions and limitations under the License.
10 ################################################################################
11 # __ _ _ ___
12 # ( )( \/\/ )/ __)
13 # /__\ \ / \__ \
14 # (_)(_) \/\/ (___/
15 #
16 # Amazon SQS Perl Library
17 # API Version: 2009-02-01
18 # Generated: Thu Apr 09 01:13:11 PDT 2009
19 #
20  
21  
22 package Amazon::SQS::Model::ErrorResponse;
23  
24 use base qw (Amazon::SQS::Model);
25  
26
27  
28 #
29 # Amazon::SQS::Model::ErrorResponse
30 #
31 # Properties:
32 #
33 #
34 # Error: Amazon::SQS::Model::Error
35 # RequestId: string
36 #
37 #
38 #
39 sub new {
40 my ($class, $data) = @_;
41 my $self = {};
42 $self->{_fields} = {
43
44 Error => {FieldValue => [], FieldType => ["Amazon::SQS::Model::Error"]},
45 RequestId => { FieldValue => undef, FieldType => "string"},
46 };
47  
48 bless ($self, $class);
49 if (defined $data) {
50 $self->_fromHashRef($data);
51 }
52
53 return $self;
54 }
55  
56
57 #
58 # Construct Amazon::SQS::Model::ErrorResponse from XML string
59 #
60 sub fromXML {
61 my ($self, $xml) = @_;
62 eval "use XML::Simple";
63 my $tree = XML::Simple::XMLin ($xml);
64
65 # TODO: check valid XML (is this a response XML?)
66
67 return new Amazon::SQS::Model::ErrorResponse($tree);
68
69 }
70
71 sub getError {
72 return shift->{_fields}->{Error}->{FieldValue};
73 }
74  
75 sub setError {
76 my $self = shift;
77 foreach my $error (@_) {
78 if (not $self->_isArrayRef($error)) {
79 $error = [$error];
80 }
81 $self->{_fields}->{Error}->{FieldValue} = $error;
82 }
83 }
84  
85  
86 sub withError {
87 my ($self, $errorArgs) = @_;
88 foreach my $error (@$errorArgs) {
89 $self->{_fields}->{Error}->{FieldValue} = $error;
90 }
91 return $self;
92 }
93  
94  
95 sub isSetError {
96 return scalar (@{shift->{_fields}->{Error}->{FieldValue}}) > 0;
97 }
98  
99  
100 sub getRequestId {
101 return shift->{_fields}->{RequestId}->{FieldValue};
102 }
103  
104  
105 sub setRequestId {
106 my ($self, $value) = @_;
107  
108 $self->{_fields}->{RequestId}->{FieldValue} = $value;
109 return $self;
110 }
111  
112  
113 sub withRequestId {
114 my ($self, $value) = @_;
115 $self->setRequestId($value);
116 return $self;
117 }
118  
119  
120 sub isSetRequestId {
121 return defined (shift->{_fields}->{RequestId}->{FieldValue});
122 }
123  
124  
125  
126 #
127 # XML Representation for this object
128 #
129 # Returns string XML for this object
130 #
131 sub toXML {
132 my $self = shift;
133 my $xml = "";
134 $xml .= "<ErrorResponse xmlns=\"http://queue.amazonaws.com/doc/2009-02-01/\">";
135 $xml .= $self->_toXMLFragment();
136 $xml .= "</ErrorResponse>";
137 return $xml;
138 }
139  
140  
141 1;