Object/SaveFormat.pm untested

filter: Statementstmt 0.0% 0 / 85 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 16 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 116 CC 6 SCAR 16.6
CC
6
Cov
0%
from_hash
12.0
_deserialize
12.0
TO_JSON
6.0
CRAP 5.2
1 =begin comment
2
3 Aspose.3D 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 AsposeThreeDCloud::Object::SaveFormat;
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
34 use base ("Class::Accessor", "Class::Data::Inheritable");
35
36
37 #
38 #SaveFormat type
39 #
40 # NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
41 # REF: https://github.com/swagger-api/swagger-codegen
42 #
43
44 =begin comment
45
46 Aspose.3D Cloud API Reference
47
48 No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
49
50 OpenAPI spec version: 3.0
51
52 Generated by: https://github.com/swagger-api/swagger-codegen.git
53
54 =end comment
55
56 =cut
57
58 #
59 # NOTE: This class is auto generated by the swagger code generator program.
60 # Do not edit the class manually.
61 # Ref: https://github.com/swagger-api/swagger-codegen
62 #
63 __PACKAGE__->mk_classdata('attribute_map' => {});
64 __PACKAGE__->mk_classdata('swagger_types' => {});
65 __PACKAGE__->mk_classdata('method_documentation' => {});
66 __PACKAGE__->mk_classdata('class_documentation' => {});
67
68 # new object
69 sub new {
70 my ($class, %args) = @_;
71
72 my $self = bless {}, $class;
73
74 foreach my $attribute (keys %{$class->attribute_map}) {
75 my $args_key = $class->attribute_map->{$attribute};
76 $self->$attribute( $args{ $args_key } );
77 }
78 ##########Added manual##########
79 my $self = {
80 AMF => 0,
81 ASE => 1,
82 Aspose3DWeb => 2,
83 Collada => 3,
84 Discreet3DS => 4,
85 Draco => 5,
86 DXF => 6,
87 FBX => 7,
88 GLTF => 8,
89 HTML => 9,
90 JT => 10,
91 Microsoft3MF => 11,
92 Obj => 12,
93 PDF => 13,
94 PLY => 14,
95 Rvm => 15,
96 STL => 16,
97 U3D => 17,
98 VRML => 18,
99 X => 19
100 };
101 ####################
102
103 return $self;
104 }
105
106 # return perl hash
107 sub to_hash {
108 return decode_json(JSON->new->convert_blessed->encode( shift ));
109 }
110
111 # used by JSON for serialization
112 sub TO_JSON {
113 my $self = shift;
114 my $_data = {};
115 foreach my $_key (keys %{$self->attribute_map}) {
116 if (defined $self->{$_key}) {
117 $_data->{$self->attribute_map->{$_key}} = $self->{$_key};
118 }
119 }
120 return $_data;
121 }
122
123 # from Perl hashref
124 sub from_hash {
125 my ($self, $hash) = @_;
126
127 # loop through attributes and use swagger_types to deserialize the data
128 while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
129 my $_json_attribute = $self->attribute_map->{$_key};
130 if ($_type =~ /^array\[/i) { # array
131 my $_subclass = substr($_type, 6, -1);
132 my @_array = ();
133 foreach my $_element (@{$hash->{$_json_attribute}}) {
134 push @_array, $self->_deserialize($_subclass, $_element);
135 }
136 $self->{$_key} = \@_array;
137 } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime
138 $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute});
139 } else {
140 $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute);
141 }
142 }
143
144 return $self;
145 }
146
147 # deserialize non-array data
148 sub _deserialize {
149 my ($self, $type, $data) = @_;
150 $log->debugf("deserializing %s with %s",Dumper($data), $type);
151
152 if ($type eq 'DateTime') {
153 return DateTime->from_epoch(epoch => str2time($data));
154 } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) {
155 return $data;
156 } else { # hash(model)
157 my $_instance = eval "AsposeThreeDCloud::Object::$type->new()";
158 return $_instance->from_hash($data);
159 }
160 }
161
162
163
164 __PACKAGE__->class_documentation({description => 'SaveFormat type',
165 class => 'SaveFormat',
166 required => [], # TODO
167 } );
168
169 __PACKAGE__->method_documentation({
170 });
171
172 __PACKAGE__->swagger_types( {
173
174 } );
175
176 __PACKAGE__->attribute_map( {
177
178 } );
179
180 __PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
181
182
183 1;