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 Copyright (c) 2026 Aspose.Cells Cloud
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
10
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 SOFTWARE.
21
22 =end comment
23
24 =cut
25
26 package AsposeCellsCloud::Object::AccessTokenResponse;
27
28 require 5.6.0;
29 use strict;
30 use warnings;
31 use utf8;
32 use JSON qw(decode_json);
33 use Data::Dumper;
34 use Module::Runtime qw(use_module);
35 use Log::Any qw($log);
36 use Date::Parse;
37 use DateTime;
38
39
40 use base ("Class::Accessor", "Class::Data::Inheritable");
41
42
43
44 __PACKAGE__->mk_classdata('attribute_map' => {});
45 __PACKAGE__->mk_classdata('swagger_types' => {});
46 __PACKAGE__->mk_classdata('method_documentation' => {});
47 __PACKAGE__->mk_classdata('class_documentation' => {});
48
49 # new object
50 sub new {
51 my ($class, %args) = @_;
52
53 my $self = bless {}, $class;
54
55 foreach my $attribute (keys %{$class->attribute_map}) {
56 my $args_key = $class->attribute_map->{$attribute};
57 $self->$attribute( $args{ $args_key } );
58 }
59
60 return $self;
61 }
62
63 # return perl hash
64 sub to_hash {
65 return decode_json(JSON->new->convert_blessed->encode( shift ));
66 }
67
68 # used by JSON for serialization
69 sub TO_JSON {
70 my $self = shift;
71 my $_data = {};
72 foreach my $_key (keys %{$self->attribute_map}) {
73 if (defined $self->{$_key}) {
74 $_data->{$self->attribute_map->{$_key}} = $self->{$_key};
75 }
76 }
77 return $_data;
78 }
79
80 # from Perl hashref
81 sub from_hash {
82 my ($self, $hash) = @_;
83
84 # loop through attributes and use swagger_types to deserialize the data
85 while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
86 my $_json_attribute = $self->attribute_map->{$_key};
87 if ($_type =~ /^array\[/i) { # array
88 my $_subclass = substr($_type, 6, -1);
89 my @_array = ();
90 foreach my $_element (@{$hash->{$_json_attribute}}) {
91 push @_array, $self->_deserialize($_subclass, $_element);
92 }
93 $self->{$_key} = \@_array;
94 } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime
95 $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute});
96 } else {
97 $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute);
98 }
99 }
100
101 return $self;
102 }
103
104 # deserialize non-array data
105 sub _deserialize {
106 my ($self, $type, $data) = @_;
107 $log->debugf("deserializing %s with %s",Dumper($data), $type);
108
109 if ($type eq 'DateTime') {
110 return DateTime->from_epoch(epoch => str2time($data));
111 } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) {
112 return $data;
113 } else { # hash(model)
114 my $_instance = eval "AsposeCellsCloud::Object::$type->new()";
115 return $_instance->from_hash($data);
116 }
117 }
118
119
120
121 __PACKAGE__->class_documentation({description => '',
122 class => 'AccessTokenResponse',
123 required => [], # TODO
124 } );
125
126 __PACKAGE__->method_documentation({
127 '/expires' => {
128 datatype => 'string',
129 base_name => '.expires',
130 description => '',
131 format => '',
132 read_only => '',
133 },
134 'access_token' => {
135 datatype => 'string',
136 base_name => 'access_token',
137 description => '',
138 format => '',
139 read_only => '',
140 },
141 '/issued' => {
142 datatype => 'string',
143 base_name => '.issued',
144 description => '',
145 format => '',
146 read_only => '',
147 },
148 'client_refresh_token_life_time_in_minutes' => {
149 datatype => 'string',
150 base_name => 'clientRefreshTokenLifeTimeInMinutes',
151 description => '',
152 format => '',
153 read_only => '',
154 },
155 'expires_in' => {
156 datatype => 'int',
157 base_name => 'expires_in',
158 description => '',
159 format => '',
160 read_only => '',
161 },
162 'token_type' => {
163 datatype => 'string',
164 base_name => 'token_type',
165 description => '',
166 format => '',
167 read_only => '',
168 },
169 'client_id' => {
170 datatype => 'string',
171 base_name => 'client_id',
172 description => '',
173 format => '',
174 read_only => '',
175 },
176 'refresh_token' => {
177 datatype => 'string',
178 base_name => 'refresh_token',
179 description => '',
180 format => '',
181 read_only => '',
182 },
183 });
184
185 __PACKAGE__->swagger_types( {
186 '/expires' => 'string',
187 'access_token' => 'string',
188 '/issued' => 'string',
189 'client_refresh_token_life_time_in_minutes' => 'string',
190 'expires_in' => 'int',
191 'token_type' => 'string',
192 'client_id' => 'string',
193 'refresh_token' => 'string'
194 } );
195
196 __PACKAGE__->attribute_map( {
197 '/expires' => '.expires',
198 'access_token' => 'access_token',
199 '/issued' => '.issued',
200 'client_refresh_token_life_time_in_minutes' => 'clientRefreshTokenLifeTimeInMinutes',
201 'expires_in' => 'expires_in',
202 'token_type' => 'token_type',
203 'client_id' => 'client_id',
204 'refresh_token' => 'refresh_token'
205 } );
206
207 __PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
208
209
210 1;
211