Object/FilesUploadResult.pm untested

filter: Statementstmt 0.0% 0 / 90 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 17 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 122 CC 6 SCAR 16.3
CC
6
Cov
0%
from_hash
12.0
_deserialize
12.0
TO_JSON
6.0
CRAP 5.1
1 =begin comment
2
3 Aspose.Diagram Cloud API Reference
4
5 No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
6
7 OpenAPI spec version: 3.0
8
9 Generated by: https://github.com/swagger-api/swagger-codegen.git
10
11 =end comment
12
13 =cut
14
15 #
16 # NOTE: This class is auto generated by the swagger code generator program.
17 # Do not edit the class manually.
18 # Ref: https://github.com/swagger-api/swagger-codegen
19 #
20 package AsposeDiagramCloud::Object::FilesUploadResult;
21
22 require 5.6.0;
23 use strict;
24 use warnings;
25 use utf8;
26 use JSON qw(decode_json);
27 use Data::Dumper;
28 use Module::Runtime qw(use_module);
29 use Log::Any qw($log);
30 use Date::Parse;
31 use DateTime;
32
33 use AsposeDiagramCloud::Object::Error;
34
35 use base ("Class::Accessor", "Class::Data::Inheritable");
36
37
38 #
39 #File upload result
40 #
41 # NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
42 # REF: https://github.com/swagger-api/swagger-codegen
43 #
44
45 =begin comment
46
47 Aspose.Diagram Cloud API Reference
48
49 No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
50
51 OpenAPI spec version: 3.0
52
53 Generated by: https://github.com/swagger-api/swagger-codegen.git
54
55 =end comment
56
57 =cut
58
59 #
60 # NOTE: This class is auto generated by the swagger code generator program.
61 # Do not edit the class manually.
62 # Ref: https://github.com/swagger-api/swagger-codegen
63 #
64 __PACKAGE__->mk_classdata('attribute_map' => {});
65 __PACKAGE__->mk_classdata('swagger_types' => {});
66 __PACKAGE__->mk_classdata('method_documentation' => {});
67 __PACKAGE__->mk_classdata('class_documentation' => {});
68
69 # new object
70 sub new {
71 my ($class, %args) = @_;
72
73 my $self = bless {}, $class;
74
75 foreach my $attribute (keys %{$class->attribute_map}) {
76 my $args_key = $class->attribute_map->{$attribute};
77 $self->$attribute( $args{ $args_key } );
78 }
79
80 return $self;
81 }
82
83 # return perl hash
84 sub to_hash {
85 return decode_json(JSON->new->convert_blessed->encode( shift ));
86 }
87
88 # used by JSON for serialization
89 sub TO_JSON {
90 my $self = shift;
91 my $_data = {};
92 foreach my $_key (keys %{$self->attribute_map}) {
93 if (defined $self->{$_key}) {
94 $_data->{$self->attribute_map->{$_key}} = $self->{$_key};
95 }
96 }
97 return $_data;
98 }
99
100 # from Perl hashref
101 sub from_hash {
102 my ($self, $hash) = @_;
103
104 # loop through attributes and use swagger_types to deserialize the data
105 while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
106 my $_json_attribute = $self->attribute_map->{$_key};
107 if ($_type =~ /^array\[/i) { # array
108 my $_subclass = substr($_type, 6, -1);
109 my @_array = ();
110 foreach my $_element (@{$hash->{$_json_attribute}}) {
111 push @_array, $self->_deserialize($_subclass, $_element);
112 }
113 $self->{$_key} = \@_array;
114 } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime
115 $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute});
116 } else {
117 $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute);
118 }
119 }
120
121 return $self;
122 }
123
124 # deserialize non-array data
125 sub _deserialize {
126 my ($self, $type, $data) = @_;
127 $log->debugf("deserializing %s with %s",Dumper($data), $type);
128
129 if ($type eq 'DateTime') {
130 return DateTime->from_epoch(epoch => str2time($data));
131 } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) {
132 return $data;
133 } else { # hash(model)
134 my $_instance = eval "AsposeDiagramCloud::Object::$type->new()";
135 return $_instance->from_hash($data);
136 }
137 }
138
139
140
141 __PACKAGE__->class_documentation({description => 'File upload result',
142 class => 'FilesUploadResult',
143 required => [], # TODO
144 } );
145
146 __PACKAGE__->method_documentation({
147 'uploaded' => {
148 datatype => 'ARRAY[string]',
149 base_name => 'Uploaded',
150 description => 'List of uploaded file names',
151 format => '',
152 read_only => '',
153 },
154 'errors' => {
155 datatype => 'ARRAY[Error]',
156 base_name => 'Errors',
157 description => 'List of errors.',
158 format => '',
159 read_only => '',
160 },
161 });
162
163 __PACKAGE__->swagger_types( {
164 'uploaded' => 'ARRAY[string]',
165 'errors' => 'ARRAY[Error]'
166 } );
167
168 __PACKAGE__->attribute_map( {
169 'uploaded' => 'Uploaded',
170 'errors' => 'Errors'
171 } );
172
173 __PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
174
175
176 1;