Fastly/Object/CustomerResponse.pm untested

filter: Statementstmt 0.0% 0 / 113 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 20 Podpod 0.0% 0 / 6 totaltotal 0.0% 0 / 159 CC 7 SCAR 20.2
CC
7
Cov
0%
from_hash
20.0
_deserialize
20.0
new
2.0
CRAP 7.5
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::CustomerResponse;
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::Customer;
32 use WebService::Fastly::Object::CustomerResponseAllOf;
33 use WebService::Fastly::Object::Timestamps;
34  
35 use base ("Class::Accessor", "Class::Data::Inheritable");
36  
37 #
38 #
39 #
40 # NOTE: This class is auto generated. Do not edit the class manually.
41 #
42  
43 =begin comment
44  
45 Fastly API
46  
47 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/)
48  
49 The version of the API Spec document: 1.0.0
50 Contact: oss@fastly.com
51  
52 =end comment
53  
54 =cut
55  
56 #
57 # NOTE: This class is auto generated.
58 # Do not edit the class manually.
59 #
60 __PACKAGE__->mk_classdata('attribute_map' => {});
61 __PACKAGE__->mk_classdata('openapi_types' => {});
62 __PACKAGE__->mk_classdata('method_documentation' => {});
63 __PACKAGE__->mk_classdata('class_documentation' => {});
64 __PACKAGE__->mk_classdata('openapi_nullable' => {});
65  
66 # new plain object
67 sub new {
68 my ($class, %args) = @_;
69  
70 my $self = bless {}, $class;
71  
72 $self->init(%args);
73  
74 return $self;
75 }
76  
77 # initialize the object
78 sub init
79 {
80 my ($self, %args) = @_;
81  
82 foreach my $attribute (keys %{$self->attribute_map}) {
83 my $args_key = $self->attribute_map->{$attribute};
84 $self->$attribute( $args{ $args_key } );
85 }
86 }
87  
88 # return perl hash
89 sub to_hash {
90 my $self = shift;
91 my $_hash = decode_json(JSON()->new->allow_blessed->convert_blessed->encode($self));
92  
93 return $_hash;
94 }
95  
96 # used by JSON for serialization
97 sub TO_JSON {
98 my $self = shift;
99 my $_data = {};
100 foreach my $_key (keys %{$self->attribute_map}) {
101 $_data->{$self->attribute_map->{$_key}} = $self->{$_key};
102 }
103  
104 return $_data;
105 }
106  
107 # from Perl hashref
108 sub from_hash {
109 my ($self, $hash) = @_;
110  
111 # loop through attributes and use openapi_types to deserialize the data
112 while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
113 my $_json_attribute = $self->attribute_map->{$_key};
114 my $_is_nullable = ($self->openapi_nullable->{$_key} || 'false') eq 'true';
115 if ($_type =~ /^array\[(.+)\]$/i) { # array
116 my $_subclass = $1;
117 my @_array = ();
118 foreach my $_element (@{$hash->{$_json_attribute}}) {
119 push @_array, $self->_deserialize($_subclass, $_element, $_is_nullable);
120 }
121 $self->{$_key} = \@_array;
122 } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash
123 my $_subclass = $1;
124 my %_hash = ();
125 while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) {
126 $_hash{$_key} = $self->_deserialize($_subclass, $_element, $_is_nullable);
127 }
128 $self->{$_key} = \%_hash;
129 } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime
130 $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}, $_is_nullable);
131 } else {
132 $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute);
133 }
134 }
135  
136 return $self;
137 }
138  
139 # deserialize non-array data
140 sub _deserialize {
141 my ($self, $type, $data, $is_nullable) = @_;
142 $log->debugf("deserializing %s with %s",Dumper($data), $type);
143  
144 if (!(defined $data) && $is_nullable) {
145 return undef;
146 }
147 if ($type eq 'DateTime') {
148 return DateTime->from_epoch(epoch => str2time($data));
149 } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) {
150 return $data;
151 } else { # hash(model)
152 my $_instance = eval "WebService::Fastly::Object::$type->new()";
153 return $_instance->from_hash($data);
154 }
155 }
156  
157  
158 __PACKAGE__->class_documentation({description => '',
159 class => 'CustomerResponse',
160 required => [], # TODO
161 } );
162  
163 __PACKAGE__->method_documentation({
164 'billing_contact_id' => {
165 datatype => 'string',
166 base_name => 'billing_contact_id',
167 description => 'The alphanumeric string representing the primary billing contact.',
168 format => '',
169 read_only => 'false',
170 },
171 'billing_network_type' => {
172 datatype => 'string',
173 base_name => 'billing_network_type',
174 description => 'Customer's current network revenue type.',
175 format => '',
176 read_only => 'false',
177 },
178 'billing_ref' => {
179 datatype => 'string',
180 base_name => 'billing_ref',
181 description => 'Used for adding purchased orders to customer's account.',
182 format => '',
183 read_only => 'false',
184 },
185 'can_configure_wordpress' => {
186 datatype => 'boolean',
187 base_name => 'can_configure_wordpress',
188 description => 'Whether this customer can view or edit wordpress.',
189 format => '',
190 read_only => 'true',
191 },
192 'can_reset_passwords' => {
193 datatype => 'boolean',
194 base_name => 'can_reset_passwords',
195 description => 'Whether this customer can reset passwords.',
196 format => '',
197 read_only => 'true',
198 },
199 'can_upload_vcl' => {
200 datatype => 'boolean',
201 base_name => 'can_upload_vcl',
202 description => 'Whether this customer can upload VCL.',
203 format => '',
204 read_only => 'true',
205 },
206 'force_2fa' => {
207 datatype => 'boolean',
208 base_name => 'force_2fa',
209 description => 'Specifies whether 2FA is forced or not forced on the customer account. Logs out non-2FA users once 2FA is force enabled.',
210 format => '',
211 read_only => 'false',
212 },
213 'force_sso' => {
214 datatype => 'boolean',
215 base_name => 'force_sso',
216 description => 'Specifies whether SSO is forced or not forced on the customer account.',
217 format => '',
218 read_only => 'false',
219 },
220 'has_account_panel' => {
221 datatype => 'boolean',
222 base_name => 'has_account_panel',
223 description => 'Specifies whether the account has access or does not have access to the account panel.',
224 format => '',
225 read_only => 'false',
226 },
227 'has_improved_events' => {
228 datatype => 'boolean',
229 base_name => 'has_improved_events',
230 description => 'Specifies whether the account has access or does not have access to the improved events.',
231 format => '',
232 read_only => 'false',
233 },
234 'has_improved_ssl_config' => {
235 datatype => 'boolean',
236 base_name => 'has_improved_ssl_config',
237 description => 'Whether this customer can view or edit the SSL config.',
238 format => '',
239 read_only => 'true',
240 },
241 'has_openstack_logging' => {
242 datatype => 'boolean',
243 base_name => 'has_openstack_logging',
244 description => 'Specifies whether the account has enabled or not enabled openstack logging.',
245 format => '',
246 read_only => 'false',
247 },
248 'has_pci' => {
249 datatype => 'boolean',
250 base_name => 'has_pci',
251 description => 'Specifies whether the account can edit PCI for a service.',
252 format => '',
253 read_only => 'false',
254 },
255 'has_pci_passwords' => {
256 datatype => 'boolean',
257 base_name => 'has_pci_passwords',
258 description => 'Specifies whether PCI passwords are required for the account.',
259 format => '',
260 read_only => 'true',
261 },
262 'ip_whitelist' => {
263 datatype => 'string',
264 base_name => 'ip_whitelist',
265 description => 'The range of IP addresses authorized to access the customer account.',
266 format => '',
267 read_only => 'false',
268 },
269 'legal_contact_id' => {
270 datatype => 'string',
271 base_name => 'legal_contact_id',
272 description => 'The alphanumeric string identifying the account's legal contact.',
273 format => '',
274 read_only => 'false',
275 },
276 'name' => {
277 datatype => 'string',
278 base_name => 'name',
279 description => 'The name of the customer, generally the company name.',
280 format => '',
281 read_only => 'false',
282 },
283 'owner_id' => {
284 datatype => 'string',
285 base_name => 'owner_id',
286 description => 'The alphanumeric string identifying the account owner.',
287 format => '',
288 read_only => 'false',
289 },
290 'phone_number' => {
291 datatype => 'string',
292 base_name => 'phone_number',
293 description => 'The phone number associated with the account.',
294 format => '',
295 read_only => 'false',
296 },
297 'postal_address' => {
298 datatype => 'string',
299 base_name => 'postal_address',
300 description => 'The postal address associated with the account.',
301 format => '',
302 read_only => 'false',
303 },
304 'pricing_plan' => {
305 datatype => 'string',
306 base_name => 'pricing_plan',
307 description => 'The pricing plan this customer is under.',
308 format => '',
309 read_only => 'false',
310 },
311 'pricing_plan_id' => {
312 datatype => 'string',
313 base_name => 'pricing_plan_id',
314 description => 'The alphanumeric string identifying the pricing plan.',
315 format => '',
316 read_only => 'false',
317 },
318 'security_contact_id' => {
319 datatype => 'string',
320 base_name => 'security_contact_id',
321 description => 'The alphanumeric string identifying the account's security contact.',
322 format => '',
323 read_only => 'false',
324 },
325 'technical_contact_id' => {
326 datatype => 'string',
327 base_name => 'technical_contact_id',
328 description => 'The alphanumeric string identifying the account's technical contact.',
329 format => '',
330 read_only => 'false',
331 },
332 'created_at' => {
333 datatype => 'DateTime',
334 base_name => 'created_at',
335 description => 'Date and time in ISO 8601 format.',
336 format => 'date-time',
337 read_only => 'true',
338 },
339 'deleted_at' => {
340 datatype => 'DateTime',
341 base_name => 'deleted_at',
342 description => 'Date and time in ISO 8601 format.',
343 format => 'date-time',
344 read_only => 'true',
345 },
346 'updated_at' => {
347 datatype => 'DateTime',
348 base_name => 'updated_at',
349 description => 'Date and time in ISO 8601 format.',
350 format => 'date-time',
351 read_only => 'true',
352 },
353 'id' => {
354 datatype => 'string',
355 base_name => 'id',
356 description => '',
357 format => '',
358 read_only => 'true',
359 },
360 });
361  
362 __PACKAGE__->openapi_types( {
363 'billing_contact_id' => 'string',
364 'billing_network_type' => 'string',
365 'billing_ref' => 'string',
366 'can_configure_wordpress' => 'boolean',
367 'can_reset_passwords' => 'boolean',
368 'can_upload_vcl' => 'boolean',
369 'force_2fa' => 'boolean',
370 'force_sso' => 'boolean',
371 'has_account_panel' => 'boolean',
372 'has_improved_events' => 'boolean',
373 'has_improved_ssl_config' => 'boolean',
374 'has_openstack_logging' => 'boolean',
375 'has_pci' => 'boolean',
376 'has_pci_passwords' => 'boolean',
377 'ip_whitelist' => 'string',
378 'legal_contact_id' => 'string',
379 'name' => 'string',
380 'owner_id' => 'string',
381 'phone_number' => 'string',
382 'postal_address' => 'string',
383 'pricing_plan' => 'string',
384 'pricing_plan_id' => 'string',
385 'security_contact_id' => 'string',
386 'technical_contact_id' => 'string',
387 'created_at' => 'DateTime',
388 'deleted_at' => 'DateTime',
389 'updated_at' => 'DateTime',
390 'id' => 'string'
391 } );
392  
393 __PACKAGE__->attribute_map( {
394 'billing_contact_id' => 'billing_contact_id',
395 'billing_network_type' => 'billing_network_type',
396 'billing_ref' => 'billing_ref',
397 'can_configure_wordpress' => 'can_configure_wordpress',
398 'can_reset_passwords' => 'can_reset_passwords',
399 'can_upload_vcl' => 'can_upload_vcl',
400 'force_2fa' => 'force_2fa',
401 'force_sso' => 'force_sso',
402 'has_account_panel' => 'has_account_panel',
403 'has_improved_events' => 'has_improved_events',
404 'has_improved_ssl_config' => 'has_improved_ssl_config',
405 'has_openstack_logging' => 'has_openstack_logging',
406 'has_pci' => 'has_pci',
407 'has_pci_passwords' => 'has_pci_passwords',
408 'ip_whitelist' => 'ip_whitelist',
409 'legal_contact_id' => 'legal_contact_id',
410 'name' => 'name',
411 'owner_id' => 'owner_id',
412 'phone_number' => 'phone_number',
413 'postal_address' => 'postal_address',
414 'pricing_plan' => 'pricing_plan',
415 'pricing_plan_id' => 'pricing_plan_id',
416 'security_contact_id' => 'security_contact_id',
417 'technical_contact_id' => 'technical_contact_id',
418 'created_at' => 'created_at',
419 'deleted_at' => 'deleted_at',
420 'updated_at' => 'updated_at',
421 'id' => 'id'
422 } );
423  
424 __PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
425  
426 __PACKAGE__->openapi_nullable( {
427 'billing_contact_id' => 'true',
428 'billing_ref' => 'true',
429 'can_configure_wordpress' => 'true',
430 'legal_contact_id' => 'true',
431 'postal_address' => 'true',
432 'security_contact_id' => 'true',
433 'technical_contact_id' => 'true',
434 'created_at' => 'true',
435 'deleted_at' => 'true',
436 'updated_at' => 'true',
437 } );
438  
439  
440 1;