Fastly/Object/LogInsightsValues.pm untested

filter: Statementstmt 0.0% 0 / 133 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 27 Podpod 0.0% 0 / 6 totaltotal 0.0% 0 / 186 CC 7 SCAR 18.5
CC
7
Cov
0%
from_hash
20.0
_deserialize
20.0
new
2.0
CRAP 6.4
1 =begin comment
2  
3 Fastly API
4  
5 Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/)
6  
7 The version of the API Spec document: 1.0.0
8 Contact: oss@fastly.com
9  
10 =end comment
11  
12 =cut
13  
14 #
15 # NOTE: This class is auto generated.
16 # Do not edit the class manually.
17 #
18 package WebService::Fastly::Object::LogInsightsValues;
19  
20 require 5.6.0;
21 use strict;
22 use warnings;
23 use utf8;
24 use JSON::MaybeXS qw(decode_json);
25 use Data::Dumper;
26 use Module::Runtime qw(use_module);
27 use Log::Any qw($log);
28 use Date::Parse;
29 use DateTime;
30  
31 use WebService::Fastly::Object::Values503Responses;
32 use WebService::Fastly::Object::ValuesBandwidth;
33 use WebService::Fastly::Object::ValuesBrowser;
34 use WebService::Fastly::Object::ValuesCacheHitRatio;
35 use WebService::Fastly::Object::ValuesCountryStats;
36 use WebService::Fastly::Object::ValuesDuration;
37 use WebService::Fastly::Object::ValuesMisses;
38 use WebService::Fastly::Object::ValuesRate;
39 use WebService::Fastly::Object::ValuesRequests;
40 use WebService::Fastly::Object::ValuesStatusCodes;
41  
42 use base ("Class::Accessor", "Class::Data::Inheritable");
43  
44 #
45 #
46 #
47 # NOTE: This class is auto generated. Do not edit the class manually.
48 #
49  
50 =begin comment
51  
52 Fastly API
53  
54 Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/)
55  
56 The version of the API Spec document: 1.0.0
57 Contact: oss@fastly.com
58  
59 =end comment
60  
61 =cut
62  
63 #
64 # NOTE: This class is auto generated.
65 # Do not edit the class manually.
66 #
67 __PACKAGE__->mk_classdata('attribute_map' => {});
68 __PACKAGE__->mk_classdata('openapi_types' => {});
69 __PACKAGE__->mk_classdata('method_documentation' => {});
70 __PACKAGE__->mk_classdata('class_documentation' => {});
71 __PACKAGE__->mk_classdata('openapi_nullable' => {});
72  
73 # new plain object
74 sub new {
75 my ($class, %args) = @_;
76  
77 my $self = bless {}, $class;
78  
79 $self->init(%args);
80  
81 return $self;
82 }
83  
84 # initialize the object
85 sub init
86 {
87 my ($self, %args) = @_;
88  
89 foreach my $attribute (keys %{$self->attribute_map}) {
90 my $args_key = $self->attribute_map->{$attribute};
91 $self->$attribute( $args{ $args_key } );
92 }
93 }
94  
95 # return perl hash
96 sub to_hash {
97 my $self = shift;
98 my $_hash = decode_json(JSON()->new->allow_blessed->convert_blessed->encode($self));
99  
100 return $_hash;
101 }
102  
103 # used by JSON for serialization
104 sub TO_JSON {
105 my $self = shift;
106 my $_data = {};
107 foreach my $_key (keys %{$self->attribute_map}) {
108 $_data->{$self->attribute_map->{$_key}} = $self->{$_key};
109 }
110  
111 return $_data;
112 }
113  
114 # from Perl hashref
115 sub from_hash {
116 my ($self, $hash) = @_;
117  
118 # loop through attributes and use openapi_types to deserialize the data
119 while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
120 my $_json_attribute = $self->attribute_map->{$_key};
121 my $_is_nullable = ($self->openapi_nullable->{$_key} || 'false') eq 'true';
122 if ($_type =~ /^array\[(.+)\]$/i) { # array
123 my $_subclass = $1;
124 my @_array = ();
125 foreach my $_element (@{$hash->{$_json_attribute}}) {
126 push @_array, $self->_deserialize($_subclass, $_element, $_is_nullable);
127 }
128 $self->{$_key} = \@_array;
129 } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash
130 my $_subclass = $1;
131 my %_hash = ();
132 while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) {
133 $_hash{$_key} = $self->_deserialize($_subclass, $_element, $_is_nullable);
134 }
135 $self->{$_key} = \%_hash;
136 } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime
137 $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}, $_is_nullable);
138 } else {
139 $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute);
140 }
141 }
142  
143 return $self;
144 }
145  
146 # deserialize non-array data
147 sub _deserialize {
148 my ($self, $type, $data, $is_nullable) = @_;
149 $log->debugf("deserializing %s with %s",Dumper($data), $type);
150  
151 if (!(defined $data) && $is_nullable) {
152 return undef;
153 }
154 if ($type eq 'DateTime') {
155 return DateTime->from_epoch(epoch => str2time($data));
156 } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) {
157 return $data;
158 } else { # hash(model)
159 my $_instance = eval "WebService::Fastly::Object::$type->new()";
160 return $_instance->from_hash($data);
161 }
162 }
163  
164  
165 __PACKAGE__->class_documentation({description => '',
166 class => 'LogInsightsValues',
167 required => [], # TODO
168 } );
169  
170 __PACKAGE__->method_documentation({
171 'cache_hit_ratio' => {
172 datatype => 'double',
173 base_name => 'cache_hit_ratio',
174 description => 'The cache hit ratio for the URL specified in the dimension.',
175 format => 'float',
176 read_only => 'false',
177 },
178 'region' => {
179 datatype => 'string',
180 base_name => 'region',
181 description => 'The client's country subdivision code as defined by ISO 3166-2.',
182 format => '',
183 read_only => 'false',
184 },
185 'region_chr' => {
186 datatype => 'double',
187 base_name => 'region_chr',
188 description => 'The cache hit ratio for the region.',
189 format => 'float',
190 read_only => 'false',
191 },
192 'region_error_rate' => {
193 datatype => 'double',
194 base_name => 'region_error_rate',
195 description => 'The error rate for the region.',
196 format => 'float',
197 read_only => 'false',
198 },
199 'url' => {
200 datatype => 'string',
201 base_name => 'url',
202 description => 'The HTTP request path.',
203 format => '',
204 read_only => 'false',
205 },
206 'rate_per_status' => {
207 datatype => 'double',
208 base_name => 'rate_per_status',
209 description => 'The URL accounts for this percentage of the status code in this dimension.',
210 format => 'float',
211 read_only => 'false',
212 },
213 'rate_per_url' => {
214 datatype => 'double',
215 base_name => 'rate_per_url',
216 description => 'The rate at which the reason in this dimension occurs among responses to this URL with a 503 status code.',
217 format => 'float',
218 read_only => 'false',
219 },
220 '_503_rate_per_url' => {
221 datatype => 'double',
222 base_name => '503_rate_per_url',
223 description => 'The rate at which 503 status codes are returned for this URL.',
224 format => 'float',
225 read_only => 'false',
226 },
227 'browser_version' => {
228 datatype => 'string',
229 base_name => 'browser_version',
230 description => 'The version of the client's browser.',
231 format => '',
232 read_only => 'false',
233 },
234 'rate' => {
235 datatype => 'double',
236 base_name => 'rate',
237 description => 'The percentage of requests matching the value in the current dimension.',
238 format => 'float',
239 read_only => 'false',
240 },
241 'average_bandwidth_bytes' => {
242 datatype => 'double',
243 base_name => 'average_bandwidth_bytes',
244 description => 'The average bandwidth in bytes for responses to requests to the URL in the current dimension.',
245 format => 'float',
246 read_only => 'false',
247 },
248 'bandwidth_percentage' => {
249 datatype => 'double',
250 base_name => 'bandwidth_percentage',
251 description => 'The total bandwidth percentage for all responses to requests to the URL in the current dimension.',
252 format => 'float',
253 read_only => 'false',
254 },
255 'average_response_time' => {
256 datatype => 'double',
257 base_name => 'average_response_time',
258 description => 'The average time in seconds to respond to requests to the URL in the current dimension.',
259 format => 'float',
260 read_only => 'false',
261 },
262 'p95_response_time' => {
263 datatype => 'double',
264 base_name => 'p95_response_time',
265 description => 'The P95 time in seconds to respond to requests to the URL in the current dimension.',
266 format => 'float',
267 read_only => 'false',
268 },
269 'response_time_percentage' => {
270 datatype => 'double',
271 base_name => 'response_time_percentage',
272 description => 'The total percentage of time to respond to all requests to the URL in the current dimension.',
273 format => 'float',
274 read_only => 'false',
275 },
276 'miss_rate' => {
277 datatype => 'double',
278 base_name => 'miss_rate',
279 description => 'The miss rate for requests to the URL in the current dimension.',
280 format => 'float',
281 read_only => 'false',
282 },
283 'request_percentage' => {
284 datatype => 'double',
285 base_name => 'request_percentage',
286 description => 'The percentage of all requests made to the URL in the current dimension.',
287 format => 'float',
288 read_only => 'false',
289 },
290 });
291  
292 __PACKAGE__->openapi_types( {
293 'cache_hit_ratio' => 'double',
294 'region' => 'string',
295 'region_chr' => 'double',
296 'region_error_rate' => 'double',
297 'url' => 'string',
298 'rate_per_status' => 'double',
299 'rate_per_url' => 'double',
300 '_503_rate_per_url' => 'double',
301 'browser_version' => 'string',
302 'rate' => 'double',
303 'average_bandwidth_bytes' => 'double',
304 'bandwidth_percentage' => 'double',
305 'average_response_time' => 'double',
306 'p95_response_time' => 'double',
307 'response_time_percentage' => 'double',
308 'miss_rate' => 'double',
309 'request_percentage' => 'double'
310 } );
311  
312 __PACKAGE__->attribute_map( {
313 'cache_hit_ratio' => 'cache_hit_ratio',
314 'region' => 'region',
315 'region_chr' => 'region_chr',
316 'region_error_rate' => 'region_error_rate',
317 'url' => 'url',
318 'rate_per_status' => 'rate_per_status',
319 'rate_per_url' => 'rate_per_url',
320 '_503_rate_per_url' => '503_rate_per_url',
321 'browser_version' => 'browser_version',
322 'rate' => 'rate',
323 'average_bandwidth_bytes' => 'average_bandwidth_bytes',
324 'bandwidth_percentage' => 'bandwidth_percentage',
325 'average_response_time' => 'average_response_time',
326 'p95_response_time' => 'p95_response_time',
327 'response_time_percentage' => 'response_time_percentage',
328 'miss_rate' => 'miss_rate',
329 'request_percentage' => 'request_percentage'
330 } );
331  
332 __PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
333  
334 __PACKAGE__->openapi_nullable( {
335 } );
336  
337  
338 1;