Object/AccessTokenResponse.pm untested

filter: Statementstmt 0.0% 0 / 87 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 / 118 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::AccessTokenResponse;
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 #
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
79 return $self;
80 }
81
82 # return perl hash
83 sub to_hash {
84 return decode_json(JSON->new->convert_blessed->encode( shift ));
85 }
86
87 # used by JSON for serialization
88 sub TO_JSON {
89 my $self = shift;
90 my $_data = {};
91 foreach my $_key (keys %{$self->attribute_map}) {
92 if (defined $self->{$_key}) {
93 $_data->{$self->attribute_map->{$_key}} = $self->{$_key};
94 }
95 }
96 return $_data;
97 }
98
99 # from Perl hashref
100 sub from_hash {
101 my ($self, $hash) = @_;
102
103 # loop through attributes and use swagger_types to deserialize the data
104 while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
105 my $_json_attribute = $self->attribute_map->{$_key};
106 if ($_type =~ /^array\[/i) { # array
107 my $_subclass = substr($_type, 6, -1);
108 my @_array = ();
109 foreach my $_element (@{$hash->{$_json_attribute}}) {
110 push @_array, $self->_deserialize($_subclass, $_element);
111 }
112 $self->{$_key} = \@_array;
113 } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime
114 $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute});
115 } else {
116 $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute);
117 }
118 }
119
120 return $self;
121 }
122
123 # deserialize non-array data
124 sub _deserialize {
125 my ($self, $type, $data) = @_;
126 $log->debugf("deserializing %s with %s",Dumper($data), $type);
127
128 if ($type eq 'DateTime') {
129 return DateTime->from_epoch(epoch => str2time($data));
130 } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) {
131 return $data;
132 } else { # hash(model)
133 my $_instance = eval "AsposeThreeDCloud::Object::$type->new()";
134 return $_instance->from_hash($data);
135 }
136 }
137
138
139
140 __PACKAGE__->class_documentation({description => '',
141 class => 'AccessTokenResponse',
142 required => [], # TODO
143 } );
144
145 __PACKAGE__->method_documentation({
146 '/expires' => {
147 datatype => 'string',
148 base_name => '.expires',
149 description => '',
150 format => '',
151 read_only => '',
152 },
153 'access_token' => {
154 datatype => 'string',
155 base_name => 'access_token',
156 description => '',
157 format => '',
158 read_only => '',
159 },
160 '/issued' => {
161 datatype => 'string',
162 base_name => '.issued',
163 description => '',
164 format => '',
165 read_only => '',
166 },
167 'client_refresh_token_life_time_in_minutes' => {
168 datatype => 'string',
169 base_name => 'clientRefreshTokenLifeTimeInMinutes',
170 description => '',
171 format => '',
172 read_only => '',
173 },
174 'expires_in' => {
175 datatype => 'int',
176 base_name => 'expires_in',
177 description => '',
178 format => '',
179 read_only => '',
180 },
181 'token_type' => {
182 datatype => 'string',
183 base_name => 'token_type',
184 description => '',
185 format => '',
186 read_only => '',
187 },
188 'client_id' => {
189 datatype => 'string',
190 base_name => 'client_id',
191 description => '',
192 format => '',
193 read_only => '',
194 },
195 'refresh_token' => {
196 datatype => 'string',
197 base_name => 'refresh_token',
198 description => '',
199 format => '',
200 read_only => '',
201 },
202 });
203
204 __PACKAGE__->swagger_types( {
205 '/expires' => 'string',
206 'access_token' => 'string',
207 '/issued' => 'string',
208 'client_refresh_token_life_time_in_minutes' => 'string',
209 'expires_in' => 'int',
210 'token_type' => 'string',
211 'client_id' => 'string',
212 'refresh_token' => 'string'
213 } );
214
215 __PACKAGE__->attribute_map( {
216 '/expires' => '.expires',
217 'access_token' => 'access_token',
218 '/issued' => '.issued',
219 'client_refresh_token_life_time_in_minutes' => 'clientRefreshTokenLifeTimeInMinutes',
220 'expires_in' => 'expires_in',
221 'token_type' => 'token_type',
222 'client_id' => 'client_id',
223 'refresh_token' => 'refresh_token'
224 } );
225
226 __PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
227
228
229 1;