aspose_slides_cloud 22.2.0 → 22.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +7 -7
  3. data/LICENSE +20 -20
  4. data/README.md +27 -0
  5. data/Rakefile +8 -8
  6. data/TestData/oleObject.xlsx +0 -0
  7. data/TestData/test.pptx +0 -0
  8. data/aspose_slides_cloud.gemspec +56 -56
  9. data/lib/aspose_slides_cloud/api/slides_api.rb +192 -13
  10. data/lib/aspose_slides_cloud/api_error.rb +48 -48
  11. data/lib/aspose_slides_cloud/configuration.rb +188 -188
  12. data/lib/aspose_slides_cloud/models/access_permissions.rb +321 -0
  13. data/lib/aspose_slides_cloud/models/{waterfall_series.rb → alpha_bi_level_effect.rb} +16 -26
  14. data/lib/aspose_slides_cloud/models/alpha_ceiling_effect.rb +223 -0
  15. data/lib/aspose_slides_cloud/models/alpha_floor_effect.rb +223 -0
  16. data/lib/aspose_slides_cloud/models/alpha_inverse_effect.rb +223 -0
  17. data/lib/aspose_slides_cloud/models/alpha_modulate_effect.rb +223 -0
  18. data/lib/aspose_slides_cloud/models/alpha_modulate_fixed_effect.rb +238 -0
  19. data/lib/aspose_slides_cloud/models/alpha_replace_effect.rb +238 -0
  20. data/lib/aspose_slides_cloud/models/audio_frame.rb +12 -3
  21. data/lib/aspose_slides_cloud/models/axis.rb +22 -2
  22. data/lib/aspose_slides_cloud/models/bi_level_effect.rb +238 -0
  23. data/lib/aspose_slides_cloud/models/blur_image_effect.rb +253 -0
  24. data/lib/aspose_slides_cloud/models/chart.rb +1 -2
  25. data/lib/aspose_slides_cloud/models/chart_lines_format.rb +221 -0
  26. data/lib/aspose_slides_cloud/models/color_change_effect.rb +243 -0
  27. data/lib/aspose_slides_cloud/models/color_replace_effect.rb +233 -0
  28. data/lib/aspose_slides_cloud/models/connector.rb +1 -2
  29. data/lib/aspose_slides_cloud/models/duotone_effect.rb +243 -0
  30. data/lib/aspose_slides_cloud/models/export_options.rb +10 -18
  31. data/lib/aspose_slides_cloud/models/fill_overlay_image_effect.rb +260 -0
  32. data/lib/aspose_slides_cloud/models/font_fallback_rule.rb +243 -0
  33. data/lib/aspose_slides_cloud/models/geometry_shape.rb +1 -2
  34. data/lib/aspose_slides_cloud/models/gif_export_options.rb +4 -3
  35. data/lib/aspose_slides_cloud/models/graphical_object.rb +1 -2
  36. data/lib/aspose_slides_cloud/models/{waterfall_chart_data_point.rb → gray_scale_effect.rb} +26 -13
  37. data/lib/aspose_slides_cloud/models/group_shape.rb +12 -3
  38. data/lib/aspose_slides_cloud/models/hsl_effect.rb +268 -0
  39. data/lib/aspose_slides_cloud/models/html5_export_options.rb +2 -3
  40. data/lib/aspose_slides_cloud/models/html_export_options.rb +2 -3
  41. data/lib/aspose_slides_cloud/models/image_export_options.rb +4 -3
  42. data/lib/aspose_slides_cloud/models/image_export_options_base.rb +222 -0
  43. data/lib/aspose_slides_cloud/models/image_transform_effect.rb +244 -0
  44. data/lib/aspose_slides_cloud/models/legend.rb +12 -2
  45. data/lib/aspose_slides_cloud/models/luminance_effect.rb +253 -0
  46. data/lib/aspose_slides_cloud/models/ole_object_frame.rb +72 -3
  47. data/lib/aspose_slides_cloud/models/one_value_chart_data_point.rb +12 -2
  48. data/lib/aspose_slides_cloud/models/one_value_series.rb +74 -2
  49. data/lib/aspose_slides_cloud/models/paragraph.rb +12 -2
  50. data/lib/aspose_slides_cloud/models/pdf_export_options.rb +3 -16
  51. data/lib/aspose_slides_cloud/models/picture_fill.rb +14 -2
  52. data/lib/aspose_slides_cloud/models/picture_frame.rb +1 -2
  53. data/lib/aspose_slides_cloud/models/portion.rb +32 -2
  54. data/lib/aspose_slides_cloud/models/portion_format.rb +633 -0
  55. data/lib/aspose_slides_cloud/models/pptx_export_options.rb +2 -3
  56. data/lib/aspose_slides_cloud/models/resource_uri.rb +22 -2
  57. data/lib/aspose_slides_cloud/models/section_zoom_frame.rb +1 -2
  58. data/lib/aspose_slides_cloud/models/shape.rb +1 -2
  59. data/lib/aspose_slides_cloud/models/shape_base.rb +1 -11
  60. data/lib/aspose_slides_cloud/models/shape_type.rb +54 -0
  61. data/lib/aspose_slides_cloud/models/slide_comment.rb +32 -48
  62. data/lib/aspose_slides_cloud/models/slide_comment_base.rb +286 -0
  63. data/lib/aspose_slides_cloud/models/slide_comments.rb +1 -1
  64. data/lib/aspose_slides_cloud/models/{box_and_whisker_series.rb → slide_modern_comment.rb} +37 -68
  65. data/lib/aspose_slides_cloud/models/smart_art.rb +1 -2
  66. data/lib/aspose_slides_cloud/models/smart_art_node.rb +12 -2
  67. data/lib/aspose_slides_cloud/models/smart_art_shape.rb +1 -2
  68. data/lib/aspose_slides_cloud/models/summary_zoom_frame.rb +1 -2
  69. data/lib/aspose_slides_cloud/models/summary_zoom_section.rb +1 -2
  70. data/lib/aspose_slides_cloud/models/svg_export_options.rb +2 -3
  71. data/lib/aspose_slides_cloud/models/swf_export_options.rb +2 -3
  72. data/lib/aspose_slides_cloud/models/table.rb +1 -2
  73. data/lib/aspose_slides_cloud/models/table_cell.rb +22 -2
  74. data/lib/aspose_slides_cloud/models/text_bounds.rb +261 -0
  75. data/lib/aspose_slides_cloud/models/tiff_export_options.rb +4 -3
  76. data/lib/aspose_slides_cloud/models/tint_effect.rb +253 -0
  77. data/lib/aspose_slides_cloud/models/video_export_options.rb +35 -4
  78. data/lib/aspose_slides_cloud/models/video_frame.rb +12 -3
  79. data/lib/aspose_slides_cloud/models/xaml_export_options.rb +2 -3
  80. data/lib/aspose_slides_cloud/models/xps_export_options.rb +2 -3
  81. data/lib/aspose_slides_cloud/models/zoom_frame.rb +1 -2
  82. data/lib/aspose_slides_cloud/models/zoom_object.rb +2 -2
  83. data/lib/aspose_slides_cloud/type_registry.rb +54 -13
  84. data/lib/aspose_slides_cloud/version.rb +1 -1
  85. data/lib/aspose_slides_cloud.rb +31 -7
  86. data/spec/api/slides_api_spec.rb +585 -33
  87. data/spec/spec_helper.rb +122 -122
  88. data/spec/use_cases/merge_spec.rb +0 -1
  89. data/spec/use_cases/shape_spec.rb +0 -2
  90. data/testRules.json +6 -4
  91. metadata +30 -7
  92. data/Dockerfile +0 -16
  93. data/docker-entrypoint.sh +0 -7
@@ -0,0 +1,268 @@
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
+ # Represents a Hue/Saturation/Luminance effect.
27
+ class HslEffect < ImageTransformEffect
28
+ # Hue
29
+ attr_accessor :hue
30
+
31
+ # Saturation
32
+ attr_accessor :saturation
33
+
34
+ # Luminance
35
+ attr_accessor :luminance
36
+
37
+ class EnumAttributeValidator
38
+ attr_reader :datatype
39
+ attr_reader :allowable_values
40
+
41
+ def initialize(datatype, allowable_values)
42
+ @allowable_values = allowable_values.map do |value|
43
+ case datatype.to_s
44
+ when /Integer/i
45
+ value.to_i
46
+ when /Float/i
47
+ value.to_f
48
+ else
49
+ value
50
+ end
51
+ end
52
+ end
53
+
54
+ def valid?(value)
55
+ !value || allowable_values.any?{ |s| s.casecmp(value) == 0 }
56
+ end
57
+ end
58
+
59
+ # Attribute mapping from ruby-style variable name to JSON key.
60
+ def self.attribute_map
61
+ super.merge({
62
+ :'hue' => :'Hue',
63
+ :'saturation' => :'Saturation',
64
+ :'luminance' => :'Luminance',
65
+ })
66
+ end
67
+
68
+ # Attribute type mapping.
69
+ def self.swagger_types
70
+ super.merge({
71
+ :'hue' => :'Float',
72
+ :'saturation' => :'Float',
73
+ :'luminance' => :'Float',
74
+ })
75
+ end
76
+
77
+ # Initializes the object
78
+ # @param [Hash] attributes Model attributes in the form of hash
79
+ def initialize(attributes = {})
80
+ super
81
+
82
+ if attributes.has_key?(:'Hue')
83
+ self.hue = attributes[:'Hue']
84
+ end
85
+
86
+ if attributes.has_key?(:'Saturation')
87
+ self.saturation = attributes[:'Saturation']
88
+ end
89
+
90
+ if attributes.has_key?(:'Luminance')
91
+ self.luminance = attributes[:'Luminance']
92
+ end
93
+ self.type = "Hsl"
94
+ end
95
+
96
+ # Show invalid properties with the reasons. Usually used together with valid?
97
+ # @return Array for valid properties with the reasons
98
+ def list_invalid_properties
99
+ invalid_properties = super
100
+ if @hue.nil?
101
+ invalid_properties.push('invalid value for "hue", hue cannot be nil.')
102
+ end
103
+
104
+ if @saturation.nil?
105
+ invalid_properties.push('invalid value for "saturation", saturation cannot be nil.')
106
+ end
107
+
108
+ if @luminance.nil?
109
+ invalid_properties.push('invalid value for "luminance", luminance cannot be nil.')
110
+ end
111
+
112
+ invalid_properties
113
+ end
114
+
115
+ # Check to see if the all the properties in the model are valid
116
+ # @return true if the model is valid
117
+ def valid?
118
+ return false if !super
119
+ return false if @hue.nil?
120
+ return false if @saturation.nil?
121
+ return false if @luminance.nil?
122
+ true
123
+ end
124
+
125
+ # Checks equality by comparing each attribute.
126
+ # @param [Object] Object to be compared
127
+ def ==(o)
128
+ return true if self.equal?(o)
129
+ self.class == o.class &&
130
+ type == o.type &&
131
+ hue == o.hue &&
132
+ saturation == o.saturation &&
133
+ luminance == o.luminance
134
+ end
135
+
136
+ # @see the `==` method
137
+ # @param [Object] Object to be compared
138
+ def eql?(o)
139
+ self == o
140
+ end
141
+
142
+ # Calculates hash code according to all attributes.
143
+ # @return [Fixnum] Hash code
144
+ def hash
145
+ [type, hue, saturation, luminance].hash
146
+ end
147
+
148
+ # Builds the object from hash
149
+ # @param [Hash] attributes Model attributes in the form of hash
150
+ # @return [Object] Returns the model itself
151
+ def build_from_hash(attributes)
152
+ return nil unless attributes.is_a?(Hash)
153
+ self.class.swagger_types.each_pair do |key, type|
154
+ mapKey = self.class.attribute_map[key]
155
+ if !mapKey.nil?
156
+ val = attributes[mapKey]
157
+ if val.nil?
158
+ mapKeyString = mapKey.to_s
159
+ mapKeyString[0] = mapKeyString[0].downcase
160
+ mapKey = mapKeyString.to_sym
161
+ val = attributes[mapKey]
162
+ end
163
+ if !val.nil?
164
+ if type =~ /\AArray<(.*)>/i
165
+ # check to ensure the input is an array given that the the attribute
166
+ # is documented as an array but the input is not
167
+ if val.is_a?(Array)
168
+ self.send("#{key}=", val.map { |v| _deserialize($1, v) })
169
+ end
170
+ else
171
+ self.send("#{key}=", _deserialize(type, val))
172
+ end
173
+ end
174
+ end
175
+ end
176
+
177
+ self
178
+ end
179
+
180
+ # Deserializes the data based on type
181
+ # @param string type Data type
182
+ # @param string value Value to be deserialized
183
+ # @return [Object] Deserialized data
184
+ def _deserialize(type, value)
185
+ case type.to_sym
186
+ when :DateTime
187
+ DateTime.parse(value)
188
+ when :Date
189
+ Date.parse(value)
190
+ when :String
191
+ value.to_s
192
+ when :Integer
193
+ value.to_i
194
+ when :Float
195
+ value.to_f
196
+ when :BOOLEAN
197
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
198
+ true
199
+ else
200
+ false
201
+ end
202
+ when :Object
203
+ # generic object (usually a Hash), return directly
204
+ value
205
+ when /\AArray<(?<inner_type>.+)>\z/
206
+ inner_type = Regexp.last_match[:inner_type]
207
+ value.map { |v| _deserialize(inner_type, v) }
208
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
209
+ k_type = Regexp.last_match[:k_type]
210
+ v_type = Regexp.last_match[:v_type]
211
+ {}.tap do |hash|
212
+ value.each do |k, v|
213
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
214
+ end
215
+ end
216
+ else # model
217
+ registry_type = AsposeSlidesCloud::TypeRegistry.get_type(type.to_s, value)
218
+ if registry_type
219
+ type = registry_type
220
+ end
221
+ temp_model = AsposeSlidesCloud.const_get(type).new
222
+ temp_model.build_from_hash(value)
223
+ end
224
+ end
225
+
226
+ # Returns the string representation of the object
227
+ # @return [String] String presentation of the object
228
+ def to_s
229
+ to_hash.to_s
230
+ end
231
+
232
+ # to_body is an alias to to_hash (backward compatibility)
233
+ # @return [Hash] Returns the object in the form of hash
234
+ def to_body
235
+ to_hash
236
+ end
237
+
238
+ # Returns the object in the form of hash
239
+ # @return [Hash] Returns the object in the form of hash
240
+ def to_hash
241
+ hash = {}
242
+ self.class.attribute_map.each_pair do |attr, param|
243
+ value = self.send(attr)
244
+ next if value.nil?
245
+ hash[param] = _to_hash(value)
246
+ end
247
+ hash
248
+ end
249
+
250
+ # Outputs non-array value in the form of hash
251
+ # For object, use to_hash. Otherwise, just return the value
252
+ # @param [Object] value Any valid value
253
+ # @return [Hash] Returns the value in the form of hash
254
+ def _to_hash(value)
255
+ if value.is_a?(Array)
256
+ value.compact.map { |v| _to_hash(v) }
257
+ elsif value.is_a?(Hash)
258
+ {}.tap do |hash|
259
+ value.each { |k, v| hash[k] = _to_hash(v) }
260
+ end
261
+ elsif value.respond_to? :to_hash
262
+ value.to_hash
263
+ else
264
+ value
265
+ end
266
+ end
267
+ end
268
+ end
@@ -82,8 +82,7 @@ module AsposeSlidesCloud
82
82
  return true if self.equal?(o)
83
83
  self.class == o.class &&
84
84
  default_regular_font == o.default_regular_font &&
85
- height == o.height &&
86
- width == o.width &&
85
+ font_fallback_rules == o.font_fallback_rules &&
87
86
  format == o.format &&
88
87
  animate_transitions == o.animate_transitions &&
89
88
  animate_shapes == o.animate_shapes
@@ -98,7 +97,7 @@ module AsposeSlidesCloud
98
97
  # Calculates hash code according to all attributes.
99
98
  # @return [Fixnum] Hash code
100
99
  def hash
101
- [default_regular_font, height, width, format, animate_transitions, animate_shapes].hash
100
+ [default_regular_font, font_fallback_rules, format, animate_transitions, animate_shapes].hash
102
101
  end
103
102
 
104
103
  # Builds the object from hash
@@ -230,8 +230,7 @@ module AsposeSlidesCloud
230
230
  return true if self.equal?(o)
231
231
  self.class == o.class &&
232
232
  default_regular_font == o.default_regular_font &&
233
- height == o.height &&
234
- width == o.width &&
233
+ font_fallback_rules == o.font_fallback_rules &&
235
234
  format == o.format &&
236
235
  save_as_zip == o.save_as_zip &&
237
236
  sub_directory_name == o.sub_directory_name &&
@@ -256,7 +255,7 @@ module AsposeSlidesCloud
256
255
  # Calculates hash code according to all attributes.
257
256
  # @return [Fixnum] Hash code
258
257
  def hash
259
- [default_regular_font, height, width, format, save_as_zip, sub_directory_name, show_hidden_slides, svg_responsive_layout, jpeg_quality, pictures_compression, delete_pictures_cropped_areas, notes_position, comments_position, comments_area_width, comments_area_color, show_comments_by_no_author].hash
258
+ [default_regular_font, font_fallback_rules, format, save_as_zip, sub_directory_name, show_hidden_slides, svg_responsive_layout, jpeg_quality, pictures_compression, delete_pictures_cropped_areas, notes_position, comments_position, comments_area_width, comments_area_color, show_comments_by_no_author].hash
260
259
  end
261
260
 
262
261
  # Builds the object from hash
@@ -24,7 +24,7 @@ require 'date'
24
24
 
25
25
  module AsposeSlidesCloud
26
26
  # Provides options that control how a presentation is saved in an image format.
27
- class ImageExportOptions < ExportOptions
27
+ class ImageExportOptions < ImageExportOptionsBase
28
28
  # Gets or sets the position of the notes on the page.
29
29
  attr_accessor :notes_position
30
30
 
@@ -146,9 +146,10 @@ module AsposeSlidesCloud
146
146
  return true if self.equal?(o)
147
147
  self.class == o.class &&
148
148
  default_regular_font == o.default_regular_font &&
149
+ font_fallback_rules == o.font_fallback_rules &&
150
+ format == o.format &&
149
151
  height == o.height &&
150
152
  width == o.width &&
151
- format == o.format &&
152
153
  notes_position == o.notes_position &&
153
154
  comments_position == o.comments_position &&
154
155
  comments_area_width == o.comments_area_width &&
@@ -164,7 +165,7 @@ module AsposeSlidesCloud
164
165
  # Calculates hash code according to all attributes.
165
166
  # @return [Fixnum] Hash code
166
167
  def hash
167
- [default_regular_font, height, width, format, notes_position, comments_position, comments_area_width, comments_area_color].hash
168
+ [default_regular_font, font_fallback_rules, format, height, width, notes_position, comments_position, comments_area_width, comments_area_color].hash
168
169
  end
169
170
 
170
171
  # Builds the object from hash
@@ -0,0 +1,222 @@
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
+ # The class provides shared options for image formats.
27
+ class ImageExportOptionsBase < ExportOptions
28
+ # Gets or sets the height of slides in the output image format.
29
+ attr_accessor :height
30
+
31
+ # Gets or sets the height of slides in the output the output image format.
32
+ attr_accessor :width
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ def self.attribute_map
36
+ super.merge({
37
+ :'height' => :'Height',
38
+ :'width' => :'Width',
39
+ })
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.swagger_types
44
+ super.merge({
45
+ :'height' => :'Integer',
46
+ :'width' => :'Integer',
47
+ })
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ super
54
+
55
+ if attributes.has_key?(:'Height')
56
+ self.height = attributes[:'Height']
57
+ end
58
+
59
+ if attributes.has_key?(:'Width')
60
+ self.width = attributes[:'Width']
61
+ end
62
+ end
63
+
64
+ # Show invalid properties with the reasons. Usually used together with valid?
65
+ # @return Array for valid properties with the reasons
66
+ def list_invalid_properties
67
+ invalid_properties = super
68
+ invalid_properties
69
+ end
70
+
71
+ # Check to see if the all the properties in the model are valid
72
+ # @return true if the model is valid
73
+ def valid?
74
+ return false if !super
75
+ true
76
+ end
77
+
78
+ # Checks equality by comparing each attribute.
79
+ # @param [Object] Object to be compared
80
+ def ==(o)
81
+ return true if self.equal?(o)
82
+ self.class == o.class &&
83
+ default_regular_font == o.default_regular_font &&
84
+ font_fallback_rules == o.font_fallback_rules &&
85
+ format == o.format &&
86
+ height == o.height &&
87
+ width == o.width
88
+ end
89
+
90
+ # @see the `==` method
91
+ # @param [Object] Object to be compared
92
+ def eql?(o)
93
+ self == o
94
+ end
95
+
96
+ # Calculates hash code according to all attributes.
97
+ # @return [Fixnum] Hash code
98
+ def hash
99
+ [default_regular_font, font_fallback_rules, format, height, width].hash
100
+ end
101
+
102
+ # Builds the object from hash
103
+ # @param [Hash] attributes Model attributes in the form of hash
104
+ # @return [Object] Returns the model itself
105
+ def build_from_hash(attributes)
106
+ return nil unless attributes.is_a?(Hash)
107
+ self.class.swagger_types.each_pair do |key, type|
108
+ mapKey = self.class.attribute_map[key]
109
+ if !mapKey.nil?
110
+ val = attributes[mapKey]
111
+ if val.nil?
112
+ mapKeyString = mapKey.to_s
113
+ mapKeyString[0] = mapKeyString[0].downcase
114
+ mapKey = mapKeyString.to_sym
115
+ val = attributes[mapKey]
116
+ end
117
+ if !val.nil?
118
+ if type =~ /\AArray<(.*)>/i
119
+ # check to ensure the input is an array given that the the attribute
120
+ # is documented as an array but the input is not
121
+ if val.is_a?(Array)
122
+ self.send("#{key}=", val.map { |v| _deserialize($1, v) })
123
+ end
124
+ else
125
+ self.send("#{key}=", _deserialize(type, val))
126
+ end
127
+ end
128
+ end
129
+ end
130
+
131
+ self
132
+ end
133
+
134
+ # Deserializes the data based on type
135
+ # @param string type Data type
136
+ # @param string value Value to be deserialized
137
+ # @return [Object] Deserialized data
138
+ def _deserialize(type, value)
139
+ case type.to_sym
140
+ when :DateTime
141
+ DateTime.parse(value)
142
+ when :Date
143
+ Date.parse(value)
144
+ when :String
145
+ value.to_s
146
+ when :Integer
147
+ value.to_i
148
+ when :Float
149
+ value.to_f
150
+ when :BOOLEAN
151
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
152
+ true
153
+ else
154
+ false
155
+ end
156
+ when :Object
157
+ # generic object (usually a Hash), return directly
158
+ value
159
+ when /\AArray<(?<inner_type>.+)>\z/
160
+ inner_type = Regexp.last_match[:inner_type]
161
+ value.map { |v| _deserialize(inner_type, v) }
162
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
163
+ k_type = Regexp.last_match[:k_type]
164
+ v_type = Regexp.last_match[:v_type]
165
+ {}.tap do |hash|
166
+ value.each do |k, v|
167
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
168
+ end
169
+ end
170
+ else # model
171
+ registry_type = AsposeSlidesCloud::TypeRegistry.get_type(type.to_s, value)
172
+ if registry_type
173
+ type = registry_type
174
+ end
175
+ temp_model = AsposeSlidesCloud.const_get(type).new
176
+ temp_model.build_from_hash(value)
177
+ end
178
+ end
179
+
180
+ # Returns the string representation of the object
181
+ # @return [String] String presentation of the object
182
+ def to_s
183
+ to_hash.to_s
184
+ end
185
+
186
+ # to_body is an alias to to_hash (backward compatibility)
187
+ # @return [Hash] Returns the object in the form of hash
188
+ def to_body
189
+ to_hash
190
+ end
191
+
192
+ # Returns the object in the form of hash
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_hash
195
+ hash = {}
196
+ self.class.attribute_map.each_pair do |attr, param|
197
+ value = self.send(attr)
198
+ next if value.nil?
199
+ hash[param] = _to_hash(value)
200
+ end
201
+ hash
202
+ end
203
+
204
+ # Outputs non-array value in the form of hash
205
+ # For object, use to_hash. Otherwise, just return the value
206
+ # @param [Object] value Any valid value
207
+ # @return [Hash] Returns the value in the form of hash
208
+ def _to_hash(value)
209
+ if value.is_a?(Array)
210
+ value.compact.map { |v| _to_hash(v) }
211
+ elsif value.is_a?(Hash)
212
+ {}.tap do |hash|
213
+ value.each { |k, v| hash[k] = _to_hash(v) }
214
+ end
215
+ elsif value.respond_to? :to_hash
216
+ value.to_hash
217
+ else
218
+ value
219
+ end
220
+ end
221
+ end
222
+ end