File Coverage

lib/Google/Ads/Common/AuthError.pm
Criterion Covered Total %
statement 18 20 90.0
branch n/a
condition n/a
subroutine 6 7 85.7
pod 0 1 0.0
total 24 28 85.7


line stmt bran cond sub pod time code
1             # Copyright 2011, Google Inc. All Rights Reserved.
2             #
3             # Licensed under the Apache License, Version 2.0 (the "License");
4             # you may not use this file except in compliance with the License.
5             # You may obtain a copy of the License at
6             #
7             # http://www.apache.org/licenses/LICENSE-2.0
8             #
9             # Unless required by applicable law or agreed to in writing, software
10             # distributed under the License is distributed on an "AS IS" BASIS,
11             # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12             # See the License for the specific language governing permissions and
13             # limitations under the License.
14              
15             package Google::Ads::Common::AuthError;
16              
17 2     2   1165 use strict;
  2         5  
  2         75  
18 2     2   13 use warnings;
  2         6  
  2         59  
19 2     2   10 use version;
  2         2  
  2         15  
20              
21             # The following needs to be on one line because CPAN uses a particularly hacky
22             # eval() to determine module versions.
23 2     2   119 use Google::Ads::Common::Constants; our $VERSION = ${Google::Ads::Common::Constants::VERSION};
  2         4  
  2         69  
24              
25 2     2   9 use Class::Std::Fast;
  2         6  
  2         20  
26              
27             # Class::Std-style attributes. Need to be kept in the same line.
28             my %message_of : ATTR(:name);
29             my %code_of : ATTR(:name);
30             my %content_of : ATTR(:name);
31              
32             sub as_string : STRINGIFY {
33 0     0 0   my $self = shift;
34             return
35 0           sprintf("AuthError {\n message: %s\n code: %s\n" . " content: %s\n}",
36             $self->get_message(), $self->get_code(), $self->get_content());
37 2     2   938 }
  2         9  
  2         41  
38              
39             1;
40              
41             =pod
42              
43             =head1 NAME
44              
45             Google::Ads::Common::AuthError
46              
47             =head1 DESCRIPTION
48              
49             Captures authorization error information.
50              
51             =head1 ATTRIBUTES
52              
53             Each of these attributes can be set via
54             Google::Ads::Common::AuthError->new().
55             Alternatively, there is a get_ and set_ method associated with each attribute
56             for retrieving or setting them dynamically.
57              
58             =head2 message
59              
60             Holds the error message.
61              
62             =head2 code
63              
64             Holds the HTTP code associated to the error.
65              
66             =head2 content
67              
68             Holds the body of the error response.
69              
70             =head1 LICENSE AND COPYRIGHT
71              
72             Copyright 2012 Google Inc.
73              
74             Licensed under the Apache License, Version 2.0 (the "License");
75             you may not use this file except in compliance with the License.
76             You may obtain a copy of the License at
77              
78             http://www.apache.org/licenses/LICENSE-2.0
79              
80             Unless required by applicable law or agreed to in writing, software
81             distributed under the License is distributed on an "AS IS" BASIS,
82             WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
83             See the License for the specific language governing permissions and
84             limitations under the License.
85              
86             =head1 REPOSITORY INFORMATION
87              
88             $Rev: $
89             $LastChangedBy: $
90             $Id: $
91              
92             =cut