aspose_cells_cloud 22.5 → 22.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -5
- data/lib/aspose_cells_cloud/api/cells_api.rb +1 -0
- data/lib/aspose_cells_cloud/api/light_cells_api.rb +87 -1
- data/lib/aspose_cells_cloud/models/docx_save_options.rb +265 -0
- data/lib/aspose_cells_cloud/models/json_save_options.rb +301 -0
- data/lib/aspose_cells_cloud/models/pptx_save_options.rb +265 -0
- data/lib/aspose_cells_cloud/models/sql_script_save_options.rb +373 -0
- data/lib/aspose_cells_cloud/version.rb +1 -1
- data/spec/api/cells_one_spec.rb +37 -0
- data/spec/api/cells_rotate_spec.rb +44 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c8a4e3db3d3aaff14eb804043e321482c4bf49e74809aba4d5b539ad92498da
|
4
|
+
data.tar.gz: 6a5fe5072d88d80985a817e4c2dc642d31af095d79802c0626bee7969ca52d6d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 389b3f087a121e8cac6dcce7008a713d11810abc35ec102895e34ca7555724d5e4e4fdcc0ea715a2119f6ba70b8cb617aed1b1c8ca99ddf53cd10e5d44446b62
|
7
|
+
data.tar.gz: 52142934c3c76b5149cb4f39d4ecd32a122818b558e6892fd33e2bae9980891806fcae9c7db2b6af6adbc2fc6eaa85f7302be83240cc25d4dc36c2de319580d3
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
   [](https://github.com/aspose-cells-cloud/aspose-cells-cloud-ruby/blob/master/LICENSE)    [](https://github.com/aspose-cells-cloud/aspose-cells-cloud-ruby/blob/master/LICENSE) 
|
2
2
|
|
3
3
|
|
4
4
|
# Ruby SDK for Spreadsheet Processing in the Cloud
|
@@ -22,11 +22,9 @@ Ruby Cloud SDK wraps Aspose.Cells REST API so you could seamlessly integrate Mic
|
|
22
22
|
- [Convert Excel files to popular formats](https://docs.aspose.cloud/cells/convert-excel-workbook-to-different-file-formats/).
|
23
23
|
|
24
24
|
|
25
|
-
## Feature & Enhancements in Version 22.
|
26
|
-
|
27
|
-
- Add a new API for getting barcode description.
|
28
|
-
|
25
|
+
## Feature & Enhancements in Version 22.8
|
29
26
|
|
27
|
+
- Support transposing Excel Rows to Columns.
|
30
28
|
|
31
29
|
## Read & Write Spreadsheet Formats
|
32
30
|
|
@@ -13389,6 +13389,7 @@ module AsposeCellsCloud
|
|
13389
13389
|
query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?
|
13390
13390
|
query_params[:'storageName'] = opts[:'storage_name'] if !opts[:'storage_name'].nil?
|
13391
13391
|
query_params[:'outStorageName'] = opts[:'out_storage_name'] if !opts[:'out_storage_name'].nil?
|
13392
|
+
query_params[:'checkExcelRestriction'] = opts[:'check_excel_restriction'] if !opts[:'check_excel_restriction'].nil?
|
13392
13393
|
if opts[:'extendedQueryParameters']
|
13393
13394
|
opts[:'extendedQueryParameters'].each do |key , value|
|
13394
13395
|
query_params[key] = value
|
@@ -66,6 +66,7 @@ module AsposeCellsCloud
|
|
66
66
|
# query parameters
|
67
67
|
query_params = {}
|
68
68
|
query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?
|
69
|
+
query_params[:'checkExcelRestriction'] = opts[:'check_excel_restriction'] if !opts[:'check_excel_restriction'].nil?
|
69
70
|
|
70
71
|
# header parameters
|
71
72
|
header_params = {}
|
@@ -130,6 +131,7 @@ module AsposeCellsCloud
|
|
130
131
|
# query parameters
|
131
132
|
query_params = {}
|
132
133
|
query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?
|
134
|
+
query_params[:'checkExcelRestriction'] = opts[:'check_excel_restriction'] if !opts[:'check_excel_restriction'].nil?
|
133
135
|
|
134
136
|
# header parameters
|
135
137
|
header_params = {}
|
@@ -201,6 +203,7 @@ module AsposeCellsCloud
|
|
201
203
|
query_params = {}
|
202
204
|
query_params[:'datasource'] = datasource
|
203
205
|
query_params[:'format'] = opts[:'format'] if !opts[:'format'].nil?
|
206
|
+
query_params[:'checkExcelRestriction'] = opts[:'check_excel_restriction'] if !opts[:'check_excel_restriction'].nil?
|
204
207
|
|
205
208
|
# header parameters
|
206
209
|
header_params = {}
|
@@ -269,7 +272,9 @@ module AsposeCellsCloud
|
|
269
272
|
# query parameters
|
270
273
|
query_params = {}
|
271
274
|
query_params[:'objecttype'] = objecttype
|
272
|
-
|
275
|
+
query_params[:'sheetname'] = opts[:'sheetname'] if !opts[:'sheetname'].nil?
|
276
|
+
query_params[:'outFormat'] = opts[:'out_format'] if !opts[:'out_format'].nil?
|
277
|
+
query_params[:'checkExcelRestriction'] = opts[:'check_excel_restriction'] if !opts[:'check_excel_restriction'].nil?
|
273
278
|
# header parameters
|
274
279
|
header_params = {}
|
275
280
|
# HTTP header 'Accept' (if needed)
|
@@ -344,6 +349,7 @@ module AsposeCellsCloud
|
|
344
349
|
query_params = {}
|
345
350
|
query_params[:'objectType'] = object_type
|
346
351
|
query_params[:'format'] = format
|
352
|
+
query_params[:'checkExcelRestriction'] = opts[:'check_excel_restriction'] if !opts[:'check_excel_restriction'].nil?
|
347
353
|
if opts[:'extendedQueryParameters']
|
348
354
|
opts[:'extendedQueryParameters'].each do |key , value|
|
349
355
|
query_params[key] = value
|
@@ -490,6 +496,7 @@ module AsposeCellsCloud
|
|
490
496
|
query_params = {}
|
491
497
|
query_params[:'format'] = opts[:'format'] if !opts[:'format'].nil?
|
492
498
|
query_params[:'mergeToOneSheet'] = opts[:'merge_to_one_sheet'] if !opts[:'merge_to_one_sheet'].nil?
|
499
|
+
query_params[:'checkExcelRestriction'] = opts[:'check_excel_restriction'] if !opts[:'check_excel_restriction'].nil?
|
493
500
|
|
494
501
|
# header parameters
|
495
502
|
header_params = {}
|
@@ -557,6 +564,7 @@ module AsposeCellsCloud
|
|
557
564
|
|
558
565
|
# query parameters
|
559
566
|
query_params = {}
|
567
|
+
query_params[:'checkExcelRestriction'] = opts[:'check_excel_restriction'] if !opts[:'check_excel_restriction'].nil?
|
560
568
|
|
561
569
|
# header parameters
|
562
570
|
header_params = {}
|
@@ -705,6 +713,7 @@ module AsposeCellsCloud
|
|
705
713
|
query_params[:'text'] = text
|
706
714
|
query_params[:'password'] = opts[:'password'] if !opts[:'password'].nil?
|
707
715
|
query_params[:'sheetname'] = opts[:'sheetname'] if !opts[:'sheetname'].nil?
|
716
|
+
query_params[:'checkExcelRestriction'] = opts[:'check_excel_restriction'] if !opts[:'check_excel_restriction'].nil?
|
708
717
|
|
709
718
|
# header parameters
|
710
719
|
header_params = {}
|
@@ -784,6 +793,7 @@ module AsposeCellsCloud
|
|
784
793
|
query_params[:'password'] = opts[:'password'] if !opts[:'password'].nil?
|
785
794
|
query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?
|
786
795
|
query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?
|
796
|
+
query_params[:'checkExcelRestriction'] = opts[:'check_excel_restriction'] if !opts[:'check_excel_restriction'].nil?
|
787
797
|
|
788
798
|
# header parameters
|
789
799
|
header_params = {}
|
@@ -927,6 +937,7 @@ module AsposeCellsCloud
|
|
927
937
|
query_params = {}
|
928
938
|
query_params[:'text'] = text
|
929
939
|
query_params[:'color'] = color
|
940
|
+
query_params[:'checkExcelRestriction'] = opts[:'check_excel_restriction'] if !opts[:'check_excel_restriction'].nil?
|
930
941
|
|
931
942
|
# header parameters
|
932
943
|
header_params = {}
|
@@ -996,6 +1007,7 @@ module AsposeCellsCloud
|
|
996
1007
|
# query parameters
|
997
1008
|
query_params = {}
|
998
1009
|
query_params[:'compressLevel'] = compress_level
|
1010
|
+
query_params[:'checkExcelRestriction'] = opts[:'check_excel_restriction'] if !opts[:'check_excel_restriction'].nil?
|
999
1011
|
|
1000
1012
|
# header parameters
|
1001
1013
|
header_params = {}
|
@@ -1077,6 +1089,7 @@ module AsposeCellsCloud
|
|
1077
1089
|
query_params[:'newtext'] = newtext
|
1078
1090
|
query_params[:'password'] = opts[:'password'] if !opts[:'storagpassworde_name'].nil?
|
1079
1091
|
query_params[:'sheetName'] = opts[:'sheet_name'] if !opts[:'sheet_name'].nil?
|
1092
|
+
query_params[:'checkExcelRestriction'] = opts[:'check_excel_restriction'] if !opts[:'check_excel_restriction'].nil?
|
1080
1093
|
# header parameters
|
1081
1094
|
header_params = {}
|
1082
1095
|
# HTTP header 'Accept' (if needed)
|
@@ -1148,6 +1161,79 @@ module AsposeCellsCloud
|
|
1148
1161
|
query_params = {}
|
1149
1162
|
query_params[:'rotateType'] = rotate_type
|
1150
1163
|
query_params[:'format'] = format
|
1164
|
+
query_params[:'checkExcelRestriction'] = opts[:'check_excel_restriction'] if !opts[:'check_excel_restriction'].nil?
|
1165
|
+
# header parameters
|
1166
|
+
header_params = {}
|
1167
|
+
# HTTP header 'Accept' (if needed)
|
1168
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
1169
|
+
# HTTP header 'Content-Type'
|
1170
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
1171
|
+
|
1172
|
+
# form parameters
|
1173
|
+
form_params = {}
|
1174
|
+
file.each do |filename , context|
|
1175
|
+
form_params[filename] = context
|
1176
|
+
end
|
1177
|
+
|
1178
|
+
# http body (model)
|
1179
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
|
1180
|
+
post_body = ""
|
1181
|
+
#auth_names = []
|
1182
|
+
auth_names = ['JWT']
|
1183
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
1184
|
+
:header_params => header_params,
|
1185
|
+
:query_params => query_params,
|
1186
|
+
:form_params => form_params,
|
1187
|
+
:body => post_body,
|
1188
|
+
:auth_names => auth_names,
|
1189
|
+
:return_type => 'FilesResult')
|
1190
|
+
if @api_client.config.debugging
|
1191
|
+
@api_client.config.logger.debug "API called: LightCellsApi#post_reverse\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
1192
|
+
end
|
1193
|
+
return data, status_code, headers
|
1194
|
+
end
|
1195
|
+
#
|
1196
|
+
#
|
1197
|
+
# @param file File to upload
|
1198
|
+
# @param rotate_type
|
1199
|
+
# @param format
|
1200
|
+
# @return [FilesResult]
|
1201
|
+
def post_rotate(file, rotate_type, format, opts = {})
|
1202
|
+
data, _status_code, _headers = post_rotate_with_http_info(file, rotate_type, format, opts)
|
1203
|
+
return data
|
1204
|
+
end
|
1205
|
+
|
1206
|
+
#
|
1207
|
+
#
|
1208
|
+
# @param file File to upload
|
1209
|
+
# @param rotate_type
|
1210
|
+
# @param format
|
1211
|
+
# @return [Array<(FilesResult, Fixnum, Hash)>] FilesResult data, response status code and response headers
|
1212
|
+
def post_rotate_with_http_info(file, rotate_type, format, opts = {})
|
1213
|
+
if @api_client.config.debugging
|
1214
|
+
@api_client.config.logger.debug "Calling API: LightCellsApi.post_rotate ..."
|
1215
|
+
end
|
1216
|
+
@api_client.request_token_if_needed
|
1217
|
+
# verify the required parameter 'file' is set
|
1218
|
+
if @api_client.config.client_side_validation && file.nil?
|
1219
|
+
fail ArgumentError, "Missing the required parameter 'file' when calling LightCellsApi.post_rotate"
|
1220
|
+
end
|
1221
|
+
# verify the required parameter 'rotate_type' is set
|
1222
|
+
if @api_client.config.client_side_validation && rotate_type.nil?
|
1223
|
+
fail ArgumentError, "Missing the required parameter 'rotate_type' when calling LightCellsApi.post_rotate"
|
1224
|
+
end
|
1225
|
+
# verify the required parameter 'color' is set
|
1226
|
+
if @api_client.config.client_side_validation && format.nil?
|
1227
|
+
fail ArgumentError, "Missing the required parameter 'format' when calling LightCellsApi.post_rotate"
|
1228
|
+
end
|
1229
|
+
# resource path
|
1230
|
+
local_var_path = "/cells/rotate"
|
1231
|
+
|
1232
|
+
# query parameters
|
1233
|
+
query_params = {}
|
1234
|
+
query_params[:'rotateType'] = rotate_type
|
1235
|
+
query_params[:'format'] = format
|
1236
|
+
query_params[:'checkExcelRestriction'] = opts[:'check_excel_restriction'] if !opts[:'check_excel_restriction'].nil?
|
1151
1237
|
# header parameters
|
1152
1238
|
header_params = {}
|
1153
1239
|
# HTTP header 'Accept' (if needed)
|
@@ -0,0 +1,265 @@
|
|
1
|
+
=begin
|
2
|
+
--------------------------------------------------------------------------------------------------------------------
|
3
|
+
Copyright (c) 2022 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
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
12
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
13
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
14
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
15
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
16
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
17
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
18
|
+
SOFTWARE.
|
19
|
+
--------------------------------------------------------------------------------------------------------------------
|
20
|
+
|
21
|
+
=end
|
22
|
+
|
23
|
+
require 'date'
|
24
|
+
|
25
|
+
module AsposeCellsCloud
|
26
|
+
|
27
|
+
class DocxSaveOptions
|
28
|
+
attr_accessor :enable_http_compression
|
29
|
+
|
30
|
+
attr_accessor :save_format
|
31
|
+
|
32
|
+
# Make the workbook empty after saving the file.
|
33
|
+
attr_accessor :clear_data
|
34
|
+
|
35
|
+
# The cached file folder is used to store some large data.
|
36
|
+
attr_accessor :cached_file_folder
|
37
|
+
|
38
|
+
# Indicates whether validate merged areas before saving the file. The default value is false.
|
39
|
+
attr_accessor :validate_merged_areas
|
40
|
+
|
41
|
+
attr_accessor :refresh_chart_cache
|
42
|
+
|
43
|
+
# If true and the directory does not exist, the directory will be automatically created before saving the file.
|
44
|
+
attr_accessor :create_directory
|
45
|
+
|
46
|
+
attr_accessor :sort_names
|
47
|
+
|
48
|
+
|
49
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
50
|
+
def self.attribute_map
|
51
|
+
{
|
52
|
+
:'enable_http_compression' => :'EnableHTTPCompression',
|
53
|
+
:'save_format' => :'SaveFormat',
|
54
|
+
:'clear_data' => :'ClearData',
|
55
|
+
:'cached_file_folder' => :'CachedFileFolder',
|
56
|
+
:'validate_merged_areas' => :'ValidateMergedAreas',
|
57
|
+
:'refresh_chart_cache' => :'RefreshChartCache',
|
58
|
+
:'create_directory' => :'CreateDirectory',
|
59
|
+
:'sort_names' => :'SortNames'
|
60
|
+
}
|
61
|
+
end
|
62
|
+
|
63
|
+
# Attribute type mapping.
|
64
|
+
def self.swagger_types
|
65
|
+
{
|
66
|
+
:'enable_http_compression' => :'BOOLEAN',
|
67
|
+
:'save_format' => :'String',
|
68
|
+
:'clear_data' => :'BOOLEAN',
|
69
|
+
:'cached_file_folder' => :'String',
|
70
|
+
:'validate_merged_areas' => :'BOOLEAN',
|
71
|
+
:'refresh_chart_cache' => :'BOOLEAN',
|
72
|
+
:'create_directory' => :'BOOLEAN',
|
73
|
+
:'sort_names' => :'BOOLEAN'
|
74
|
+
}
|
75
|
+
end
|
76
|
+
|
77
|
+
# Initializes the object
|
78
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
79
|
+
def initialize(attributes = {})
|
80
|
+
return unless attributes.is_a?(Hash)
|
81
|
+
|
82
|
+
# convert string to symbol for hash key
|
83
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
84
|
+
|
85
|
+
if attributes.has_key?(:'EnableHTTPCompression')
|
86
|
+
self.enable_http_compression = attributes[:'EnableHTTPCompression']
|
87
|
+
end
|
88
|
+
|
89
|
+
if attributes.has_key?(:'SaveFormat')
|
90
|
+
self.save_format = attributes[:'SaveFormat']
|
91
|
+
end
|
92
|
+
|
93
|
+
if attributes.has_key?(:'ClearData')
|
94
|
+
self.clear_data = attributes[:'ClearData']
|
95
|
+
end
|
96
|
+
|
97
|
+
if attributes.has_key?(:'CachedFileFolder')
|
98
|
+
self.cached_file_folder = attributes[:'CachedFileFolder']
|
99
|
+
end
|
100
|
+
|
101
|
+
if attributes.has_key?(:'ValidateMergedAreas')
|
102
|
+
self.validate_merged_areas = attributes[:'ValidateMergedAreas']
|
103
|
+
end
|
104
|
+
|
105
|
+
if attributes.has_key?(:'RefreshChartCache')
|
106
|
+
self.refresh_chart_cache = attributes[:'RefreshChartCache']
|
107
|
+
end
|
108
|
+
|
109
|
+
if attributes.has_key?(:'CreateDirectory')
|
110
|
+
self.create_directory = attributes[:'CreateDirectory']
|
111
|
+
end
|
112
|
+
|
113
|
+
if attributes.has_key?(:'SortNames')
|
114
|
+
self.sort_names = attributes[:'SortNames']
|
115
|
+
end
|
116
|
+
|
117
|
+
end
|
118
|
+
|
119
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
120
|
+
# @return Array for valid properies with the reasons
|
121
|
+
def list_invalid_properties
|
122
|
+
invalid_properties = Array.new
|
123
|
+
return invalid_properties
|
124
|
+
end
|
125
|
+
|
126
|
+
# Check to see if the all the properties in the model are valid
|
127
|
+
# @return true if the model is valid
|
128
|
+
def valid?
|
129
|
+
return true
|
130
|
+
end
|
131
|
+
|
132
|
+
# Checks equality by comparing each attribute.
|
133
|
+
# @param [Object] Object to be compared
|
134
|
+
def ==(o)
|
135
|
+
return true if self.equal?(o)
|
136
|
+
self.class == o.class &&
|
137
|
+
enable_http_compression == o.enable_http_compression &&
|
138
|
+
save_format == o.save_format &&
|
139
|
+
clear_data == o.clear_data &&
|
140
|
+
cached_file_folder == o.cached_file_folder &&
|
141
|
+
validate_merged_areas == o.validate_merged_areas &&
|
142
|
+
refresh_chart_cache == o.refresh_chart_cache &&
|
143
|
+
create_directory == o.create_directory &&
|
144
|
+
sort_names == o.sort_names
|
145
|
+
end
|
146
|
+
|
147
|
+
# @see the `==` method
|
148
|
+
# @param [Object] Object to be compared
|
149
|
+
def eql?(o)
|
150
|
+
self == o
|
151
|
+
end
|
152
|
+
|
153
|
+
# Calculates hash code according to all attributes.
|
154
|
+
# @return [Fixnum] Hash code
|
155
|
+
def hash
|
156
|
+
[enable_http_compression, save_format, clear_data, cached_file_folder, validate_merged_areas, refresh_chart_cache, create_directory, sort_names].hash
|
157
|
+
end
|
158
|
+
|
159
|
+
# Builds the object from hash
|
160
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
161
|
+
# @return [Object] Returns the model itself
|
162
|
+
def build_from_hash(attributes)
|
163
|
+
return nil unless attributes.is_a?(Hash)
|
164
|
+
self.class.swagger_types.each_pair do |key, type|
|
165
|
+
if type =~ /\AArray<(.*)>/i
|
166
|
+
# check to ensure the input is an array given that the the attribute
|
167
|
+
# is documented as an array but the input is not
|
168
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
169
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
170
|
+
end
|
171
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
172
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
173
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
174
|
+
end
|
175
|
+
|
176
|
+
self
|
177
|
+
end
|
178
|
+
|
179
|
+
# Deserializes the data based on type
|
180
|
+
# @param string type Data type
|
181
|
+
# @param string value Value to be deserialized
|
182
|
+
# @return [Object] Deserialized data
|
183
|
+
def _deserialize(type, value)
|
184
|
+
case type.to_sym
|
185
|
+
when :DateTime
|
186
|
+
DateTime.parse(value)
|
187
|
+
when :Date
|
188
|
+
Date.parse(value)
|
189
|
+
when :String
|
190
|
+
value.to_s
|
191
|
+
when :Integer
|
192
|
+
value.to_i
|
193
|
+
when :Float
|
194
|
+
value.to_f
|
195
|
+
when :BOOLEAN
|
196
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
197
|
+
true
|
198
|
+
else
|
199
|
+
false
|
200
|
+
end
|
201
|
+
when :Object
|
202
|
+
# generic object (usually a Hash), return directly
|
203
|
+
value
|
204
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
205
|
+
inner_type = Regexp.last_match[:inner_type]
|
206
|
+
value.map { |v| _deserialize(inner_type, v) }
|
207
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
208
|
+
k_type = Regexp.last_match[:k_type]
|
209
|
+
v_type = Regexp.last_match[:v_type]
|
210
|
+
{}.tap do |hash|
|
211
|
+
value.each do |k, v|
|
212
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
213
|
+
end
|
214
|
+
end
|
215
|
+
else # model
|
216
|
+
temp_model = AsposeCellsCloud.const_get(type).new
|
217
|
+
temp_model.build_from_hash(value)
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
# Returns the string representation of the object
|
222
|
+
# @return [String] String presentation of the object
|
223
|
+
def to_s
|
224
|
+
to_hash.to_s
|
225
|
+
end
|
226
|
+
|
227
|
+
# to_body is an alias to to_hash (backward compatibility)
|
228
|
+
# @return [Hash] Returns the object in the form of hash
|
229
|
+
def to_body
|
230
|
+
to_hash
|
231
|
+
end
|
232
|
+
|
233
|
+
# Returns the object in the form of hash
|
234
|
+
# @return [Hash] Returns the object in the form of hash
|
235
|
+
def to_hash
|
236
|
+
hash = {}
|
237
|
+
self.class.attribute_map.each_pair do |attr, param|
|
238
|
+
value = self.send(attr)
|
239
|
+
next if value.nil?
|
240
|
+
hash[param] = _to_hash(value)
|
241
|
+
end
|
242
|
+
hash
|
243
|
+
end
|
244
|
+
|
245
|
+
# Outputs non-array value in the form of hash
|
246
|
+
# For object, use to_hash. Otherwise, just return the value
|
247
|
+
# @param [Object] value Any valid value
|
248
|
+
# @return [Hash] Returns the value in the form of hash
|
249
|
+
def _to_hash(value)
|
250
|
+
if value.is_a?(Array)
|
251
|
+
value.compact.map{ |v| _to_hash(v) }
|
252
|
+
elsif value.is_a?(Hash)
|
253
|
+
{}.tap do |hash|
|
254
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
255
|
+
end
|
256
|
+
elsif value.respond_to? :to_hash
|
257
|
+
value.to_hash
|
258
|
+
else
|
259
|
+
value
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
263
|
+
end
|
264
|
+
|
265
|
+
end
|