aspose_cells_cloud 23.6 → 23.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,402 @@
1
+ =begin
2
+ --------------------------------------------------------------------------------------------------------------------
3
+ <copyright company="Aspose" file="Protectionrb.cs">
4
+ Copyright (c) 2023 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 Protection
34
+ #
35
+ attr_accessor :allow_deleting_column
36
+ #
37
+ attr_accessor :allow_deleting_row
38
+ #
39
+ attr_accessor :allow_filtering
40
+ #
41
+ attr_accessor :allow_formatting_cell
42
+ #
43
+ attr_accessor :allow_formatting_column
44
+ #
45
+ attr_accessor :allow_formatting_row
46
+ #
47
+ attr_accessor :allow_inserting_column
48
+ #
49
+ attr_accessor :allow_inserting_hyperlink
50
+ #
51
+ attr_accessor :allow_inserting_row
52
+ #
53
+ attr_accessor :allow_sorting
54
+ #
55
+ attr_accessor :allow_using_pivot_table
56
+ #
57
+ attr_accessor :allow_editing_content
58
+ #
59
+ attr_accessor :allow_editing_object
60
+ #
61
+ attr_accessor :allow_editing_scenario
62
+ #
63
+ attr_accessor :password
64
+ #
65
+ attr_accessor :allow_selecting_locked_cell
66
+ #
67
+ attr_accessor :allow_selecting_unlocked_cell
68
+
69
+ # Attribute mapping from ruby-style variable name to JSON key.
70
+ def self.attribute_map
71
+ {
72
+ :'allow_deleting_column' => :'AllowDeletingColumn',
73
+ :'allow_deleting_row' => :'AllowDeletingRow',
74
+ :'allow_filtering' => :'AllowFiltering',
75
+ :'allow_formatting_cell' => :'AllowFormattingCell',
76
+ :'allow_formatting_column' => :'AllowFormattingColumn',
77
+ :'allow_formatting_row' => :'AllowFormattingRow',
78
+ :'allow_inserting_column' => :'AllowInsertingColumn',
79
+ :'allow_inserting_hyperlink' => :'AllowInsertingHyperlink',
80
+ :'allow_inserting_row' => :'AllowInsertingRow',
81
+ :'allow_sorting' => :'AllowSorting',
82
+ :'allow_using_pivot_table' => :'AllowUsingPivotTable',
83
+ :'allow_editing_content' => :'AllowEditingContent',
84
+ :'allow_editing_object' => :'AllowEditingObject',
85
+ :'allow_editing_scenario' => :'AllowEditingScenario',
86
+ :'password' => :'Password',
87
+ :'allow_selecting_locked_cell' => :'AllowSelectingLockedCell',
88
+ :'allow_selecting_unlocked_cell' => :'AllowSelectingUnlockedCell'
89
+ }
90
+ end
91
+
92
+ # Attribute type mapping.
93
+ def self.swagger_types
94
+ {
95
+ :'allow_deleting_column' => :'BOOLEAN',
96
+ :'allow_deleting_row' => :'BOOLEAN',
97
+ :'allow_filtering' => :'BOOLEAN',
98
+ :'allow_formatting_cell' => :'BOOLEAN',
99
+ :'allow_formatting_column' => :'BOOLEAN',
100
+ :'allow_formatting_row' => :'BOOLEAN',
101
+ :'allow_inserting_column' => :'BOOLEAN',
102
+ :'allow_inserting_hyperlink' => :'BOOLEAN',
103
+ :'allow_inserting_row' => :'BOOLEAN',
104
+ :'allow_sorting' => :'BOOLEAN',
105
+ :'allow_using_pivot_table' => :'BOOLEAN',
106
+ :'allow_editing_content' => :'BOOLEAN',
107
+ :'allow_editing_object' => :'BOOLEAN',
108
+ :'allow_editing_scenario' => :'BOOLEAN',
109
+ :'password' => :'String',
110
+ :'allow_selecting_locked_cell' => :'BOOLEAN',
111
+ :'allow_selecting_unlocked_cell' => :'BOOLEAN'
112
+ }
113
+ end
114
+
115
+ # Initializes the object
116
+ # @param [Hash] attributes Model attributes in the form of hash
117
+ def initialize(attributes = {})
118
+ return unless attributes.is_a?(Hash)
119
+
120
+ # convert string to symbol for hash key
121
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
122
+
123
+ if attributes.has_key?(:'AllowDeletingColumn')
124
+ self.allow_deleting_column = attributes[:'AllowDeletingColumn']
125
+ end
126
+ if attributes.has_key?(:'AllowDeletingRow')
127
+ self.allow_deleting_row = attributes[:'AllowDeletingRow']
128
+ end
129
+ if attributes.has_key?(:'AllowFiltering')
130
+ self.allow_filtering = attributes[:'AllowFiltering']
131
+ end
132
+ if attributes.has_key?(:'AllowFormattingCell')
133
+ self.allow_formatting_cell = attributes[:'AllowFormattingCell']
134
+ end
135
+ if attributes.has_key?(:'AllowFormattingColumn')
136
+ self.allow_formatting_column = attributes[:'AllowFormattingColumn']
137
+ end
138
+ if attributes.has_key?(:'AllowFormattingRow')
139
+ self.allow_formatting_row = attributes[:'AllowFormattingRow']
140
+ end
141
+ if attributes.has_key?(:'AllowInsertingColumn')
142
+ self.allow_inserting_column = attributes[:'AllowInsertingColumn']
143
+ end
144
+ if attributes.has_key?(:'AllowInsertingHyperlink')
145
+ self.allow_inserting_hyperlink = attributes[:'AllowInsertingHyperlink']
146
+ end
147
+ if attributes.has_key?(:'AllowInsertingRow')
148
+ self.allow_inserting_row = attributes[:'AllowInsertingRow']
149
+ end
150
+ if attributes.has_key?(:'AllowSorting')
151
+ self.allow_sorting = attributes[:'AllowSorting']
152
+ end
153
+ if attributes.has_key?(:'AllowUsingPivotTable')
154
+ self.allow_using_pivot_table = attributes[:'AllowUsingPivotTable']
155
+ end
156
+ if attributes.has_key?(:'AllowEditingContent')
157
+ self.allow_editing_content = attributes[:'AllowEditingContent']
158
+ end
159
+ if attributes.has_key?(:'AllowEditingObject')
160
+ self.allow_editing_object = attributes[:'AllowEditingObject']
161
+ end
162
+ if attributes.has_key?(:'AllowEditingScenario')
163
+ self.allow_editing_scenario = attributes[:'AllowEditingScenario']
164
+ end
165
+ if attributes.has_key?(:'Password')
166
+ self.password = attributes[:'Password']
167
+ end
168
+ if attributes.has_key?(:'AllowSelectingLockedCell')
169
+ self.allow_selecting_locked_cell = attributes[:'AllowSelectingLockedCell']
170
+ end
171
+ if attributes.has_key?(:'AllowSelectingUnlockedCell')
172
+ self.allow_selecting_unlocked_cell = attributes[:'AllowSelectingUnlockedCell']
173
+ end
174
+
175
+ end
176
+
177
+ # Show invalid properties with the reasons. Usually used together with valid?
178
+ # @return Array for valid properies with the reasons
179
+ def list_invalid_properties
180
+ invalid_properties = Array.new
181
+ if @allow_deleting_column.nil?
182
+ invalid_properties.push("invalid value for 'allow_deleting_column', allow_deleting_column cannot be nil.")
183
+ end
184
+ if @allow_deleting_row.nil?
185
+ invalid_properties.push("invalid value for 'allow_deleting_row', allow_deleting_row cannot be nil.")
186
+ end
187
+ if @allow_filtering.nil?
188
+ invalid_properties.push("invalid value for 'allow_filtering', allow_filtering cannot be nil.")
189
+ end
190
+ if @allow_formatting_cell.nil?
191
+ invalid_properties.push("invalid value for 'allow_formatting_cell', allow_formatting_cell cannot be nil.")
192
+ end
193
+ if @allow_formatting_column.nil?
194
+ invalid_properties.push("invalid value for 'allow_formatting_column', allow_formatting_column cannot be nil.")
195
+ end
196
+ if @allow_formatting_row.nil?
197
+ invalid_properties.push("invalid value for 'allow_formatting_row', allow_formatting_row cannot be nil.")
198
+ end
199
+ if @allow_inserting_column.nil?
200
+ invalid_properties.push("invalid value for 'allow_inserting_column', allow_inserting_column cannot be nil.")
201
+ end
202
+ if @allow_inserting_hyperlink.nil?
203
+ invalid_properties.push("invalid value for 'allow_inserting_hyperlink', allow_inserting_hyperlink cannot be nil.")
204
+ end
205
+ if @allow_inserting_row.nil?
206
+ invalid_properties.push("invalid value for 'allow_inserting_row', allow_inserting_row cannot be nil.")
207
+ end
208
+ if @allow_sorting.nil?
209
+ invalid_properties.push("invalid value for 'allow_sorting', allow_sorting cannot be nil.")
210
+ end
211
+ if @allow_using_pivot_table.nil?
212
+ invalid_properties.push("invalid value for 'allow_using_pivot_table', allow_using_pivot_table cannot be nil.")
213
+ end
214
+ if @allow_editing_content.nil?
215
+ invalid_properties.push("invalid value for 'allow_editing_content', allow_editing_content cannot be nil.")
216
+ end
217
+ if @allow_editing_object.nil?
218
+ invalid_properties.push("invalid value for 'allow_editing_object', allow_editing_object cannot be nil.")
219
+ end
220
+ if @allow_editing_scenario.nil?
221
+ invalid_properties.push("invalid value for 'allow_editing_scenario', allow_editing_scenario cannot be nil.")
222
+ end
223
+ if @password.nil?
224
+ invalid_properties.push("invalid value for 'password', password cannot be nil.")
225
+ end
226
+ if @allow_selecting_locked_cell.nil?
227
+ invalid_properties.push("invalid value for 'allow_selecting_locked_cell', allow_selecting_locked_cell cannot be nil.")
228
+ end
229
+ if @allow_selecting_unlocked_cell.nil?
230
+ invalid_properties.push("invalid value for 'allow_selecting_unlocked_cell', allow_selecting_unlocked_cell cannot be nil.")
231
+ end
232
+
233
+ return invalid_properties
234
+ end
235
+
236
+ # Check to see if the all the properties in the model are valid
237
+ # @return true if the model is valid
238
+ def valid?
239
+ return false if @allow_deleting_column.nil?
240
+ return false if @allow_deleting_row.nil?
241
+ return false if @allow_filtering.nil?
242
+ return false if @allow_formatting_cell.nil?
243
+ return false if @allow_formatting_column.nil?
244
+ return false if @allow_formatting_row.nil?
245
+ return false if @allow_inserting_column.nil?
246
+ return false if @allow_inserting_hyperlink.nil?
247
+ return false if @allow_inserting_row.nil?
248
+ return false if @allow_sorting.nil?
249
+ return false if @allow_using_pivot_table.nil?
250
+ return false if @allow_editing_content.nil?
251
+ return false if @allow_editing_object.nil?
252
+ return false if @allow_editing_scenario.nil?
253
+ return false if @password.nil?
254
+ return false if @allow_selecting_locked_cell.nil?
255
+ return false if @allow_selecting_unlocked_cell.nil?
256
+ return true
257
+ end
258
+
259
+ # Checks equality by comparing each attribute.
260
+ # @param [Object] Object to be compared
261
+ def ==(o)
262
+ return true if self.equal?(o)
263
+ self.class == o.class &&
264
+ allow_deleting_column == o.allow_deleting_column &&
265
+ allow_deleting_row == o.allow_deleting_row &&
266
+ allow_filtering == o.allow_filtering &&
267
+ allow_formatting_cell == o.allow_formatting_cell &&
268
+ allow_formatting_column == o.allow_formatting_column &&
269
+ allow_formatting_row == o.allow_formatting_row &&
270
+ allow_inserting_column == o.allow_inserting_column &&
271
+ allow_inserting_hyperlink == o.allow_inserting_hyperlink &&
272
+ allow_inserting_row == o.allow_inserting_row &&
273
+ allow_sorting == o.allow_sorting &&
274
+ allow_using_pivot_table == o.allow_using_pivot_table &&
275
+ allow_editing_content == o.allow_editing_content &&
276
+ allow_editing_object == o.allow_editing_object &&
277
+ allow_editing_scenario == o.allow_editing_scenario &&
278
+ password == o.password &&
279
+ allow_selecting_locked_cell == o.allow_selecting_locked_cell &&
280
+ allow_selecting_unlocked_cell == o.allow_selecting_unlocked_cell
281
+ std_dev == o.std_dev
282
+ end
283
+
284
+ # @see the `==` method
285
+ # @param [Object] Object to be compared
286
+ def eql?(o)
287
+ self == o
288
+ end
289
+
290
+ # Calculates hash code according to all attributes.
291
+ # @return [Fixnum] Hash code
292
+ def hash
293
+ [ allow_deleting_column , allow_deleting_row , allow_filtering , allow_formatting_cell , allow_formatting_column , allow_formatting_row , allow_inserting_column , allow_inserting_hyperlink , allow_inserting_row , allow_sorting , allow_using_pivot_table , allow_editing_content , allow_editing_object , allow_editing_scenario , password , allow_selecting_locked_cell , allow_selecting_unlocked_cell ].hash
294
+ end
295
+
296
+ # Builds the object from hash
297
+ # @param [Hash] attributes Model attributes in the form of hash
298
+ # @return [Object] Returns the model itself
299
+ def build_from_hash(attributes)
300
+ return nil unless attributes.is_a?(Hash)
301
+ self.class.swagger_types.each_pair do |key, type|
302
+ if type =~ /\AArray<(.*)>/i
303
+ # check to ensure the input is an array given that the the attribute
304
+ # is documented as an array but the input is not
305
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
306
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
307
+ end
308
+ elsif !attributes[self.class.attribute_map[key]].nil?
309
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
310
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
311
+ end
312
+
313
+ self
314
+ end
315
+
316
+ # Deserializes the data based on type
317
+ # @param string type Data type
318
+ # @param string value Value to be deserialized
319
+ # @return [Object] Deserialized data
320
+ def _deserialize(type, value)
321
+ case type.to_sym
322
+ when :DateTime
323
+ DateTime.parse(value)
324
+ when :Date
325
+ Date.parse(value)
326
+ when :String
327
+ value.to_s
328
+ when :Integer
329
+ value.to_i
330
+ when :Float
331
+ value.to_f
332
+ when :BOOLEAN
333
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
334
+ true
335
+ else
336
+ false
337
+ end
338
+ when :Object
339
+ # generic object (usually a Hash), return directly
340
+ value
341
+ when /\AArray<(?<inner_type>.+)>\z/
342
+ inner_type = Regexp.last_match[:inner_type]
343
+ value.map { |v| _deserialize(inner_type, v) }
344
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
345
+ k_type = Regexp.last_match[:k_type]
346
+ v_type = Regexp.last_match[:v_type]
347
+ {}.tap do |hash|
348
+ value.each do |k, v|
349
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
350
+ end
351
+ end
352
+ else # model
353
+ temp_model = AsposeCellsCloud.const_get(type).new
354
+ temp_model.build_from_hash(value)
355
+ end
356
+ end
357
+
358
+ # Returns the string representation of the object
359
+ # @return [String] String presentation of the object
360
+ def to_s
361
+ to_hash.to_s
362
+ end
363
+
364
+ # to_body is an alias to to_hash (backward compatibility)
365
+ # @return [Hash] Returns the object in the form of hash
366
+ def to_body
367
+ to_hash
368
+ end
369
+
370
+ # Returns the object in the form of hash
371
+ # @return [Hash] Returns the object in the form of hash
372
+ def to_hash
373
+ hash = {}
374
+ self.class.attribute_map.each_pair do |attr, param|
375
+ value = self.send(attr)
376
+ next if value.nil?
377
+ hash[param] = _to_hash(value)
378
+ end
379
+ hash
380
+ end
381
+
382
+ # Outputs non-array value in the form of hash
383
+ # For object, use to_hash. Otherwise, just return the value
384
+ # @param [Object] value Any valid value
385
+ # @return [Hash] Returns the value in the form of hash
386
+ def _to_hash(value)
387
+ if value.is_a?(Array)
388
+ value.compact.map{ |v| _to_hash(v) }
389
+ elsif value.is_a?(Hash)
390
+ {}.tap do |hash|
391
+ value.each { |k, v| hash[k] = _to_hash(v) }
392
+ end
393
+ elsif value.respond_to? :to_hash
394
+ value.to_hash
395
+ else
396
+ value
397
+ end
398
+ end
399
+
400
+ end
401
+
402
+ end
@@ -0,0 +1,258 @@
1
+ =begin
2
+ --------------------------------------------------------------------------------------------------------------------
3
+ <copyright company="Aspose" file="RenderingFontrb.cs">
4
+ Copyright (c) 2023 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 RenderingFont
34
+ #
35
+ attr_accessor :name
36
+ #
37
+ attr_accessor :size
38
+ #
39
+ attr_accessor :bold
40
+ #
41
+ attr_accessor :italic
42
+ #
43
+ attr_accessor :color
44
+
45
+ # Attribute mapping from ruby-style variable name to JSON key.
46
+ def self.attribute_map
47
+ {
48
+ :'name' => :'Name',
49
+ :'size' => :'Size',
50
+ :'bold' => :'Bold',
51
+ :'italic' => :'Italic',
52
+ :'color' => :'Color'
53
+ }
54
+ end
55
+
56
+ # Attribute type mapping.
57
+ def self.swagger_types
58
+ {
59
+ :'name' => :'String',
60
+ :'size' => :'Float',
61
+ :'bold' => :'BOOLEAN',
62
+ :'italic' => :'BOOLEAN',
63
+ :'color' => :'Color'
64
+ }
65
+ end
66
+
67
+ # Initializes the object
68
+ # @param [Hash] attributes Model attributes in the form of hash
69
+ def initialize(attributes = {})
70
+ return unless attributes.is_a?(Hash)
71
+
72
+ # convert string to symbol for hash key
73
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
74
+
75
+ if attributes.has_key?(:'Name')
76
+ self.name = attributes[:'Name']
77
+ end
78
+ if attributes.has_key?(:'Size')
79
+ self.size = attributes[:'Size']
80
+ end
81
+ if attributes.has_key?(:'Bold')
82
+ self.bold = attributes[:'Bold']
83
+ end
84
+ if attributes.has_key?(:'Italic')
85
+ self.italic = attributes[:'Italic']
86
+ end
87
+ if attributes.has_key?(:'Color')
88
+ self.color = attributes[:'Color']
89
+ end
90
+
91
+ end
92
+
93
+ # Show invalid properties with the reasons. Usually used together with valid?
94
+ # @return Array for valid properies with the reasons
95
+ def list_invalid_properties
96
+ invalid_properties = Array.new
97
+ if @name.nil?
98
+ invalid_properties.push("invalid value for 'name', name cannot be nil.")
99
+ end
100
+ if @size.nil?
101
+ invalid_properties.push("invalid value for 'size', size cannot be nil.")
102
+ end
103
+ if @bold.nil?
104
+ invalid_properties.push("invalid value for 'bold', bold cannot be nil.")
105
+ end
106
+ if @italic.nil?
107
+ invalid_properties.push("invalid value for 'italic', italic cannot be nil.")
108
+ end
109
+ if @color.nil?
110
+ invalid_properties.push("invalid value for 'color', color cannot be nil.")
111
+ end
112
+
113
+ return invalid_properties
114
+ end
115
+
116
+ # Check to see if the all the properties in the model are valid
117
+ # @return true if the model is valid
118
+ def valid?
119
+ return false if @name.nil?
120
+ return false if @size.nil?
121
+ return false if @bold.nil?
122
+ return false if @italic.nil?
123
+ return false if @color.nil?
124
+ return true
125
+ end
126
+
127
+ # Checks equality by comparing each attribute.
128
+ # @param [Object] Object to be compared
129
+ def ==(o)
130
+ return true if self.equal?(o)
131
+ self.class == o.class &&
132
+ name == o.name &&
133
+ size == o.size &&
134
+ bold == o.bold &&
135
+ italic == o.italic &&
136
+ color == o.color
137
+ std_dev == o.std_dev
138
+ end
139
+
140
+ # @see the `==` method
141
+ # @param [Object] Object to be compared
142
+ def eql?(o)
143
+ self == o
144
+ end
145
+
146
+ # Calculates hash code according to all attributes.
147
+ # @return [Fixnum] Hash code
148
+ def hash
149
+ [ name , size , bold , italic , color ].hash
150
+ end
151
+
152
+ # Builds the object from hash
153
+ # @param [Hash] attributes Model attributes in the form of hash
154
+ # @return [Object] Returns the model itself
155
+ def build_from_hash(attributes)
156
+ return nil unless attributes.is_a?(Hash)
157
+ self.class.swagger_types.each_pair do |key, type|
158
+ if type =~ /\AArray<(.*)>/i
159
+ # check to ensure the input is an array given that the the attribute
160
+ # is documented as an array but the input is not
161
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
162
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
163
+ end
164
+ elsif !attributes[self.class.attribute_map[key]].nil?
165
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
166
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
167
+ end
168
+
169
+ self
170
+ end
171
+
172
+ # Deserializes the data based on type
173
+ # @param string type Data type
174
+ # @param string value Value to be deserialized
175
+ # @return [Object] Deserialized data
176
+ def _deserialize(type, value)
177
+ case type.to_sym
178
+ when :DateTime
179
+ DateTime.parse(value)
180
+ when :Date
181
+ Date.parse(value)
182
+ when :String
183
+ value.to_s
184
+ when :Integer
185
+ value.to_i
186
+ when :Float
187
+ value.to_f
188
+ when :BOOLEAN
189
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
190
+ true
191
+ else
192
+ false
193
+ end
194
+ when :Object
195
+ # generic object (usually a Hash), return directly
196
+ value
197
+ when /\AArray<(?<inner_type>.+)>\z/
198
+ inner_type = Regexp.last_match[:inner_type]
199
+ value.map { |v| _deserialize(inner_type, v) }
200
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
201
+ k_type = Regexp.last_match[:k_type]
202
+ v_type = Regexp.last_match[:v_type]
203
+ {}.tap do |hash|
204
+ value.each do |k, v|
205
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
206
+ end
207
+ end
208
+ else # model
209
+ temp_model = AsposeCellsCloud.const_get(type).new
210
+ temp_model.build_from_hash(value)
211
+ end
212
+ end
213
+
214
+ # Returns the string representation of the object
215
+ # @return [String] String presentation of the object
216
+ def to_s
217
+ to_hash.to_s
218
+ end
219
+
220
+ # to_body is an alias to to_hash (backward compatibility)
221
+ # @return [Hash] Returns the object in the form of hash
222
+ def to_body
223
+ to_hash
224
+ end
225
+
226
+ # Returns the object in the form of hash
227
+ # @return [Hash] Returns the object in the form of hash
228
+ def to_hash
229
+ hash = {}
230
+ self.class.attribute_map.each_pair do |attr, param|
231
+ value = self.send(attr)
232
+ next if value.nil?
233
+ hash[param] = _to_hash(value)
234
+ end
235
+ hash
236
+ end
237
+
238
+ # Outputs non-array value in the form of hash
239
+ # For object, use to_hash. Otherwise, just return the value
240
+ # @param [Object] value Any valid value
241
+ # @return [Hash] Returns the value in the form of hash
242
+ def _to_hash(value)
243
+ if value.is_a?(Array)
244
+ value.compact.map{ |v| _to_hash(v) }
245
+ elsif value.is_a?(Hash)
246
+ {}.tap do |hash|
247
+ value.each { |k, v| hash[k] = _to_hash(v) }
248
+ end
249
+ elsif value.respond_to? :to_hash
250
+ value.to_hash
251
+ else
252
+ value
253
+ end
254
+ end
255
+
256
+ end
257
+
258
+ end