blib/lib/Google/Ads/AdWords/RequestStats.pm untested

filter: Statementstmt 0.0% 0 / 28 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 14 MC/DCmcdc 0.0% 0 / 7 Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 56 CC 2 SCAR 12.8
CC
2
Cov
0%
as_str
6.0
BEGIN
2.0
BEGIN
2.0
CRAP 3.6
1 # Copyright 2012, 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::AdWords::RequestStats;
16  
17 use strict;
18 use version;
19  
20 use Class::Std::Fast;
21  
22 my %authentication_of : ATTR(:name<authentication> :default<>);
23 my %client_id_of : ATTR(:name<client_id> :default<>);
24 my %service_name_of : ATTR(:name<service_name> :default<>);
25 my %method_name_of : ATTR(:name<method_name> :default<>);
26 my %response_time_of : ATTR(:name<response_time> :default<0>);
27 my %request_id_of : ATTR(:name<request_id> :default<>);
28 my %operations_of : ATTR(:name<operations> :default<0>);
29 my %is_fault_of : ATTR(:name<is_fault> :default<0>);
30  
31 sub as_str : STRINGIFY {
32 my $self = shift;
33 my $auth = $self->get_authentication() || "";
34 my $client_id = $self->get_client_id() || "";
35 my $service = $self->get_service_name() || "";
36 my $method = $self->get_method_name() || "";
37 my $response_time = $self->get_response_time() || "";
38 my $request_id = $self->get_request_id() || "";
39 my $operations = $self->get_operations() || "";
40 my $is_fault = $self->get_is_fault() ? "yes" : "no";
41 return "auth=${auth}" .
42 " client_id=${client_id}" .
43 " service=${service}" .
44 " method=${method}" .
45 " response_time=${response_time}" .
46 " request_id=${request_id}" .
47 " operations=${operations}" .
48 " is_fault=${is_fault}";
49 }
50  
51 return 1;
52  
53 =pod
54  
55 =head1 NAME
56  
57 Google::Ads::AdWords::RequestStats
58  
59 =head1 SYNOPSIS
60  
61 Class that wraps API request statistics such as number of operations, units
62 consumed, request id and others.
63  
64 =head1 DESCRIPTION
65  
66 This class holds the data coming from API response headers and others related
67 to a given request.
68  
69 =head1 ATTRIBUTES
70  
71 =head2 authentication
72  
73 Type of authentication used in the request, if client login then the login used
74 in the call will be attached if available.
75  
76 =head2 client_id
77  
78 The client id against which the call was made if available.
79  
80 =head2 service_name
81  
82 The name of the service that was called.
83  
84 =head2 method_name
85  
86 The method name of the service that was called.
87  
88 =head2 response_time
89  
90 Server side time of the duration of the call.
91  
92 =head2 request_id
93  
94 Request id of the call.
95  
96 =head2 operations
97  
98 Number of operations in the request.
99  
100 =head2 units
101  
102 Number of API units consumed in the request.
103  
104 =head2 is_fault
105  
106 Whether the request returned as a fault or not.
107  
108 =head1 LICENSE AND COPYRIGHT
109  
110 Copyright 2012 Google Inc.
111  
112 Licensed under the Apache License, Version 2.0 (the "License");
113 you may not use this file except in compliance with the License.
114 You may obtain a copy of the License at
115  
116 http://www.apache.org/licenses/LICENSE-2.0
117  
118 Unless required by applicable law or agreed to in writing, software
119 distributed under the License is distributed on an "AS IS" BASIS,
120 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
121 See the License for the specific language governing permissions and
122 limitations under the License.
123  
124 =head1 AUTHOR
125  
126 David Torres E<lt>api.davidtorres at gmail.comE<gt>
127  
128 =head1 REPOSITORY INFORMATION
129  
130 $Rev: $
131 $LastChangedBy: $
132 $Id: $
133  
134 =cut