Object/FileContentType.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::FileContentType;
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 #File content 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 Binary => 0,
81 ASCII => 1
82 };
83 ####################
84 return $self;
85 }
86
87 # return perl hash
88 sub to_hash {
89 return decode_json(JSON->new->convert_blessed->encode( shift ));
90 }
91
92 # used by JSON for serialization
93 sub TO_JSON {
94 my $self = shift;
95 my $_data = {};
96 foreach my $_key (keys %{$self->attribute_map}) {
97 if (defined $self->{$_key}) {
98 $_data->{$self->attribute_map->{$_key}} = $self->{$_key};
99 }
100 }
101 return $_data;
102 }
103
104 # from Perl hashref
105 sub from_hash {
106 my ($self, $hash) = @_;
107
108 # loop through attributes and use swagger_types to deserialize the data
109 while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
110 my $_json_attribute = $self->attribute_map->{$_key};
111 if ($_type =~ /^array\[/i) { # array
112 my $_subclass = substr($_type, 6, -1);
113 my @_array = ();
114 foreach my $_element (@{$hash->{$_json_attribute}}) {
115 push @_array, $self->_deserialize($_subclass, $_element);
116 }
117 $self->{$_key} = \@_array;
118 } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime
119 $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute});
120 } else {
121 $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute);
122 }
123 }
124
125 return $self;
126 }
127
128 # deserialize non-array data
129 sub _deserialize {
130 my ($self, $type, $data) = @_;
131 $log->debugf("deserializing %s with %s",Dumper($data), $type);
132
133 if ($type eq 'DateTime') {
134 return DateTime->from_epoch(epoch => str2time($data));
135 } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) {
136 return $data;
137 } else { # hash(model)
138 my $_instance = eval "AsposeThreeDCloud::Object::$type->new()";
139 return $_instance->from_hash($data);
140 }
141 }
142
143
144
145 __PACKAGE__->class_documentation({description => 'File content type',
146 class => 'FileContentType',
147 required => [], # TODO
148 } );
149
150 __PACKAGE__->method_documentation({
151 });
152
153 __PACKAGE__->swagger_types( {
154
155 } );
156
157 __PACKAGE__->attribute_map( {
158
159 } );
160
161 __PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
162
163
164 1;