Object/FileVersion.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::FileVersion;
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::StorageFile;
34
35 use base ("Class::Accessor", "Class::Data::Inheritable");
36
37
38 #
39 #File Version
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 Version',
142 class => 'FileVersion',
143 required => [], # TODO
144 } );
145
146 __PACKAGE__->method_documentation({
147 'name' => {
148 datatype => 'string',
149 base_name => 'Name',
150 description => 'File or folder name.',
151 format => '',
152 read_only => '',
153 },
154 'is_folder' => {
155 datatype => 'boolean',
156 base_name => 'IsFolder',
157 description => 'True if it is a folder.',
158 format => '',
159 read_only => '',
160 },
161 'modified_date' => {
162 datatype => 'DateTime',
163 base_name => 'ModifiedDate',
164 description => 'File or folder last modified DateTime.',
165 format => '',
166 read_only => '',
167 },
168 'size' => {
169 datatype => 'int',
170 base_name => 'Size',
171 description => 'File or folder size.',
172 format => '',
173 read_only => '',
174 },
175 'path' => {
176 datatype => 'string',
177 base_name => 'Path',
178 description => 'File or folder path.',
179 format => '',
180 read_only => '',
181 },
182 'version_id' => {
183 datatype => 'string',
184 base_name => 'VersionId',
185 description => 'File Version ID.',
186 format => '',
187 read_only => '',
188 },
189 'is_latest' => {
190 datatype => 'boolean',
191 base_name => 'IsLatest',
192 description => 'Specifies whether the file is (true) or is not (false) the latest version of an file.',
193 format => '',
194 read_only => '',
195 },
196 });
197
198 __PACKAGE__->swagger_types( {
199 'name' => 'string',
200 'is_folder' => 'boolean',
201 'modified_date' => 'DateTime',
202 'size' => 'int',
203 'path' => 'string',
204 'version_id' => 'string',
205 'is_latest' => 'boolean'
206 } );
207
208 __PACKAGE__->attribute_map( {
209 'name' => 'Name',
210 'is_folder' => 'IsFolder',
211 'modified_date' => 'ModifiedDate',
212 'size' => 'Size',
213 'path' => 'Path',
214 'version_id' => 'VersionId',
215 'is_latest' => 'IsLatest'
216 } );
217
218 __PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
219
220
221 1;