aspose_cells_cloud 24.9 → 24.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e0ed9ffde4c5720d38ce2c83a23ed895c344a44bae73ad1ff0aefb4f4ecf0167
4
- data.tar.gz: 4492ebb6618270b0347cdd4e3b61622c77fe12bc680659373377bbbb8a3df963
3
+ metadata.gz: 9f7fcc6414eeb5754bceeea3d62f3a11d54af7f0599fae516d71fa5ab05aac1e
4
+ data.tar.gz: 8dfe734152684a810dbfe89e32ecedec9f9563ed870e2b0ba55a9d29c5c89bda
5
5
  SHA512:
6
- metadata.gz: fd81350bac60ecdf90e7fa82ddb80d77673039f2fdbf694d5418bc72e9c7866329241e2e6bc77c8b82b423f69f04d5a1c64339e8f8c6490808b2ea6d6394476b
7
- data.tar.gz: f2a8d44243c662b1dd3de7ae4e8d1b9bb9279969fecab3ec90d4a29fcdd4530651c7593a620664eb229cb96867ff8b2f5152566b829d777d1930f56b253d081d
6
+ metadata.gz: 5aae98df0ea3ecab9cf55139c00b6fa8aedeaa55486ca66ea8f6c661e18df11db6d06f4532b3c7768be8de1301cd262804f19b07a5303e2ef09b753671c28816
7
+ data.tar.gz: c64837e1db7785f3c2d75a2574ee0c2c5d3e7e44a57409823f1c0f4e87acfdabc2f868edf1fdd364e622ca72c8ecdc4bea55564c3eea1560ff605691d334ef5f
data/README.md CHANGED
@@ -1,9 +1,7 @@
1
- ![](https://img.shields.io/badge/REST%20API-v3.0-lightgrey) ![Gem](https://img.shields.io/gem/v/aspose_cells_cloud) ![Gem](https://img.shields.io/gem/dt/aspose_cells_cloud) [![GitHub license](https://img.shields.io/github/license/aspose-cells-cloud/aspose-cells-cloud-ruby)](https://github.com/aspose-cells-cloud/aspose-cells-cloud-ruby/blob/master/LICENSE) ![GitHub commits since latest release (by date)](https://img.shields.io/github/commits-since/aspose-cells-cloud/aspose-cells-cloud-ruby/24.9)
2
-
1
+ ![](https://img.shields.io/badge/REST%20API-v3.0-lightgrey) ![Gem](https://img.shields.io/gem/v/aspose_cells_cloud) ![Gem](https://img.shields.io/gem/dt/aspose_cells_cloud) [![GitHub license](https://img.shields.io/github/license/aspose-cells-cloud/aspose-cells-cloud-ruby)](https://github.com/aspose-cells-cloud/aspose-cells-cloud-ruby/blob/master/LICENSE) ![GitHub commits since latest release (by date)](https://img.shields.io/github/commits-since/aspose-cells-cloud/aspose-cells-cloud-ruby/24.11)
3
2
 
4
3
  Aspose.Cells Cloud for Ruby enables you to handle various aspects of Excel files, including cell data, styles, formulas, charts, pivot tables, data validation, comments, drawing objects, images, hyperlinks, and so on. Additionally, it supports operations such as splitting, merging, repairing, and converting to other compatible file formats.
5
4
 
6
-
7
5
  # Ruby package for Aspose.Cells Cloud
8
6
 
9
7
  Enhance your Ruby applications with the [Aspose.Cells Cloud](https://products.aspose.cloud/cells/ruby) , enabling seamless integration with [Excel, ODS, CSV, Json and other spreadsheet document formats](https://docs.aspose.cloud/cells/supported-file-formats/). With its powerful APIs, developers can effortlessly read, convert, create, edit, and manipulate the contents of Excel documents without the need for any office software installed on the machine.
@@ -21,14 +19,10 @@ Enhance your Ruby applications with the [Aspose.Cells Cloud](https://products.as
21
19
  - Import/Export: Facilitates importing data from various sources into spreadsheets and exporting spreadsheet data to other formats.
22
20
  - Security Management: Offers a range of security features like data encryption, access control, and permission management to safeguard the security and integrity of spreadsheet data.
23
21
 
24
-
25
- ## Feature & Enhancements in Version 24.9
22
+ ## Feature & Enhancements in Version 24.11
26
23
 
27
24
  Full list of issues covering all changes in this release:
28
25
 
29
- - Add word case function for TextProcessingController.
30
- - Support to export Worksheet to HTML with cell address or id.
31
-
32
26
  ## Support file format
33
27
 
34
28
  |**Format**|**Description**|**Load**|**Save**|
@@ -67,14 +61,14 @@ Full list of issues covering all changes in this release:
67
61
  |[DOCX](https://docs.fileformat.com/word-processing/docx/)|A well-known format for Microsoft Word documents that is a combination of XML and binary files.||√|
68
62
  |[PPTX](https://docs.fileformat.com/presentation/pptx/)|The PPTX format is based on the Microsoft PowerPoint open XML presentation file format.||√|
69
63
 
70
-
71
64
  ## Quick Start Guide
72
65
 
73
66
  To begin with Aspose.Cells Cloud, here's what you need to do:
74
67
 
75
68
  1. Sign up for an account at [Aspose for Cloud](https://dashboard.aspose.cloud/#/apps) to obtain your application details.
76
69
  2. Install the Aspose.Cells Cloud Ruby Package from [RubyGems](https://rubygems.org/).
77
- - execute the following command to get the latest Gem package.
70
+
71
+ - execute the following command to get the latest Gem package.
78
72
 
79
73
  ```console
80
74
  gem 'aspose_cells_cloud', '~> 20.10'
@@ -126,13 +120,22 @@ request = AsposeCellsCloud::PutConvertWorkbookRequest.new(:File=>mapFiles,:for
126
120
 
127
121
  # Release history version
128
122
 
123
+ ## Enhancements in Version 24.10
124
+
125
+ - Add the new feature about removing characters on TextProcessingController.
126
+
127
+ ## Enhancements in Version 24.9
128
+
129
+ - Add word case function for TextProcessingController.
130
+ - Support to export Worksheet to HTML with cell address or id.
131
+
129
132
  ## Enhancements in Version 24.8
130
133
 
131
134
  - Add text trim feature on Cells Cloud Services.
132
135
 
133
136
  ## Enhancements in Version 24.7
134
137
 
135
- - Add a new feature about adding text content.
138
+ - Add a new feature about adding text content.
136
139
  - Add get access token by client id and client secret.
137
140
 
138
141
  ## Enhancements in Version 24.6
@@ -2094,6 +2094,20 @@ module AsposeCellsCloud
2094
2094
  return data
2095
2095
  end
2096
2096
 
2097
+
2098
+ def post_remove_characters( post_remove_characters_request, opts = {})
2099
+
2100
+ data, _status_code, _headers = post_remove_characters_request.create_http_request(@api_client,opts )
2101
+ return data
2102
+ end
2103
+
2104
+
2105
+ def post_convert_text( post_convert_text_request, opts = {})
2106
+
2107
+ data, _status_code, _headers = post_convert_text_request.create_http_request(@api_client,opts )
2108
+ return data
2109
+ end
2110
+
2097
2111
  # Retrieve the description of the default style for the workbook .
2098
2112
 
2099
2113
  def get_workbook_default_style( get_workbook_default_style_request, opts = {})
@@ -0,0 +1,294 @@
1
+ =begin
2
+ --------------------------------------------------------------------------------------------------------------------
3
+ <copyright company="Aspose" file="ConvertTextOptionsrb.cs">
4
+ Copyright (c) 2024 Aspose.Cells Cloud
5
+ </copyright>
6
+ <summary>
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
24
+ </summary>
25
+ --------------------------------------------------------------------------------------------------------------------
26
+ =end
27
+
28
+
29
+ require 'date'
30
+
31
+ module AsposeCellsCloud
32
+
33
+ class ConvertTextOptions
34
+ #
35
+ attr_accessor :name
36
+ #
37
+ attr_accessor :data_source
38
+ #
39
+ attr_accessor :file_info
40
+ #
41
+ attr_accessor :worksheet
42
+ #
43
+ attr_accessor :range
44
+ #
45
+ attr_accessor :convert_text_type
46
+ #
47
+ attr_accessor :source_characters
48
+ #
49
+ attr_accessor :target_characters
50
+
51
+ # Attribute mapping from ruby-style variable name to JSON key.
52
+ def self.attribute_map
53
+ {
54
+ :'name' => :'Name',
55
+ :'data_source' => :'DataSource',
56
+ :'file_info' => :'FileInfo',
57
+ :'worksheet' => :'Worksheet',
58
+ :'range' => :'Range',
59
+ :'convert_text_type' => :'ConvertTextType',
60
+ :'source_characters' => :'SourceCharacters',
61
+ :'target_characters' => :'TargetCharacters'
62
+ }
63
+ end
64
+
65
+ # Attribute type mapping.
66
+ def self.swagger_types
67
+ {
68
+ :'name' => :'String',
69
+ :'data_source' => :'DataSource',
70
+ :'file_info' => :'FileInfo',
71
+ :'worksheet' => :'String',
72
+ :'range' => :'String',
73
+ :'convert_text_type' => :'String',
74
+ :'source_characters' => :'String',
75
+ :'target_characters' => :'String'
76
+ }
77
+ end
78
+
79
+ # Initializes the object
80
+ # @param [Hash] attributes Model attributes in the form of hash
81
+ def initialize(attributes = {})
82
+ return unless attributes.is_a?(Hash)
83
+
84
+ # convert string to symbol for hash key
85
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
86
+
87
+ if attributes.has_key?(:'Name')
88
+ self.name = attributes[:'Name']
89
+ end
90
+ if attributes.has_key?(:'DataSource')
91
+ self.data_source = attributes[:'DataSource']
92
+ end
93
+ if attributes.has_key?(:'FileInfo')
94
+ self.file_info = attributes[:'FileInfo']
95
+ end
96
+ if attributes.has_key?(:'Worksheet')
97
+ self.worksheet = attributes[:'Worksheet']
98
+ end
99
+ if attributes.has_key?(:'Range')
100
+ self.range = attributes[:'Range']
101
+ end
102
+ if attributes.has_key?(:'ConvertTextType')
103
+ self.convert_text_type = attributes[:'ConvertTextType']
104
+ end
105
+ if attributes.has_key?(:'SourceCharacters')
106
+ self.source_characters = attributes[:'SourceCharacters']
107
+ end
108
+ if attributes.has_key?(:'TargetCharacters')
109
+ self.target_characters = attributes[:'TargetCharacters']
110
+ end
111
+
112
+ end
113
+
114
+ # Show invalid properties with the reasons. Usually used together with valid?
115
+ # @return Array for valid properies with the reasons
116
+ def list_invalid_properties
117
+ invalid_properties = Array.new
118
+ if @name.nil?
119
+ invalid_properties.push("invalid value for 'name', name cannot be nil.")
120
+ end
121
+ if @data_source.nil?
122
+ invalid_properties.push("invalid value for 'data_source', data_source cannot be nil.")
123
+ end
124
+ if @file_info.nil?
125
+ invalid_properties.push("invalid value for 'file_info', file_info cannot be nil.")
126
+ end
127
+ if @worksheet.nil?
128
+ invalid_properties.push("invalid value for 'worksheet', worksheet cannot be nil.")
129
+ end
130
+ if @range.nil?
131
+ invalid_properties.push("invalid value for 'range', range cannot be nil.")
132
+ end
133
+ if @convert_text_type.nil?
134
+ invalid_properties.push("invalid value for 'convert_text_type', convert_text_type cannot be nil.")
135
+ end
136
+ if @source_characters.nil?
137
+ invalid_properties.push("invalid value for 'source_characters', source_characters cannot be nil.")
138
+ end
139
+ if @target_characters.nil?
140
+ invalid_properties.push("invalid value for 'target_characters', target_characters cannot be nil.")
141
+ end
142
+
143
+ return invalid_properties
144
+ end
145
+
146
+ # Check to see if the all the properties in the model are valid
147
+ # @return true if the model is valid
148
+ def valid?
149
+ return false if @name.nil?
150
+ return false if @data_source.nil?
151
+ return false if @file_info.nil?
152
+ return false if @worksheet.nil?
153
+ return false if @range.nil?
154
+ return false if @convert_text_type.nil?
155
+ return false if @source_characters.nil?
156
+ return false if @target_characters.nil?
157
+ return true
158
+ end
159
+
160
+ # Checks equality by comparing each attribute.
161
+ # @param [Object] Object to be compared
162
+ def ==(o)
163
+ return true if self.equal?(o)
164
+ self.class == o.class &&
165
+ name == o.name &&
166
+ data_source == o.data_source &&
167
+ file_info == o.file_info &&
168
+ worksheet == o.worksheet &&
169
+ range == o.range &&
170
+ convert_text_type == o.convert_text_type &&
171
+ source_characters == o.source_characters &&
172
+ target_characters == o.target_characters
173
+ std_dev == o.std_dev
174
+ end
175
+
176
+ # @see the `==` method
177
+ # @param [Object] Object to be compared
178
+ def eql?(o)
179
+ self == o
180
+ end
181
+
182
+ # Calculates hash code according to all attributes.
183
+ # @return [Fixnum] Hash code
184
+ def hash
185
+ [ name , data_source , file_info , worksheet , range , convert_text_type , source_characters , target_characters ].hash
186
+ end
187
+
188
+ # Builds the object from hash
189
+ # @param [Hash] attributes Model attributes in the form of hash
190
+ # @return [Object] Returns the model itself
191
+ def build_from_hash(attributes)
192
+ return nil unless attributes.is_a?(Hash)
193
+ self.class.swagger_types.each_pair do |key, type|
194
+ if type =~ /\AArray<(.*)>/i
195
+ # check to ensure the input is an array given that the the attribute
196
+ # is documented as an array but the input is not
197
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
198
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
199
+ end
200
+ elsif !attributes[self.class.attribute_map[key]].nil?
201
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
202
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
203
+ end
204
+
205
+ self
206
+ end
207
+
208
+ # Deserializes the data based on type
209
+ # @param string type Data type
210
+ # @param string value Value to be deserialized
211
+ # @return [Object] Deserialized data
212
+ def _deserialize(type, value)
213
+ case type.to_sym
214
+ when :DateTime
215
+ DateTime.parse(value)
216
+ when :Date
217
+ Date.parse(value)
218
+ when :String
219
+ value.to_s
220
+ when :Integer
221
+ value.to_i
222
+ when :Float
223
+ value.to_f
224
+ when :BOOLEAN
225
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
226
+ true
227
+ else
228
+ false
229
+ end
230
+ when :Object
231
+ # generic object (usually a Hash), return directly
232
+ value
233
+ when /\AArray<(?<inner_type>.+)>\z/
234
+ inner_type = Regexp.last_match[:inner_type]
235
+ value.map { |v| _deserialize(inner_type, v) }
236
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
237
+ k_type = Regexp.last_match[:k_type]
238
+ v_type = Regexp.last_match[:v_type]
239
+ {}.tap do |hash|
240
+ value.each do |k, v|
241
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
242
+ end
243
+ end
244
+ else # model
245
+ temp_model = AsposeCellsCloud.const_get(type).new
246
+ temp_model.build_from_hash(value)
247
+ end
248
+ end
249
+
250
+ # Returns the string representation of the object
251
+ # @return [String] String presentation of the object
252
+ def to_s
253
+ to_hash.to_s
254
+ end
255
+
256
+ # to_body is an alias to to_hash (backward compatibility)
257
+ # @return [Hash] Returns the object in the form of hash
258
+ def to_body
259
+ to_hash
260
+ end
261
+
262
+ # Returns the object in the form of hash
263
+ # @return [Hash] Returns the object in the form of hash
264
+ def to_hash
265
+ hash = {}
266
+ self.class.attribute_map.each_pair do |attr, param|
267
+ value = self.send(attr)
268
+ next if value.nil?
269
+ hash[param] = _to_hash(value)
270
+ end
271
+ hash
272
+ end
273
+
274
+ # Outputs non-array value in the form of hash
275
+ # For object, use to_hash. Otherwise, just return the value
276
+ # @param [Object] value Any valid value
277
+ # @return [Hash] Returns the value in the form of hash
278
+ def _to_hash(value)
279
+ if value.is_a?(Array)
280
+ value.compact.map{ |v| _to_hash(v) }
281
+ elsif value.is_a?(Hash)
282
+ {}.tap do |hash|
283
+ value.each { |k, v| hash[k] = _to_hash(v) }
284
+ end
285
+ elsif value.respond_to? :to_hash
286
+ value.to_hash
287
+ else
288
+ value
289
+ end
290
+ end
291
+
292
+ end
293
+
294
+ end
@@ -0,0 +1,234 @@
1
+ =begin
2
+ --------------------------------------------------------------------------------------------------------------------
3
+ <copyright company="Aspose" file="RemoveCharactersByCharacterrb.cs">
4
+ Copyright (c) 2024 Aspose.Cells Cloud
5
+ </copyright>
6
+ <summary>
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
24
+ </summary>
25
+ --------------------------------------------------------------------------------------------------------------------
26
+ =end
27
+
28
+
29
+ require 'date'
30
+
31
+ module AsposeCellsCloud
32
+
33
+ class RemoveCharactersByCharacter
34
+ #
35
+ attr_accessor :remove_text_method
36
+ #
37
+ attr_accessor :remove_characters
38
+ #
39
+ attr_accessor :remove_character_sets_type
40
+
41
+ # Attribute mapping from ruby-style variable name to JSON key.
42
+ def self.attribute_map
43
+ {
44
+ :'remove_text_method' => :'RemoveTextMethod',
45
+ :'remove_characters' => :'RemoveCharacters',
46
+ :'remove_character_sets_type' => :'RemoveCharacterSetsType'
47
+ }
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.swagger_types
52
+ {
53
+ :'remove_text_method' => :'String',
54
+ :'remove_characters' => :'Array<String>',
55
+ :'remove_character_sets_type' => :'String'
56
+ }
57
+ end
58
+
59
+ # Initializes the object
60
+ # @param [Hash] attributes Model attributes in the form of hash
61
+ def initialize(attributes = {})
62
+ return unless attributes.is_a?(Hash)
63
+
64
+ # convert string to symbol for hash key
65
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
66
+
67
+ if attributes.has_key?(:'RemoveTextMethod')
68
+ self.remove_text_method = attributes[:'RemoveTextMethod']
69
+ end
70
+ if attributes.has_key?(:'RemoveCharacters')
71
+ self.remove_characters = attributes[:'RemoveCharacters']
72
+ end
73
+ if attributes.has_key?(:'RemoveCharacterSetsType')
74
+ self.remove_character_sets_type = attributes[:'RemoveCharacterSetsType']
75
+ end
76
+
77
+ end
78
+
79
+ # Show invalid properties with the reasons. Usually used together with valid?
80
+ # @return Array for valid properies with the reasons
81
+ def list_invalid_properties
82
+ invalid_properties = Array.new
83
+ if @remove_text_method.nil?
84
+ invalid_properties.push("invalid value for 'remove_text_method', remove_text_method cannot be nil.")
85
+ end
86
+ if @remove_characters.nil?
87
+ invalid_properties.push("invalid value for 'remove_characters', remove_characters cannot be nil.")
88
+ end
89
+ if @remove_character_sets_type.nil?
90
+ invalid_properties.push("invalid value for 'remove_character_sets_type', remove_character_sets_type cannot be nil.")
91
+ end
92
+
93
+ return invalid_properties
94
+ end
95
+
96
+ # Check to see if the all the properties in the model are valid
97
+ # @return true if the model is valid
98
+ def valid?
99
+ return false if @remove_text_method.nil?
100
+ return false if @remove_characters.nil?
101
+ return false if @remove_character_sets_type.nil?
102
+ return true
103
+ end
104
+
105
+ # Checks equality by comparing each attribute.
106
+ # @param [Object] Object to be compared
107
+ def ==(o)
108
+ return true if self.equal?(o)
109
+ self.class == o.class &&
110
+ remove_text_method == o.remove_text_method &&
111
+ remove_characters == o.remove_characters &&
112
+ remove_character_sets_type == o.remove_character_sets_type
113
+ std_dev == o.std_dev
114
+ end
115
+
116
+ # @see the `==` method
117
+ # @param [Object] Object to be compared
118
+ def eql?(o)
119
+ self == o
120
+ end
121
+
122
+ # Calculates hash code according to all attributes.
123
+ # @return [Fixnum] Hash code
124
+ def hash
125
+ [ remove_text_method , remove_characters , remove_character_sets_type ].hash
126
+ end
127
+
128
+ # Builds the object from hash
129
+ # @param [Hash] attributes Model attributes in the form of hash
130
+ # @return [Object] Returns the model itself
131
+ def build_from_hash(attributes)
132
+ return nil unless attributes.is_a?(Hash)
133
+ self.class.swagger_types.each_pair do |key, type|
134
+ if type =~ /\AArray<(.*)>/i
135
+ # check to ensure the input is an array given that the the attribute
136
+ # is documented as an array but the input is not
137
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
138
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
139
+ end
140
+ elsif !attributes[self.class.attribute_map[key]].nil?
141
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
142
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
143
+ end
144
+
145
+ self
146
+ end
147
+
148
+ # Deserializes the data based on type
149
+ # @param string type Data type
150
+ # @param string value Value to be deserialized
151
+ # @return [Object] Deserialized data
152
+ def _deserialize(type, value)
153
+ case type.to_sym
154
+ when :DateTime
155
+ DateTime.parse(value)
156
+ when :Date
157
+ Date.parse(value)
158
+ when :String
159
+ value.to_s
160
+ when :Integer
161
+ value.to_i
162
+ when :Float
163
+ value.to_f
164
+ when :BOOLEAN
165
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
166
+ true
167
+ else
168
+ false
169
+ end
170
+ when :Object
171
+ # generic object (usually a Hash), return directly
172
+ value
173
+ when /\AArray<(?<inner_type>.+)>\z/
174
+ inner_type = Regexp.last_match[:inner_type]
175
+ value.map { |v| _deserialize(inner_type, v) }
176
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
177
+ k_type = Regexp.last_match[:k_type]
178
+ v_type = Regexp.last_match[:v_type]
179
+ {}.tap do |hash|
180
+ value.each do |k, v|
181
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
182
+ end
183
+ end
184
+ else # model
185
+ temp_model = AsposeCellsCloud.const_get(type).new
186
+ temp_model.build_from_hash(value)
187
+ end
188
+ end
189
+
190
+ # Returns the string representation of the object
191
+ # @return [String] String presentation of the object
192
+ def to_s
193
+ to_hash.to_s
194
+ end
195
+
196
+ # to_body is an alias to to_hash (backward compatibility)
197
+ # @return [Hash] Returns the object in the form of hash
198
+ def to_body
199
+ to_hash
200
+ end
201
+
202
+ # Returns the object in the form of hash
203
+ # @return [Hash] Returns the object in the form of hash
204
+ def to_hash
205
+ hash = {}
206
+ self.class.attribute_map.each_pair do |attr, param|
207
+ value = self.send(attr)
208
+ next if value.nil?
209
+ hash[param] = _to_hash(value)
210
+ end
211
+ hash
212
+ end
213
+
214
+ # Outputs non-array value in the form of hash
215
+ # For object, use to_hash. Otherwise, just return the value
216
+ # @param [Object] value Any valid value
217
+ # @return [Hash] Returns the value in the form of hash
218
+ def _to_hash(value)
219
+ if value.is_a?(Array)
220
+ value.compact.map{ |v| _to_hash(v) }
221
+ elsif value.is_a?(Hash)
222
+ {}.tap do |hash|
223
+ value.each { |k, v| hash[k] = _to_hash(v) }
224
+ end
225
+ elsif value.respond_to? :to_hash
226
+ value.to_hash
227
+ else
228
+ value
229
+ end
230
+ end
231
+
232
+ end
233
+
234
+ end