aspose_slides_cloud 21.12.1 → 22.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +9 -40
  3. data/TestData/test-unprotected.pptx +0 -0
  4. data/TestData/test.pptx +0 -0
  5. data/aspose_slides_cloud.gemspec +1 -1
  6. data/lib/aspose_slides_cloud/api/slides_api.rb +442 -30
  7. data/lib/aspose_slides_cloud/api_client.rb +1 -1
  8. data/lib/aspose_slides_cloud/configuration.rb +1 -1
  9. data/lib/aspose_slides_cloud/models/accent_element.rb +239 -0
  10. data/lib/aspose_slides_cloud/models/arc_to_path_segment.rb +279 -0
  11. data/lib/aspose_slides_cloud/models/array_element.rb +305 -0
  12. data/lib/aspose_slides_cloud/models/audio_frame.rb +26 -4
  13. data/lib/aspose_slides_cloud/models/bar_element.rb +251 -0
  14. data/lib/aspose_slides_cloud/models/block_element.rb +231 -0
  15. data/lib/aspose_slides_cloud/models/border_box_element.rb +309 -0
  16. data/lib/aspose_slides_cloud/models/box_element.rb +279 -0
  17. data/lib/aspose_slides_cloud/models/chart.rb +3 -1
  18. data/lib/aspose_slides_cloud/models/close_path_segment.rb +219 -0
  19. data/lib/aspose_slides_cloud/models/connector.rb +3 -1
  20. data/lib/aspose_slides_cloud/models/cubic_bezier_to_path_segment.rb +309 -0
  21. data/lib/aspose_slides_cloud/models/delimiter_element.rb +293 -0
  22. data/lib/aspose_slides_cloud/models/export_format.rb +1 -0
  23. data/lib/aspose_slides_cloud/models/fraction_element.rb +261 -0
  24. data/lib/aspose_slides_cloud/models/function_element.rb +239 -0
  25. data/lib/aspose_slides_cloud/models/geometry_path.rb +263 -0
  26. data/lib/aspose_slides_cloud/models/geometry_paths.rb +209 -0
  27. data/lib/aspose_slides_cloud/models/geometry_shape.rb +3 -1
  28. data/lib/aspose_slides_cloud/models/gif_export_options.rb +230 -0
  29. data/lib/aspose_slides_cloud/models/graphical_object.rb +3 -1
  30. data/lib/aspose_slides_cloud/models/group_shape.rb +3 -1
  31. data/lib/aspose_slides_cloud/models/grouping_character_element.rb +283 -0
  32. data/lib/aspose_slides_cloud/models/hyperlink.rb +348 -0
  33. data/lib/aspose_slides_cloud/models/left_sub_superscript_element.rb +249 -0
  34. data/lib/aspose_slides_cloud/models/limit_element.rb +249 -0
  35. data/lib/aspose_slides_cloud/models/line_to_path_segment.rb +249 -0
  36. data/lib/aspose_slides_cloud/models/math_element.rb +240 -0
  37. data/lib/aspose_slides_cloud/models/math_paragraph.rb +253 -0
  38. data/lib/aspose_slides_cloud/models/matrix_element.rb +337 -0
  39. data/lib/aspose_slides_cloud/models/move_to_path_segment.rb +249 -0
  40. data/lib/aspose_slides_cloud/models/nary_operator_element.rb +311 -0
  41. data/lib/aspose_slides_cloud/models/ole_object_frame.rb +3 -1
  42. data/lib/aspose_slides_cloud/models/path_segment.rb +240 -0
  43. data/lib/aspose_slides_cloud/models/picture_frame.rb +3 -1
  44. data/lib/aspose_slides_cloud/models/portion.rb +32 -2
  45. data/lib/aspose_slides_cloud/models/quadratic_bezier_to_path_segment.rb +279 -0
  46. data/lib/aspose_slides_cloud/models/radical_element.rb +249 -0
  47. data/lib/aspose_slides_cloud/models/right_sub_superscript_element.rb +259 -0
  48. data/lib/aspose_slides_cloud/models/save.rb +2 -2
  49. data/lib/aspose_slides_cloud/models/save_slide.rb +2 -2
  50. data/lib/aspose_slides_cloud/models/shape.rb +3 -1
  51. data/lib/aspose_slides_cloud/models/shape_base.rb +21 -1
  52. data/lib/aspose_slides_cloud/models/slide_export_format.rb +1 -0
  53. data/lib/aspose_slides_cloud/models/smart_art.rb +3 -1
  54. data/lib/aspose_slides_cloud/models/smart_art_shape.rb +3 -1
  55. data/lib/aspose_slides_cloud/models/subscript_element.rb +239 -0
  56. data/lib/aspose_slides_cloud/models/superscript_element.rb +239 -0
  57. data/lib/aspose_slides_cloud/models/table.rb +3 -1
  58. data/lib/aspose_slides_cloud/models/text_element.rb +229 -0
  59. data/lib/aspose_slides_cloud/models/video_frame.rb +5 -3
  60. data/lib/aspose_slides_cloud/models/xaml_export_options.rb +210 -0
  61. data/lib/aspose_slides_cloud/type_registry.rb +72 -0
  62. data/lib/aspose_slides_cloud/version.rb +1 -1
  63. data/lib/aspose_slides_cloud.rb +33 -0
  64. data/spec/api/slides_api_spec.rb +1203 -4
  65. data/spec/spec_utils.rb +7 -1
  66. data/testRules.json +9 -0
  67. metadata +39 -6
@@ -0,0 +1,337 @@
1
+ =begin
2
+ Copyright (c) 2019 Aspose Pty Ltd
3
+
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
+ =end
22
+
23
+ require 'date'
24
+
25
+ module AsposeSlidesCloud
26
+ # Specifies the Matrix object,
27
+ class MatrixElement < MathElement
28
+ # Hide the placeholders for empty matrix elements
29
+ attr_accessor :hide_placeholders
30
+
31
+ # Specifies the vertical justification respect to surrounding text.
32
+ attr_accessor :base_justification
33
+
34
+ # Minimum column width in twips (1/20th of a point)
35
+ attr_accessor :min_column_width
36
+
37
+ # The type of horizontal spacing between columns of a matrix.
38
+ attr_accessor :column_gap_rule
39
+
40
+ # The value of horizontal spacing between columns of a matrix
41
+ attr_accessor :column_gap
42
+
43
+ # The type of vertical spacing between rows of a matrix
44
+ attr_accessor :row_gap_rule
45
+
46
+ # The value of vertical spacing between rows of a matrix;
47
+ attr_accessor :row_gap
48
+
49
+ # Matrix items
50
+ attr_accessor :items
51
+
52
+ class EnumAttributeValidator
53
+ attr_reader :datatype
54
+ attr_reader :allowable_values
55
+
56
+ def initialize(datatype, allowable_values)
57
+ @allowable_values = allowable_values.map do |value|
58
+ case datatype.to_s
59
+ when /Integer/i
60
+ value.to_i
61
+ when /Float/i
62
+ value.to_f
63
+ else
64
+ value
65
+ end
66
+ end
67
+ end
68
+
69
+ def valid?(value)
70
+ !value || allowable_values.any?{ |s| s.casecmp(value) == 0 }
71
+ end
72
+ end
73
+
74
+ # Attribute mapping from ruby-style variable name to JSON key.
75
+ def self.attribute_map
76
+ super.merge({
77
+ :'hide_placeholders' => :'HidePlaceholders',
78
+ :'base_justification' => :'BaseJustification',
79
+ :'min_column_width' => :'MinColumnWidth',
80
+ :'column_gap_rule' => :'ColumnGapRule',
81
+ :'column_gap' => :'ColumnGap',
82
+ :'row_gap_rule' => :'RowGapRule',
83
+ :'row_gap' => :'RowGap',
84
+ :'items' => :'Items',
85
+ })
86
+ end
87
+
88
+ # Attribute type mapping.
89
+ def self.swagger_types
90
+ super.merge({
91
+ :'hide_placeholders' => :'BOOLEAN',
92
+ :'base_justification' => :'String',
93
+ :'min_column_width' => :'Integer',
94
+ :'column_gap_rule' => :'String',
95
+ :'column_gap' => :'Integer',
96
+ :'row_gap_rule' => :'String',
97
+ :'row_gap' => :'Integer',
98
+ :'items' => :'Array<Array<MathElement>>',
99
+ })
100
+ end
101
+
102
+ # Initializes the object
103
+ # @param [Hash] attributes Model attributes in the form of hash
104
+ def initialize(attributes = {})
105
+ super
106
+
107
+ if attributes.has_key?(:'HidePlaceholders')
108
+ self.hide_placeholders = attributes[:'HidePlaceholders']
109
+ end
110
+
111
+ if attributes.has_key?(:'BaseJustification')
112
+ self.base_justification = attributes[:'BaseJustification']
113
+ end
114
+
115
+ if attributes.has_key?(:'MinColumnWidth')
116
+ self.min_column_width = attributes[:'MinColumnWidth']
117
+ end
118
+
119
+ if attributes.has_key?(:'ColumnGapRule')
120
+ self.column_gap_rule = attributes[:'ColumnGapRule']
121
+ end
122
+
123
+ if attributes.has_key?(:'ColumnGap')
124
+ self.column_gap = attributes[:'ColumnGap']
125
+ end
126
+
127
+ if attributes.has_key?(:'RowGapRule')
128
+ self.row_gap_rule = attributes[:'RowGapRule']
129
+ end
130
+
131
+ if attributes.has_key?(:'RowGap')
132
+ self.row_gap = attributes[:'RowGap']
133
+ end
134
+
135
+ if attributes.has_key?(:'Items')
136
+ if (value = attributes[:'Items']).is_a?(Array)
137
+ self.items = value
138
+ end
139
+ end
140
+ self.type = "Matrix"
141
+ end
142
+
143
+ # Show invalid properties with the reasons. Usually used together with valid?
144
+ # @return Array for valid properties with the reasons
145
+ def list_invalid_properties
146
+ invalid_properties = super
147
+ invalid_properties
148
+ end
149
+
150
+ # Check to see if the all the properties in the model are valid
151
+ # @return true if the model is valid
152
+ def valid?
153
+ return false if !super
154
+ base_justification_validator = EnumAttributeValidator.new('String', ['NotDefined', 'Top', 'Center', 'Bottom'])
155
+ return false unless base_justification_validator.valid?(@base_justification)
156
+ column_gap_rule_validator = EnumAttributeValidator.new('String', ['SingleSpacingGap', 'OneAndHalfSpacingGap', 'DoubleSpacingGap', 'Exactly', 'Multiple'])
157
+ return false unless column_gap_rule_validator.valid?(@column_gap_rule)
158
+ row_gap_rule_validator = EnumAttributeValidator.new('String', ['SingleSpacingGap', 'OneAndHalfSpacingGap', 'DoubleSpacingGap', 'Exactly', 'Multiple'])
159
+ return false unless row_gap_rule_validator.valid?(@row_gap_rule)
160
+ true
161
+ end
162
+
163
+ # Custom attribute writer method checking allowed values (enum).
164
+ # @param [Object] base_justification Object to be assigned
165
+ def base_justification=(base_justification)
166
+ validator = EnumAttributeValidator.new('String', ['NotDefined', 'Top', 'Center', 'Bottom'])
167
+ unless validator.valid?(base_justification)
168
+ fail ArgumentError, 'invalid value for "base_justification", must be one of #{validator.allowable_values}.'
169
+ end
170
+ @base_justification = base_justification
171
+ end
172
+
173
+ # Custom attribute writer method checking allowed values (enum).
174
+ # @param [Object] column_gap_rule Object to be assigned
175
+ def column_gap_rule=(column_gap_rule)
176
+ validator = EnumAttributeValidator.new('String', ['SingleSpacingGap', 'OneAndHalfSpacingGap', 'DoubleSpacingGap', 'Exactly', 'Multiple'])
177
+ unless validator.valid?(column_gap_rule)
178
+ fail ArgumentError, 'invalid value for "column_gap_rule", must be one of #{validator.allowable_values}.'
179
+ end
180
+ @column_gap_rule = column_gap_rule
181
+ end
182
+
183
+ # Custom attribute writer method checking allowed values (enum).
184
+ # @param [Object] row_gap_rule Object to be assigned
185
+ def row_gap_rule=(row_gap_rule)
186
+ validator = EnumAttributeValidator.new('String', ['SingleSpacingGap', 'OneAndHalfSpacingGap', 'DoubleSpacingGap', 'Exactly', 'Multiple'])
187
+ unless validator.valid?(row_gap_rule)
188
+ fail ArgumentError, 'invalid value for "row_gap_rule", must be one of #{validator.allowable_values}.'
189
+ end
190
+ @row_gap_rule = row_gap_rule
191
+ end
192
+
193
+ # Checks equality by comparing each attribute.
194
+ # @param [Object] Object to be compared
195
+ def ==(o)
196
+ return true if self.equal?(o)
197
+ self.class == o.class &&
198
+ type == o.type &&
199
+ hide_placeholders == o.hide_placeholders &&
200
+ base_justification == o.base_justification &&
201
+ min_column_width == o.min_column_width &&
202
+ column_gap_rule == o.column_gap_rule &&
203
+ column_gap == o.column_gap &&
204
+ row_gap_rule == o.row_gap_rule &&
205
+ row_gap == o.row_gap &&
206
+ items == o.items
207
+ end
208
+
209
+ # @see the `==` method
210
+ # @param [Object] Object to be compared
211
+ def eql?(o)
212
+ self == o
213
+ end
214
+
215
+ # Calculates hash code according to all attributes.
216
+ # @return [Fixnum] Hash code
217
+ def hash
218
+ [type, hide_placeholders, base_justification, min_column_width, column_gap_rule, column_gap, row_gap_rule, row_gap, items].hash
219
+ end
220
+
221
+ # Builds the object from hash
222
+ # @param [Hash] attributes Model attributes in the form of hash
223
+ # @return [Object] Returns the model itself
224
+ def build_from_hash(attributes)
225
+ return nil unless attributes.is_a?(Hash)
226
+ self.class.swagger_types.each_pair do |key, type|
227
+ mapKey = self.class.attribute_map[key]
228
+ if !mapKey.nil?
229
+ val = attributes[mapKey]
230
+ if val.nil?
231
+ mapKeyString = mapKey.to_s
232
+ mapKeyString[0] = mapKeyString[0].downcase
233
+ mapKey = mapKeyString.to_sym
234
+ val = attributes[mapKey]
235
+ end
236
+ if !val.nil?
237
+ if type =~ /\AArray<(.*)>/i
238
+ # check to ensure the input is an array given that the the attribute
239
+ # is documented as an array but the input is not
240
+ if val.is_a?(Array)
241
+ self.send("#{key}=", val.map { |v| _deserialize($1, v) })
242
+ end
243
+ else
244
+ self.send("#{key}=", _deserialize(type, val))
245
+ end
246
+ end
247
+ end
248
+ end
249
+
250
+ self
251
+ end
252
+
253
+ # Deserializes the data based on type
254
+ # @param string type Data type
255
+ # @param string value Value to be deserialized
256
+ # @return [Object] Deserialized data
257
+ def _deserialize(type, value)
258
+ case type.to_sym
259
+ when :DateTime
260
+ DateTime.parse(value)
261
+ when :Date
262
+ Date.parse(value)
263
+ when :String
264
+ value.to_s
265
+ when :Integer
266
+ value.to_i
267
+ when :Float
268
+ value.to_f
269
+ when :BOOLEAN
270
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
271
+ true
272
+ else
273
+ false
274
+ end
275
+ when :Object
276
+ # generic object (usually a Hash), return directly
277
+ value
278
+ when /\AArray<(?<inner_type>.+)>\z/
279
+ inner_type = Regexp.last_match[:inner_type]
280
+ value.map { |v| _deserialize(inner_type, v) }
281
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
282
+ k_type = Regexp.last_match[:k_type]
283
+ v_type = Regexp.last_match[:v_type]
284
+ {}.tap do |hash|
285
+ value.each do |k, v|
286
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
287
+ end
288
+ end
289
+ else # model
290
+ temp_model = AsposeSlidesCloud.const_get(type).new
291
+ temp_model.build_from_hash(value)
292
+ end
293
+ end
294
+
295
+ # Returns the string representation of the object
296
+ # @return [String] String presentation of the object
297
+ def to_s
298
+ to_hash.to_s
299
+ end
300
+
301
+ # to_body is an alias to to_hash (backward compatibility)
302
+ # @return [Hash] Returns the object in the form of hash
303
+ def to_body
304
+ to_hash
305
+ end
306
+
307
+ # Returns the object in the form of hash
308
+ # @return [Hash] Returns the object in the form of hash
309
+ def to_hash
310
+ hash = {}
311
+ self.class.attribute_map.each_pair do |attr, param|
312
+ value = self.send(attr)
313
+ next if value.nil?
314
+ hash[param] = _to_hash(value)
315
+ end
316
+ hash
317
+ end
318
+
319
+ # Outputs non-array value in the form of hash
320
+ # For object, use to_hash. Otherwise, just return the value
321
+ # @param [Object] value Any valid value
322
+ # @return [Hash] Returns the value in the form of hash
323
+ def _to_hash(value)
324
+ if value.is_a?(Array)
325
+ value.compact.map { |v| _to_hash(v) }
326
+ elsif value.is_a?(Hash)
327
+ {}.tap do |hash|
328
+ value.each { |k, v| hash[k] = _to_hash(v) }
329
+ end
330
+ elsif value.respond_to? :to_hash
331
+ value.to_hash
332
+ else
333
+ value
334
+ end
335
+ end
336
+ end
337
+ end
@@ -0,0 +1,249 @@
1
+ =begin
2
+ Copyright (c) 2019 Aspose Pty Ltd
3
+
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
+ =end
22
+
23
+ require 'date'
24
+
25
+ module AsposeSlidesCloud
26
+ # MoveTo segment of the geometry path
27
+ class MoveToPathSegment < PathSegment
28
+ # X coordinate of the point.
29
+ attr_accessor :x
30
+
31
+ # Y coordinate of the point.
32
+ attr_accessor :y
33
+
34
+ class EnumAttributeValidator
35
+ attr_reader :datatype
36
+ attr_reader :allowable_values
37
+
38
+ def initialize(datatype, allowable_values)
39
+ @allowable_values = allowable_values.map do |value|
40
+ case datatype.to_s
41
+ when /Integer/i
42
+ value.to_i
43
+ when /Float/i
44
+ value.to_f
45
+ else
46
+ value
47
+ end
48
+ end
49
+ end
50
+
51
+ def valid?(value)
52
+ !value || allowable_values.any?{ |s| s.casecmp(value) == 0 }
53
+ end
54
+ end
55
+
56
+ # Attribute mapping from ruby-style variable name to JSON key.
57
+ def self.attribute_map
58
+ super.merge({
59
+ :'x' => :'X',
60
+ :'y' => :'Y',
61
+ })
62
+ end
63
+
64
+ # Attribute type mapping.
65
+ def self.swagger_types
66
+ super.merge({
67
+ :'x' => :'Float',
68
+ :'y' => :'Float',
69
+ })
70
+ end
71
+
72
+ # Initializes the object
73
+ # @param [Hash] attributes Model attributes in the form of hash
74
+ def initialize(attributes = {})
75
+ super
76
+
77
+ if attributes.has_key?(:'X')
78
+ self.x = attributes[:'X']
79
+ end
80
+
81
+ if attributes.has_key?(:'Y')
82
+ self.y = attributes[:'Y']
83
+ end
84
+ self.type = "MoveTo"
85
+ end
86
+
87
+ # Show invalid properties with the reasons. Usually used together with valid?
88
+ # @return Array for valid properties with the reasons
89
+ def list_invalid_properties
90
+ invalid_properties = super
91
+ if @x.nil?
92
+ invalid_properties.push('invalid value for "x", x cannot be nil.')
93
+ end
94
+
95
+ if @y.nil?
96
+ invalid_properties.push('invalid value for "y", y cannot be nil.')
97
+ end
98
+
99
+ invalid_properties
100
+ end
101
+
102
+ # Check to see if the all the properties in the model are valid
103
+ # @return true if the model is valid
104
+ def valid?
105
+ return false if !super
106
+ return false if @x.nil?
107
+ return false if @y.nil?
108
+ true
109
+ end
110
+
111
+ # Checks equality by comparing each attribute.
112
+ # @param [Object] Object to be compared
113
+ def ==(o)
114
+ return true if self.equal?(o)
115
+ self.class == o.class &&
116
+ type == o.type &&
117
+ x == o.x &&
118
+ y == o.y
119
+ end
120
+
121
+ # @see the `==` method
122
+ # @param [Object] Object to be compared
123
+ def eql?(o)
124
+ self == o
125
+ end
126
+
127
+ # Calculates hash code according to all attributes.
128
+ # @return [Fixnum] Hash code
129
+ def hash
130
+ [type, x, y].hash
131
+ end
132
+
133
+ # Builds the object from hash
134
+ # @param [Hash] attributes Model attributes in the form of hash
135
+ # @return [Object] Returns the model itself
136
+ def build_from_hash(attributes)
137
+ return nil unless attributes.is_a?(Hash)
138
+ self.class.swagger_types.each_pair do |key, type|
139
+ mapKey = self.class.attribute_map[key]
140
+ if !mapKey.nil?
141
+ val = attributes[mapKey]
142
+ if val.nil?
143
+ mapKeyString = mapKey.to_s
144
+ mapKeyString[0] = mapKeyString[0].downcase
145
+ mapKey = mapKeyString.to_sym
146
+ val = attributes[mapKey]
147
+ end
148
+ if !val.nil?
149
+ if type =~ /\AArray<(.*)>/i
150
+ # check to ensure the input is an array given that the the attribute
151
+ # is documented as an array but the input is not
152
+ if val.is_a?(Array)
153
+ self.send("#{key}=", val.map { |v| _deserialize($1, v) })
154
+ end
155
+ else
156
+ self.send("#{key}=", _deserialize(type, val))
157
+ end
158
+ end
159
+ end
160
+ end
161
+
162
+ self
163
+ end
164
+
165
+ # Deserializes the data based on type
166
+ # @param string type Data type
167
+ # @param string value Value to be deserialized
168
+ # @return [Object] Deserialized data
169
+ def _deserialize(type, value)
170
+ case type.to_sym
171
+ when :DateTime
172
+ DateTime.parse(value)
173
+ when :Date
174
+ Date.parse(value)
175
+ when :String
176
+ value.to_s
177
+ when :Integer
178
+ value.to_i
179
+ when :Float
180
+ value.to_f
181
+ when :BOOLEAN
182
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
183
+ true
184
+ else
185
+ false
186
+ end
187
+ when :Object
188
+ # generic object (usually a Hash), return directly
189
+ value
190
+ when /\AArray<(?<inner_type>.+)>\z/
191
+ inner_type = Regexp.last_match[:inner_type]
192
+ value.map { |v| _deserialize(inner_type, v) }
193
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
194
+ k_type = Regexp.last_match[:k_type]
195
+ v_type = Regexp.last_match[:v_type]
196
+ {}.tap do |hash|
197
+ value.each do |k, v|
198
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
199
+ end
200
+ end
201
+ else # model
202
+ temp_model = AsposeSlidesCloud.const_get(type).new
203
+ temp_model.build_from_hash(value)
204
+ end
205
+ end
206
+
207
+ # Returns the string representation of the object
208
+ # @return [String] String presentation of the object
209
+ def to_s
210
+ to_hash.to_s
211
+ end
212
+
213
+ # to_body is an alias to to_hash (backward compatibility)
214
+ # @return [Hash] Returns the object in the form of hash
215
+ def to_body
216
+ to_hash
217
+ end
218
+
219
+ # Returns the object in the form of hash
220
+ # @return [Hash] Returns the object in the form of hash
221
+ def to_hash
222
+ hash = {}
223
+ self.class.attribute_map.each_pair do |attr, param|
224
+ value = self.send(attr)
225
+ next if value.nil?
226
+ hash[param] = _to_hash(value)
227
+ end
228
+ hash
229
+ end
230
+
231
+ # Outputs non-array value in the form of hash
232
+ # For object, use to_hash. Otherwise, just return the value
233
+ # @param [Object] value Any valid value
234
+ # @return [Hash] Returns the value in the form of hash
235
+ def _to_hash(value)
236
+ if value.is_a?(Array)
237
+ value.compact.map { |v| _to_hash(v) }
238
+ elsif value.is_a?(Hash)
239
+ {}.tap do |hash|
240
+ value.each { |k, v| hash[k] = _to_hash(v) }
241
+ end
242
+ elsif value.respond_to? :to_hash
243
+ value.to_hash
244
+ else
245
+ value
246
+ end
247
+ end
248
+ end
249
+ end