Object/CellsObjectOperateTaskParameter.pm untested

filter: Statementstmt 0.0% 0 / 102 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 21 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 138 CC 6 SCAR 15.3
CC
6
Cov
0%
from_hash
12.0
_deserialize
12.0
TO_JSON
6.0
CRAP 4.6
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::CellsObjectOperateTaskParameter;
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 use AsposeCellsCloud::Object::DataSource;
39 use AsposeCellsCloud::Object::FileSource;
40 use AsposeCellsCloud::Object::OperateObject;
41 use AsposeCellsCloud::Object::OperateParameter;
42 use AsposeCellsCloud::Object::TaskParameter;
43
44
45 use base ("Class::Accessor", "Class::Data::Inheritable");
46
47
48
49 __PACKAGE__->mk_classdata('attribute_map' => {});
50 __PACKAGE__->mk_classdata('swagger_types' => {});
51 __PACKAGE__->mk_classdata('method_documentation' => {});
52 __PACKAGE__->mk_classdata('class_documentation' => {});
53
54 # new object
55 sub new {
56 my ($class, %args) = @_;
57
58 my $self = bless {}, $class;
59
60 foreach my $attribute (keys %{$class->attribute_map}) {
61 my $args_key = $class->attribute_map->{$attribute};
62 $self->$attribute( $args{ $args_key } );
63 }
64
65 return $self;
66 }
67
68 # return perl hash
69 sub to_hash {
70 return decode_json(JSON->new->convert_blessed->encode( shift ));
71 }
72
73 # used by JSON for serialization
74 sub TO_JSON {
75 my $self = shift;
76 my $_data = {};
77 foreach my $_key (keys %{$self->attribute_map}) {
78 if (defined $self->{$_key}) {
79 $_data->{$self->attribute_map->{$_key}} = $self->{$_key};
80 }
81 }
82 return $_data;
83 }
84
85 # from Perl hashref
86 sub from_hash {
87 my ($self, $hash) = @_;
88
89 # loop through attributes and use swagger_types to deserialize the data
90 while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
91 my $_json_attribute = $self->attribute_map->{$_key};
92 if ($_type =~ /^array\[/i) { # array
93 my $_subclass = substr($_type, 6, -1);
94 my @_array = ();
95 foreach my $_element (@{$hash->{$_json_attribute}}) {
96 push @_array, $self->_deserialize($_subclass, $_element);
97 }
98 $self->{$_key} = \@_array;
99 } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime
100 $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute});
101 } else {
102 $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute);
103 }
104 }
105
106 return $self;
107 }
108
109 # deserialize non-array data
110 sub _deserialize {
111 my ($self, $type, $data) = @_;
112 $log->debugf("deserializing %s with %s",Dumper($data), $type);
113
114 if ($type eq 'DateTime') {
115 return DateTime->from_epoch(epoch => str2time($data));
116 } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) {
117 return $data;
118 } else { # hash(model)
119 my $_instance = eval "AsposeCellsCloud::Object::$type->new()";
120 return $_instance->from_hash($data);
121 }
122 }
123
124
125 __PACKAGE__->class_documentation({description => 'Represents cells object operate task parameter.',
126 class => 'CellsObjectOperateTaskParameter',
127 required => [], # TODO
128 } );
129
130
131 __PACKAGE__->method_documentation({
132 'operate_object' => {
133 datatype => 'OperateObject',
134 base_name => 'OperateObject',
135 description => 'Represents object operate.',
136 format => '',
137 read_only => '',
138 },
139 'operate_parameter' => {
140 datatype => 'OperateParameter',
141 base_name => 'OperateParameter',
142 description => 'Represents operate parameter.',
143 format => '',
144 read_only => '',
145 },
146 'destination_data_source' => {
147 datatype => 'DataSource',
148 base_name => 'DestinationDataSource',
149 description => 'Represents destination data source.',
150 format => '',
151 read_only => '',
152 },
153 'destination_workbook' => {
154 datatype => 'FileSource',
155 base_name => 'DestinationWorkbook',
156 description => 'Represents destination data source.',
157 format => '',
158 read_only => '',
159 },
160 });
161
162 __PACKAGE__->swagger_types( {
163 'operate_object' => 'OperateObject',
164 'operate_parameter' => 'OperateParameter',
165 'destination_data_source' => 'DataSource',
166 'destination_workbook' => 'FileSource'
167 } );
168
169 __PACKAGE__->attribute_map( {
170 'operate_object' => 'OperateObject',
171 'operate_parameter' => 'OperateParameter',
172 'destination_data_source' => 'DestinationDataSource',
173 'destination_workbook' => 'DestinationWorkbook'
174 } );
175
176 __PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
177
178
179 1;