aspose_slides_cloud 21.12.1 → 22.1.0

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.
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,305 @@
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
+ # An array of elements.
27
+ class ArrayElement < MathElement
28
+ # Arguments
29
+ attr_accessor :arguments
30
+
31
+ # Specifies alignment of the array relative to surrounding text
32
+ attr_accessor :base_justification
33
+
34
+ # Maximum Distribution
35
+ attr_accessor :maximum_distribution
36
+
37
+ # Object Distribution
38
+ attr_accessor :object_distribution
39
+
40
+ # The type of vertical spacing between array elements
41
+ attr_accessor :row_spacing_rule
42
+
43
+ # Spacing between rows of an array
44
+ attr_accessor :row_spacing
45
+
46
+ class EnumAttributeValidator
47
+ attr_reader :datatype
48
+ attr_reader :allowable_values
49
+
50
+ def initialize(datatype, allowable_values)
51
+ @allowable_values = allowable_values.map do |value|
52
+ case datatype.to_s
53
+ when /Integer/i
54
+ value.to_i
55
+ when /Float/i
56
+ value.to_f
57
+ else
58
+ value
59
+ end
60
+ end
61
+ end
62
+
63
+ def valid?(value)
64
+ !value || allowable_values.any?{ |s| s.casecmp(value) == 0 }
65
+ end
66
+ end
67
+
68
+ # Attribute mapping from ruby-style variable name to JSON key.
69
+ def self.attribute_map
70
+ super.merge({
71
+ :'arguments' => :'Arguments',
72
+ :'base_justification' => :'BaseJustification',
73
+ :'maximum_distribution' => :'MaximumDistribution',
74
+ :'object_distribution' => :'ObjectDistribution',
75
+ :'row_spacing_rule' => :'RowSpacingRule',
76
+ :'row_spacing' => :'RowSpacing',
77
+ })
78
+ end
79
+
80
+ # Attribute type mapping.
81
+ def self.swagger_types
82
+ super.merge({
83
+ :'arguments' => :'Array<MathElement>',
84
+ :'base_justification' => :'String',
85
+ :'maximum_distribution' => :'BOOLEAN',
86
+ :'object_distribution' => :'BOOLEAN',
87
+ :'row_spacing_rule' => :'String',
88
+ :'row_spacing' => :'Integer',
89
+ })
90
+ end
91
+
92
+ # Initializes the object
93
+ # @param [Hash] attributes Model attributes in the form of hash
94
+ def initialize(attributes = {})
95
+ super
96
+
97
+ if attributes.has_key?(:'Arguments')
98
+ if (value = attributes[:'Arguments']).is_a?(Array)
99
+ self.arguments = value
100
+ end
101
+ end
102
+
103
+ if attributes.has_key?(:'BaseJustification')
104
+ self.base_justification = attributes[:'BaseJustification']
105
+ end
106
+
107
+ if attributes.has_key?(:'MaximumDistribution')
108
+ self.maximum_distribution = attributes[:'MaximumDistribution']
109
+ end
110
+
111
+ if attributes.has_key?(:'ObjectDistribution')
112
+ self.object_distribution = attributes[:'ObjectDistribution']
113
+ end
114
+
115
+ if attributes.has_key?(:'RowSpacingRule')
116
+ self.row_spacing_rule = attributes[:'RowSpacingRule']
117
+ end
118
+
119
+ if attributes.has_key?(:'RowSpacing')
120
+ self.row_spacing = attributes[:'RowSpacing']
121
+ end
122
+ self.type = "Array"
123
+ end
124
+
125
+ # Show invalid properties with the reasons. Usually used together with valid?
126
+ # @return Array for valid properties with the reasons
127
+ def list_invalid_properties
128
+ invalid_properties = super
129
+ invalid_properties
130
+ end
131
+
132
+ # Check to see if the all the properties in the model are valid
133
+ # @return true if the model is valid
134
+ def valid?
135
+ return false if !super
136
+ base_justification_validator = EnumAttributeValidator.new('String', ['NotDefined', 'Top', 'Center', 'Bottom'])
137
+ return false unless base_justification_validator.valid?(@base_justification)
138
+ row_spacing_rule_validator = EnumAttributeValidator.new('String', ['SingleLineGap', 'OneAndAHalfLineGap', 'TwoLineGap', 'Exactly', 'Multiple'])
139
+ return false unless row_spacing_rule_validator.valid?(@row_spacing_rule)
140
+ true
141
+ end
142
+
143
+ # Custom attribute writer method checking allowed values (enum).
144
+ # @param [Object] base_justification Object to be assigned
145
+ def base_justification=(base_justification)
146
+ validator = EnumAttributeValidator.new('String', ['NotDefined', 'Top', 'Center', 'Bottom'])
147
+ unless validator.valid?(base_justification)
148
+ fail ArgumentError, 'invalid value for "base_justification", must be one of #{validator.allowable_values}.'
149
+ end
150
+ @base_justification = base_justification
151
+ end
152
+
153
+ # Custom attribute writer method checking allowed values (enum).
154
+ # @param [Object] row_spacing_rule Object to be assigned
155
+ def row_spacing_rule=(row_spacing_rule)
156
+ validator = EnumAttributeValidator.new('String', ['SingleLineGap', 'OneAndAHalfLineGap', 'TwoLineGap', 'Exactly', 'Multiple'])
157
+ unless validator.valid?(row_spacing_rule)
158
+ fail ArgumentError, 'invalid value for "row_spacing_rule", must be one of #{validator.allowable_values}.'
159
+ end
160
+ @row_spacing_rule = row_spacing_rule
161
+ end
162
+
163
+ # Checks equality by comparing each attribute.
164
+ # @param [Object] Object to be compared
165
+ def ==(o)
166
+ return true if self.equal?(o)
167
+ self.class == o.class &&
168
+ type == o.type &&
169
+ arguments == o.arguments &&
170
+ base_justification == o.base_justification &&
171
+ maximum_distribution == o.maximum_distribution &&
172
+ object_distribution == o.object_distribution &&
173
+ row_spacing_rule == o.row_spacing_rule &&
174
+ row_spacing == o.row_spacing
175
+ end
176
+
177
+ # @see the `==` method
178
+ # @param [Object] Object to be compared
179
+ def eql?(o)
180
+ self == o
181
+ end
182
+
183
+ # Calculates hash code according to all attributes.
184
+ # @return [Fixnum] Hash code
185
+ def hash
186
+ [type, arguments, base_justification, maximum_distribution, object_distribution, row_spacing_rule, row_spacing].hash
187
+ end
188
+
189
+ # Builds the object from hash
190
+ # @param [Hash] attributes Model attributes in the form of hash
191
+ # @return [Object] Returns the model itself
192
+ def build_from_hash(attributes)
193
+ return nil unless attributes.is_a?(Hash)
194
+ self.class.swagger_types.each_pair do |key, type|
195
+ mapKey = self.class.attribute_map[key]
196
+ if !mapKey.nil?
197
+ val = attributes[mapKey]
198
+ if val.nil?
199
+ mapKeyString = mapKey.to_s
200
+ mapKeyString[0] = mapKeyString[0].downcase
201
+ mapKey = mapKeyString.to_sym
202
+ val = attributes[mapKey]
203
+ end
204
+ if !val.nil?
205
+ if type =~ /\AArray<(.*)>/i
206
+ # check to ensure the input is an array given that the the attribute
207
+ # is documented as an array but the input is not
208
+ if val.is_a?(Array)
209
+ self.send("#{key}=", val.map { |v| _deserialize($1, v) })
210
+ end
211
+ else
212
+ self.send("#{key}=", _deserialize(type, val))
213
+ end
214
+ end
215
+ end
216
+ end
217
+
218
+ self
219
+ end
220
+
221
+ # Deserializes the data based on type
222
+ # @param string type Data type
223
+ # @param string value Value to be deserialized
224
+ # @return [Object] Deserialized data
225
+ def _deserialize(type, value)
226
+ case type.to_sym
227
+ when :DateTime
228
+ DateTime.parse(value)
229
+ when :Date
230
+ Date.parse(value)
231
+ when :String
232
+ value.to_s
233
+ when :Integer
234
+ value.to_i
235
+ when :Float
236
+ value.to_f
237
+ when :BOOLEAN
238
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
239
+ true
240
+ else
241
+ false
242
+ end
243
+ when :Object
244
+ # generic object (usually a Hash), return directly
245
+ value
246
+ when /\AArray<(?<inner_type>.+)>\z/
247
+ inner_type = Regexp.last_match[:inner_type]
248
+ value.map { |v| _deserialize(inner_type, v) }
249
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
250
+ k_type = Regexp.last_match[:k_type]
251
+ v_type = Regexp.last_match[:v_type]
252
+ {}.tap do |hash|
253
+ value.each do |k, v|
254
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
255
+ end
256
+ end
257
+ else # model
258
+ temp_model = AsposeSlidesCloud.const_get(type).new
259
+ temp_model.build_from_hash(value)
260
+ end
261
+ end
262
+
263
+ # Returns the string representation of the object
264
+ # @return [String] String presentation of the object
265
+ def to_s
266
+ to_hash.to_s
267
+ end
268
+
269
+ # to_body is an alias to to_hash (backward compatibility)
270
+ # @return [Hash] Returns the object in the form of hash
271
+ def to_body
272
+ to_hash
273
+ end
274
+
275
+ # Returns the object in the form of hash
276
+ # @return [Hash] Returns the object in the form of hash
277
+ def to_hash
278
+ hash = {}
279
+ self.class.attribute_map.each_pair do |attr, param|
280
+ value = self.send(attr)
281
+ next if value.nil?
282
+ hash[param] = _to_hash(value)
283
+ end
284
+ hash
285
+ end
286
+
287
+ # Outputs non-array value in the form of hash
288
+ # For object, use to_hash. Otherwise, just return the value
289
+ # @param [Object] value Any valid value
290
+ # @return [Hash] Returns the value in the form of hash
291
+ def _to_hash(value)
292
+ if value.is_a?(Array)
293
+ value.compact.map { |v| _to_hash(v) }
294
+ elsif value.is_a?(Hash)
295
+ {}.tap do |hash|
296
+ value.each { |k, v| hash[k] = _to_hash(v) }
297
+ end
298
+ elsif value.respond_to? :to_hash
299
+ value.to_hash
300
+ else
301
+ value
302
+ end
303
+ end
304
+ end
305
+ end
@@ -55,6 +55,12 @@ module AsposeSlidesCloud
55
55
  # Audio data encoded in base64.
56
56
  attr_accessor :base64_data
57
57
 
58
+ # Determines whether an audio is playing across the slides.
59
+ attr_accessor :play_across_slides
60
+
61
+ # Determines whether audio is automatically rewound to start after playing.
62
+ attr_accessor :rewind_audio
63
+
58
64
  class EnumAttributeValidator
59
65
  attr_reader :datatype
60
66
  attr_reader :allowable_values
@@ -90,6 +96,8 @@ module AsposeSlidesCloud
90
96
  :'play_mode' => :'PlayMode',
91
97
  :'volume' => :'Volume',
92
98
  :'base64_data' => :'Base64Data',
99
+ :'play_across_slides' => :'PlayAcrossSlides',
100
+ :'rewind_audio' => :'RewindAudio',
93
101
  })
94
102
  end
95
103
 
@@ -106,6 +114,8 @@ module AsposeSlidesCloud
106
114
  :'play_mode' => :'String',
107
115
  :'volume' => :'String',
108
116
  :'base64_data' => :'String',
117
+ :'play_across_slides' => :'BOOLEAN',
118
+ :'rewind_audio' => :'BOOLEAN',
109
119
  })
110
120
  end
111
121
 
@@ -153,6 +163,14 @@ module AsposeSlidesCloud
153
163
  if attributes.has_key?(:'Base64Data')
154
164
  self.base64_data = attributes[:'Base64Data']
155
165
  end
166
+
167
+ if attributes.has_key?(:'PlayAcrossSlides')
168
+ self.play_across_slides = attributes[:'PlayAcrossSlides']
169
+ end
170
+
171
+ if attributes.has_key?(:'RewindAudio')
172
+ self.rewind_audio = attributes[:'RewindAudio']
173
+ end
156
174
  self.type = "AudioFrame"
157
175
  end
158
176
 
@@ -167,7 +185,7 @@ module AsposeSlidesCloud
167
185
  # @return true if the model is valid
168
186
  def valid?
169
187
  return false if !super
170
- play_mode_validator = EnumAttributeValidator.new('String', ['Auto', 'OnClick', 'AllSlides', 'Mixed'])
188
+ play_mode_validator = EnumAttributeValidator.new('String', ['Auto', 'OnClick', 'AllSlides', 'InClickSequence', 'Mixed'])
171
189
  return false unless play_mode_validator.valid?(@play_mode)
172
190
  volume_validator = EnumAttributeValidator.new('String', ['Mute', 'Low', 'Medium', 'Loud', 'Mixed'])
173
191
  return false unless volume_validator.valid?(@volume)
@@ -177,7 +195,7 @@ module AsposeSlidesCloud
177
195
  # Custom attribute writer method checking allowed values (enum).
178
196
  # @param [Object] play_mode Object to be assigned
179
197
  def play_mode=(play_mode)
180
- validator = EnumAttributeValidator.new('String', ['Auto', 'OnClick', 'AllSlides', 'Mixed'])
198
+ validator = EnumAttributeValidator.new('String', ['Auto', 'OnClick', 'AllSlides', 'InClickSequence', 'Mixed'])
181
199
  unless validator.valid?(play_mode)
182
200
  fail ArgumentError, 'invalid value for "play_mode", must be one of #{validator.allowable_values}.'
183
201
  end
@@ -215,6 +233,8 @@ module AsposeSlidesCloud
215
233
  effect_format == o.effect_format &&
216
234
  three_d_format == o.three_d_format &&
217
235
  line_format == o.line_format &&
236
+ hyperlink_click == o.hyperlink_click &&
237
+ hyperlink_mouse_over == o.hyperlink_mouse_over &&
218
238
  type == o.type &&
219
239
  shape_type == o.shape_type &&
220
240
  audio_cd_end_track == o.audio_cd_end_track &&
@@ -226,7 +246,9 @@ module AsposeSlidesCloud
226
246
  play_loop_mode == o.play_loop_mode &&
227
247
  play_mode == o.play_mode &&
228
248
  volume == o.volume &&
229
- base64_data == o.base64_data
249
+ base64_data == o.base64_data &&
250
+ play_across_slides == o.play_across_slides &&
251
+ rewind_audio == o.rewind_audio
230
252
  end
231
253
 
232
254
  # @see the `==` method
@@ -238,7 +260,7 @@ module AsposeSlidesCloud
238
260
  # Calculates hash code according to all attributes.
239
261
  # @return [Fixnum] Hash code
240
262
  def hash
241
- [self_uri, alternate_links, name, width, height, alternative_text, alternative_text_title, hidden, x, y, z_order_position, shapes, fill_format, effect_format, three_d_format, line_format, type, shape_type, audio_cd_end_track, audio_cd_end_track_time, audio_cd_start_track, audio_cd_start_track_time, embedded, hide_at_showing, play_loop_mode, play_mode, volume, base64_data].hash
263
+ [self_uri, alternate_links, name, width, height, alternative_text, alternative_text_title, hidden, x, y, z_order_position, shapes, fill_format, effect_format, three_d_format, line_format, hyperlink_click, hyperlink_mouse_over, type, shape_type, audio_cd_end_track, audio_cd_end_track_time, audio_cd_start_track, audio_cd_start_track_time, embedded, hide_at_showing, play_loop_mode, play_mode, volume, base64_data, play_across_slides, rewind_audio].hash
242
264
  end
243
265
 
244
266
  # Builds the object from hash
@@ -0,0 +1,251 @@
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 bar function, consisting of a base argument and an overbar or underbar
27
+ class BarElement < MathElement
28
+ # Base
29
+ attr_accessor :base
30
+
31
+ # Position of the bar line.
32
+ attr_accessor :position
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
+ :'base' => :'Base',
60
+ :'position' => :'Position',
61
+ })
62
+ end
63
+
64
+ # Attribute type mapping.
65
+ def self.swagger_types
66
+ super.merge({
67
+ :'base' => :'MathElement',
68
+ :'position' => :'String',
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?(:'Base')
78
+ self.base = attributes[:'Base']
79
+ end
80
+
81
+ if attributes.has_key?(:'Position')
82
+ self.position = attributes[:'Position']
83
+ end
84
+ self.type = "Bar"
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
+ invalid_properties
92
+ end
93
+
94
+ # Check to see if the all the properties in the model are valid
95
+ # @return true if the model is valid
96
+ def valid?
97
+ return false if !super
98
+ position_validator = EnumAttributeValidator.new('String', ['NotDefined', 'Top', 'Bottom'])
99
+ return false unless position_validator.valid?(@position)
100
+ true
101
+ end
102
+
103
+ # Custom attribute writer method checking allowed values (enum).
104
+ # @param [Object] position Object to be assigned
105
+ def position=(position)
106
+ validator = EnumAttributeValidator.new('String', ['NotDefined', 'Top', 'Bottom'])
107
+ unless validator.valid?(position)
108
+ fail ArgumentError, 'invalid value for "position", must be one of #{validator.allowable_values}.'
109
+ end
110
+ @position = position
111
+ end
112
+
113
+ # Checks equality by comparing each attribute.
114
+ # @param [Object] Object to be compared
115
+ def ==(o)
116
+ return true if self.equal?(o)
117
+ self.class == o.class &&
118
+ type == o.type &&
119
+ base == o.base &&
120
+ position == o.position
121
+ end
122
+
123
+ # @see the `==` method
124
+ # @param [Object] Object to be compared
125
+ def eql?(o)
126
+ self == o
127
+ end
128
+
129
+ # Calculates hash code according to all attributes.
130
+ # @return [Fixnum] Hash code
131
+ def hash
132
+ [type, base, position].hash
133
+ end
134
+
135
+ # Builds the object from hash
136
+ # @param [Hash] attributes Model attributes in the form of hash
137
+ # @return [Object] Returns the model itself
138
+ def build_from_hash(attributes)
139
+ return nil unless attributes.is_a?(Hash)
140
+ self.class.swagger_types.each_pair do |key, type|
141
+ mapKey = self.class.attribute_map[key]
142
+ if !mapKey.nil?
143
+ val = attributes[mapKey]
144
+ if val.nil?
145
+ mapKeyString = mapKey.to_s
146
+ mapKeyString[0] = mapKeyString[0].downcase
147
+ mapKey = mapKeyString.to_sym
148
+ val = attributes[mapKey]
149
+ end
150
+ if !val.nil?
151
+ if type =~ /\AArray<(.*)>/i
152
+ # check to ensure the input is an array given that the the attribute
153
+ # is documented as an array but the input is not
154
+ if val.is_a?(Array)
155
+ self.send("#{key}=", val.map { |v| _deserialize($1, v) })
156
+ end
157
+ else
158
+ self.send("#{key}=", _deserialize(type, val))
159
+ end
160
+ end
161
+ end
162
+ end
163
+
164
+ self
165
+ end
166
+
167
+ # Deserializes the data based on type
168
+ # @param string type Data type
169
+ # @param string value Value to be deserialized
170
+ # @return [Object] Deserialized data
171
+ def _deserialize(type, value)
172
+ case type.to_sym
173
+ when :DateTime
174
+ DateTime.parse(value)
175
+ when :Date
176
+ Date.parse(value)
177
+ when :String
178
+ value.to_s
179
+ when :Integer
180
+ value.to_i
181
+ when :Float
182
+ value.to_f
183
+ when :BOOLEAN
184
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
185
+ true
186
+ else
187
+ false
188
+ end
189
+ when :Object
190
+ # generic object (usually a Hash), return directly
191
+ value
192
+ when /\AArray<(?<inner_type>.+)>\z/
193
+ inner_type = Regexp.last_match[:inner_type]
194
+ value.map { |v| _deserialize(inner_type, v) }
195
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
196
+ k_type = Regexp.last_match[:k_type]
197
+ v_type = Regexp.last_match[:v_type]
198
+ {}.tap do |hash|
199
+ value.each do |k, v|
200
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
201
+ end
202
+ end
203
+ else # model
204
+ temp_model = AsposeSlidesCloud.const_get(type).new
205
+ temp_model.build_from_hash(value)
206
+ end
207
+ end
208
+
209
+ # Returns the string representation of the object
210
+ # @return [String] String presentation of the object
211
+ def to_s
212
+ to_hash.to_s
213
+ end
214
+
215
+ # to_body is an alias to to_hash (backward compatibility)
216
+ # @return [Hash] Returns the object in the form of hash
217
+ def to_body
218
+ to_hash
219
+ end
220
+
221
+ # Returns the object in the form of hash
222
+ # @return [Hash] Returns the object in the form of hash
223
+ def to_hash
224
+ hash = {}
225
+ self.class.attribute_map.each_pair do |attr, param|
226
+ value = self.send(attr)
227
+ next if value.nil?
228
+ hash[param] = _to_hash(value)
229
+ end
230
+ hash
231
+ end
232
+
233
+ # Outputs non-array value in the form of hash
234
+ # For object, use to_hash. Otherwise, just return the value
235
+ # @param [Object] value Any valid value
236
+ # @return [Hash] Returns the value in the form of hash
237
+ def _to_hash(value)
238
+ if value.is_a?(Array)
239
+ value.compact.map { |v| _to_hash(v) }
240
+ elsif value.is_a?(Hash)
241
+ {}.tap do |hash|
242
+ value.each { |k, v| hash[k] = _to_hash(v) }
243
+ end
244
+ elsif value.respond_to? :to_hash
245
+ value.to_hash
246
+ else
247
+ value
248
+ end
249
+ end
250
+ end
251
+ end