Object/LineData.pm untested

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