Object/PageData.pm untested

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