Object/DrawShapeData.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::DrawShapeData;
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::ShapeStyleData;
34 use AsposeDiagramCloud::Object::TextStyleData;
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 => 'DrawShapeData',
144 required => [], # TODO
145 } );
146
147 __PACKAGE__->method_documentation({
148 'pin_x' => {
149 datatype => 'double',
150 base_name => 'PinX',
151 description => '',
152 format => '',
153 read_only => '',
154 },
155 'pin_y' => {
156 datatype => 'double',
157 base_name => 'PinY',
158 description => '',
159 format => '',
160 read_only => '',
161 },
162 'width' => {
163 datatype => 'double',
164 base_name => 'Width',
165 description => '',
166 format => '',
167 read_only => '',
168 },
169 'height' => {
170 datatype => 'double',
171 base_name => 'Height',
172 description => '',
173 format => '',
174 read_only => '',
175 },
176 'shape_style_data' => {
177 datatype => 'ShapeStyleData',
178 base_name => 'ShapeStyleData',
179 description => '',
180 format => '',
181 read_only => '',
182 },
183 'text' => {
184 datatype => 'string',
185 base_name => 'Text',
186 description => '',
187 format => '',
188 read_only => '',
189 },
190 'text_style_data' => {
191 datatype => 'TextStyleData',
192 base_name => 'TextStyleData',
193 description => '',
194 format => '',
195 read_only => '',
196 },
197 });
198
199 __PACKAGE__->swagger_types( {
200 'pin_x' => 'double',
201 'pin_y' => 'double',
202 'width' => 'double',
203 'height' => 'double',
204 'shape_style_data' => 'ShapeStyleData',
205 'text' => 'string',
206 'text_style_data' => 'TextStyleData'
207 } );
208
209 __PACKAGE__->attribute_map( {
210 'pin_x' => 'PinX',
211 'pin_y' => 'PinY',
212 'width' => 'Width',
213 'height' => 'Height',
214 'shape_style_data' => 'ShapeStyleData',
215 'text' => 'Text',
216 'text_style_data' => 'TextStyleData'
217 } );
218
219 __PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
220
221
222 1;