aspose_words_cloud 20.4.0 → 20.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/lib/aspose_words_cloud.rb +30 -0
  3. data/lib/aspose_words_cloud/api/words_api.rb +4292 -2201
  4. data/lib/aspose_words_cloud/api_client.rb +1 -0
  5. data/lib/aspose_words_cloud/models/bmp_save_options_data.rb +61 -4
  6. data/lib/aspose_words_cloud/models/csv_data_load_options.rb +237 -0
  7. data/lib/aspose_words_cloud/models/doc_save_options_data.rb +58 -1
  8. data/lib/aspose_words_cloud/models/emf_save_options_data.rb +61 -4
  9. data/lib/aspose_words_cloud/models/epub_save_options_data.rb +37 -1
  10. data/lib/aspose_words_cloud/models/fixed_page_save_options_data.rb +58 -1
  11. data/lib/aspose_words_cloud/models/gif_save_options_data.rb +61 -4
  12. data/lib/aspose_words_cloud/models/html_fixed_save_options_data.rb +71 -4
  13. data/lib/aspose_words_cloud/models/html_save_options_data.rb +37 -1
  14. data/lib/aspose_words_cloud/models/image_save_options_data.rb +58 -1
  15. data/lib/aspose_words_cloud/models/jpeg_save_options_data.rb +61 -4
  16. data/lib/aspose_words_cloud/models/list_format.rb +236 -0
  17. data/lib/aspose_words_cloud/models/list_format_update.rb +217 -0
  18. data/lib/aspose_words_cloud/models/list_info.rb +274 -0
  19. data/lib/aspose_words_cloud/models/list_insert.rb +244 -0
  20. data/lib/aspose_words_cloud/models/list_level.rb +393 -0
  21. data/lib/aspose_words_cloud/models/list_level_update.rb +366 -0
  22. data/lib/aspose_words_cloud/models/list_levels.rb +218 -0
  23. data/lib/aspose_words_cloud/models/list_response.rb +216 -0
  24. data/lib/aspose_words_cloud/models/list_update.rb +207 -0
  25. data/lib/aspose_words_cloud/models/lists.rb +218 -0
  26. data/lib/aspose_words_cloud/models/lists_response.rb +216 -0
  27. data/lib/aspose_words_cloud/models/mhtml_save_options_data.rb +37 -1
  28. data/lib/aspose_words_cloud/models/odt_save_options_data.rb +47 -1
  29. data/lib/aspose_words_cloud/models/ooxml_save_options_data.rb +58 -1
  30. data/lib/aspose_words_cloud/models/paragraph_format.rb +10 -1
  31. data/lib/aspose_words_cloud/models/paragraph_list_format_response.rb +216 -0
  32. data/lib/aspose_words_cloud/models/pcl_save_options_data.rb +58 -1
  33. data/lib/aspose_words_cloud/models/pdf_save_options_data.rb +47 -1
  34. data/lib/aspose_words_cloud/models/png_save_options_data.rb +61 -4
  35. data/lib/aspose_words_cloud/models/ps_save_options_data.rb +58 -1
  36. data/lib/aspose_words_cloud/models/report_build_options.rb +26 -0
  37. data/lib/aspose_words_cloud/models/report_engine_settings.rb +275 -0
  38. data/lib/aspose_words_cloud/models/requests/ApplyStyleToDocumentElementRequest.rb +81 -0
  39. data/lib/aspose_words_cloud/models/requests/BuildReportOnlineRequest.rb +57 -0
  40. data/lib/aspose_words_cloud/models/requests/BuildReportRequest.rb +73 -0
  41. data/lib/aspose_words_cloud/models/requests/CopyStyleRequest.rb +77 -0
  42. data/lib/aspose_words_cloud/models/requests/DeleteAllParagraphTabStopsRequest.rb +73 -0
  43. data/lib/aspose_words_cloud/models/requests/DeleteParagraphListFormatRequest.rb +81 -0
  44. data/lib/aspose_words_cloud/models/requests/DeleteParagraphTabStopRequest.rb +77 -0
  45. data/lib/aspose_words_cloud/models/requests/ExecuteMailMergeOnlineRequest.rb +2 -2
  46. data/lib/aspose_words_cloud/models/requests/ExecuteMailMergeRequest.rb +2 -2
  47. data/lib/aspose_words_cloud/models/requests/GetDocumentFieldNamesRequest.rb +2 -2
  48. data/lib/aspose_words_cloud/models/requests/GetListRequest.rb +65 -0
  49. data/lib/aspose_words_cloud/models/requests/GetListsRequest.rb +61 -0
  50. data/lib/aspose_words_cloud/models/requests/GetParagraphListFormatRequest.rb +69 -0
  51. data/lib/aspose_words_cloud/models/requests/GetParagraphListFormatWithoutNodePathRequest.rb +65 -0
  52. data/lib/aspose_words_cloud/models/requests/GetParagraphTabStopsRequest.rb +69 -0
  53. data/lib/aspose_words_cloud/models/requests/GetStyleFromDocumentElementRequest.rb +65 -0
  54. data/lib/aspose_words_cloud/models/requests/GetStyleRequest.rb +65 -0
  55. data/lib/aspose_words_cloud/models/requests/GetStylesRequest.rb +61 -0
  56. data/lib/aspose_words_cloud/models/requests/InsertListRequest.rb +77 -0
  57. data/lib/aspose_words_cloud/models/requests/InsertOrUpdateParagraphTabStopRequest.rb +77 -0
  58. data/lib/aspose_words_cloud/models/requests/InsertStyleRequest.rb +77 -0
  59. data/lib/aspose_words_cloud/models/requests/UpdateListLevelRequest.rb +85 -0
  60. data/lib/aspose_words_cloud/models/requests/UpdateListRequest.rb +81 -0
  61. data/lib/aspose_words_cloud/models/requests/UpdateParagraphListFormatRequest.rb +85 -0
  62. data/lib/aspose_words_cloud/models/requests/UpdateStyleRequest.rb +81 -0
  63. data/lib/aspose_words_cloud/models/rtf_save_options_data.rb +58 -1
  64. data/lib/aspose_words_cloud/models/save_options_data.rb +61 -4
  65. data/lib/aspose_words_cloud/models/shading.rb +262 -0
  66. data/lib/aspose_words_cloud/models/style.rb +370 -0
  67. data/lib/aspose_words_cloud/models/style_apply.rb +207 -0
  68. data/lib/aspose_words_cloud/models/style_copy.rb +207 -0
  69. data/lib/aspose_words_cloud/models/style_insert.rb +254 -0
  70. data/lib/aspose_words_cloud/models/style_response.rb +216 -0
  71. data/lib/aspose_words_cloud/models/style_update.rb +237 -0
  72. data/lib/aspose_words_cloud/models/styles.rb +218 -0
  73. data/lib/aspose_words_cloud/models/styles_response.rb +216 -0
  74. data/lib/aspose_words_cloud/models/svg_save_options_data.rb +58 -1
  75. data/lib/aspose_words_cloud/models/tab_stop.rb +290 -0
  76. data/lib/aspose_words_cloud/models/tab_stop_base.rb +280 -0
  77. data/lib/aspose_words_cloud/models/tab_stop_insert.rb +280 -0
  78. data/lib/aspose_words_cloud/models/tab_stops_response.rb +219 -0
  79. data/lib/aspose_words_cloud/models/text_save_options_data.rb +37 -1
  80. data/lib/aspose_words_cloud/models/tiff_save_options_data.rb +58 -1
  81. data/lib/aspose_words_cloud/models/word_ml_save_options_data.rb +58 -1
  82. data/lib/aspose_words_cloud/models/xaml_fixed_save_options_data.rb +58 -1
  83. data/lib/aspose_words_cloud/models/xaml_flow_save_options_data.rb +58 -1
  84. data/lib/aspose_words_cloud/models/xps_save_options_data.rb +58 -1
  85. data/lib/aspose_words_cloud/version.rb +1 -1
  86. metadata +52 -2
@@ -0,0 +1,366 @@
1
+
2
+ require 'date'
3
+
4
+ module AsposeWordsCloud
5
+ #
6
+ # --------------------------------------------------------------------------------------------------------------------
7
+ # <copyright company="Aspose" file="ListLevelUpdate.rb">
8
+ # Copyright (c) 2019 Aspose.Words for Cloud
9
+ # </copyright>
10
+ # <summary>
11
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ # of this software and associated documentation files (the "Software"), to deal
13
+ # in the Software without restriction, including without limitation the rights
14
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ # copies of the Software, and to permit persons to whom the Software is
16
+ # furnished to do so, subject to the following conditions:
17
+ #
18
+ # The above copyright notice and this permission notice shall be included in all
19
+ # copies or substantial portions of the Software.
20
+ #
21
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ # SOFTWARE.
28
+ # </summary>
29
+ # --------------------------------------------------------------------------------------------------------------------
30
+ #
31
+
32
+ # Represents a document list levels.
33
+ class ListLevelUpdate
34
+ # Gets or sets returns or sets the starting number for this list level.
35
+ attr_accessor :start_at
36
+
37
+ # Gets or sets returns or sets the number style for this list level.
38
+ attr_accessor :number_style
39
+
40
+ # Gets or sets returns or sets the number format for the list level.
41
+ attr_accessor :number_format
42
+
43
+ # Gets or sets the justification of the actual number of the list item.
44
+ attr_accessor :alignment
45
+
46
+ # Gets or sets a value indicating whether true if the level turns all inherited numbers to Arabic, false if it preserves their number style.
47
+ attr_accessor :is_legal
48
+
49
+ # Gets or sets or returns the list level that must appear before the specified list level restarts numbering.
50
+ attr_accessor :restart_after_level
51
+
52
+ # Gets or sets returns or sets the character inserted after the number for the list level.
53
+ attr_accessor :trailing_character
54
+
55
+ # Gets or sets returns or sets the tab position (in points) for the list level.
56
+ attr_accessor :tab_position
57
+
58
+ # Gets or sets returns or sets the position (in points) of the number or bullet for the list level.
59
+ attr_accessor :number_position
60
+
61
+ # Gets or sets returns or sets the position (in points) for the second line of wrapping text for the list level.
62
+ attr_accessor :text_position
63
+
64
+ class EnumAttributeValidator
65
+ attr_reader :datatype
66
+ attr_reader :allowable_values
67
+
68
+ def initialize(datatype, allowable_values)
69
+ @allowable_values = allowable_values.map do |value|
70
+ case datatype.to_s
71
+ when /Integer/i
72
+ value.to_i
73
+ when /Float/i
74
+ value.to_f
75
+ else
76
+ value
77
+ end
78
+ end
79
+ end
80
+
81
+ def valid?(value)
82
+ !value || allowable_values.include?(value)
83
+ end
84
+ end
85
+
86
+ # Attribute mapping from ruby-style variable name to JSON key.
87
+ def self.attribute_map
88
+ {
89
+ :'start_at' => :'StartAt',
90
+ :'number_style' => :'NumberStyle',
91
+ :'number_format' => :'NumberFormat',
92
+ :'alignment' => :'Alignment',
93
+ :'is_legal' => :'IsLegal',
94
+ :'restart_after_level' => :'RestartAfterLevel',
95
+ :'trailing_character' => :'TrailingCharacter',
96
+ :'tab_position' => :'TabPosition',
97
+ :'number_position' => :'NumberPosition',
98
+ :'text_position' => :'TextPosition'
99
+ }
100
+ end
101
+
102
+ # Attribute type mapping.
103
+ def self.swagger_types
104
+ {
105
+ :'start_at' => :'Integer',
106
+ :'number_style' => :'String',
107
+ :'number_format' => :'String',
108
+ :'alignment' => :'String',
109
+ :'is_legal' => :'BOOLEAN',
110
+ :'restart_after_level' => :'Integer',
111
+ :'trailing_character' => :'String',
112
+ :'tab_position' => :'Float',
113
+ :'number_position' => :'Float',
114
+ :'text_position' => :'Float'
115
+ }
116
+ end
117
+
118
+ # Initializes the object
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ def initialize(attributes = {})
121
+ return unless attributes.is_a?(Hash)
122
+
123
+ # convert string to symbol for hash key
124
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
125
+
126
+ if attributes.key?(:'StartAt')
127
+ self.start_at = attributes[:'StartAt']
128
+ end
129
+
130
+ if attributes.key?(:'NumberStyle')
131
+ self.number_style = attributes[:'NumberStyle']
132
+ end
133
+
134
+ if attributes.key?(:'NumberFormat')
135
+ self.number_format = attributes[:'NumberFormat']
136
+ end
137
+
138
+ if attributes.key?(:'Alignment')
139
+ self.alignment = attributes[:'Alignment']
140
+ end
141
+
142
+ if attributes.key?(:'IsLegal')
143
+ self.is_legal = attributes[:'IsLegal']
144
+ end
145
+
146
+ if attributes.key?(:'RestartAfterLevel')
147
+ self.restart_after_level = attributes[:'RestartAfterLevel']
148
+ end
149
+
150
+ if attributes.key?(:'TrailingCharacter')
151
+ self.trailing_character = attributes[:'TrailingCharacter']
152
+ end
153
+
154
+ if attributes.key?(:'TabPosition')
155
+ self.tab_position = attributes[:'TabPosition']
156
+ end
157
+
158
+ if attributes.key?(:'NumberPosition')
159
+ self.number_position = attributes[:'NumberPosition']
160
+ end
161
+
162
+ if attributes.key?(:'TextPosition')
163
+ self.text_position = attributes[:'TextPosition']
164
+ end
165
+
166
+ end
167
+
168
+ # Show invalid properties with the reasons. Usually used together with valid?
169
+ # @return Array for valid properies with the reasons
170
+ def list_invalid_properties
171
+ invalid_properties = []
172
+ return invalid_properties
173
+ end
174
+
175
+ # Check to see if the all the properties in the model are valid
176
+ # @return true if the model is valid
177
+ def valid?
178
+ number_style_validator = EnumAttributeValidator.new('String', ["Arabic", "UppercaseRoman", "LowercaseRoman", "UppercaseLetter", "LowercaseLetter", "Ordinal", "Number", "OrdinalText", "Hex", "ChicagoManual", "Kanji", "KanjiDigit", "AiueoHalfWidth", "IrohaHalfWidth", "ArabicFullWidth", "ArabicHalfWidth", "KanjiTraditional", "KanjiTraditional2", "NumberInCircle", "DecimalFullWidth", "Aiueo", "Iroha", "LeadingZero", "Bullet", "Ganada", "Chosung", "GB1", "GB2", "GB3", "GB4", "Zodiac1", "Zodiac2", "Zodiac3", "TradChinNum1", "TradChinNum2", "TradChinNum3", "TradChinNum4", "SimpChinNum1", "SimpChinNum2", "SimpChinNum3", "SimpChinNum4", "HanjaRead", "HanjaReadDigit", "Hangul", "Hanja", "Hebrew1", "Arabic1", "Hebrew2", "Arabic2", "HindiLetter1", "HindiLetter2", "HindiArabic", "HindiCardinalText", "ThaiLetter", "ThaiArabic", "ThaiCardinalText", "VietCardinalText", "NumberInDash", "LowercaseRussian", "UppercaseRussian", "None", "Custom"])
179
+ return false unless number_style_validator.valid?(@number_style)
180
+ alignment_validator = EnumAttributeValidator.new('String', ["Left", "Center", "Right"])
181
+ return false unless alignment_validator.valid?(@alignment)
182
+ trailing_character_validator = EnumAttributeValidator.new('String', ["Tab", "Space", "Nothing"])
183
+ return false unless trailing_character_validator.valid?(@trailing_character)
184
+ return true
185
+ end
186
+
187
+ # Custom attribute writer method checking allowed values (enum).
188
+ # @param [Object] number_style Object to be assigned
189
+ def number_style=(number_style)
190
+ validator = EnumAttributeValidator.new('String', ["Arabic", "UppercaseRoman", "LowercaseRoman", "UppercaseLetter", "LowercaseLetter", "Ordinal", "Number", "OrdinalText", "Hex", "ChicagoManual", "Kanji", "KanjiDigit", "AiueoHalfWidth", "IrohaHalfWidth", "ArabicFullWidth", "ArabicHalfWidth", "KanjiTraditional", "KanjiTraditional2", "NumberInCircle", "DecimalFullWidth", "Aiueo", "Iroha", "LeadingZero", "Bullet", "Ganada", "Chosung", "GB1", "GB2", "GB3", "GB4", "Zodiac1", "Zodiac2", "Zodiac3", "TradChinNum1", "TradChinNum2", "TradChinNum3", "TradChinNum4", "SimpChinNum1", "SimpChinNum2", "SimpChinNum3", "SimpChinNum4", "HanjaRead", "HanjaReadDigit", "Hangul", "Hanja", "Hebrew1", "Arabic1", "Hebrew2", "Arabic2", "HindiLetter1", "HindiLetter2", "HindiArabic", "HindiCardinalText", "ThaiLetter", "ThaiArabic", "ThaiCardinalText", "VietCardinalText", "NumberInDash", "LowercaseRussian", "UppercaseRussian", "None", "Custom"])
191
+ if number_style.to_i == 0
192
+ unless validator.valid?(number_style)
193
+ raise ArgumentError, "invalid value for 'number_style', must be one of #{validator.allowable_values}."
194
+ end
195
+ @number_style = number_style
196
+ else
197
+ @number_style = validator.allowable_values[number_style.to_i]
198
+ end
199
+ end
200
+
201
+ # Custom attribute writer method checking allowed values (enum).
202
+ # @param [Object] alignment Object to be assigned
203
+ def alignment=(alignment)
204
+ validator = EnumAttributeValidator.new('String', ["Left", "Center", "Right"])
205
+ if alignment.to_i == 0
206
+ unless validator.valid?(alignment)
207
+ raise ArgumentError, "invalid value for 'alignment', must be one of #{validator.allowable_values}."
208
+ end
209
+ @alignment = alignment
210
+ else
211
+ @alignment = validator.allowable_values[alignment.to_i]
212
+ end
213
+ end
214
+
215
+ # Custom attribute writer method checking allowed values (enum).
216
+ # @param [Object] trailing_character Object to be assigned
217
+ def trailing_character=(trailing_character)
218
+ validator = EnumAttributeValidator.new('String', ["Tab", "Space", "Nothing"])
219
+ if trailing_character.to_i == 0
220
+ unless validator.valid?(trailing_character)
221
+ raise ArgumentError, "invalid value for 'trailing_character', must be one of #{validator.allowable_values}."
222
+ end
223
+ @trailing_character = trailing_character
224
+ else
225
+ @trailing_character = validator.allowable_values[trailing_character.to_i]
226
+ end
227
+ end
228
+
229
+ # Checks equality by comparing each attribute.
230
+ # @param [Object] Object to be compared
231
+ def ==(other)
232
+ return true if self.equal?(other)
233
+ self.class == other.class &&
234
+ start_at == other.start_at &&
235
+ number_style == other.number_style &&
236
+ number_format == other.number_format &&
237
+ alignment == other.alignment &&
238
+ is_legal == other.is_legal &&
239
+ restart_after_level == other.restart_after_level &&
240
+ trailing_character == other.trailing_character &&
241
+ tab_position == other.tab_position &&
242
+ number_position == other.number_position &&
243
+ text_position == other.text_position
244
+ end
245
+
246
+ # @see the `==` method
247
+ # @param [Object] Object to be compared
248
+ def eql?(other)
249
+ self == other
250
+ end
251
+
252
+ # Calculates hash code according to all attributes.
253
+ # @return [Fixnum] Hash code
254
+ def hash
255
+ [start_at, number_style, number_format, alignment, is_legal, restart_after_level, trailing_character, tab_position, number_position, text_position].hash
256
+ end
257
+
258
+ # Builds the object from hash
259
+ # @param [Hash] attributes Model attributes in the form of hash
260
+ # @return [Object] Returns the model itself
261
+ def build_from_hash(attributes)
262
+ return nil unless attributes.is_a?(Hash)
263
+ self.class.swagger_types.each_pair do |key, type|
264
+ if type =~ /\AArray<(.*)>/i
265
+ # check to ensure the input is an array given that the the attribute
266
+ # is documented as an array but the input is not
267
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
268
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
269
+ end
270
+ elsif !attributes[self.class.attribute_map[key]].nil?
271
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
272
+ end
273
+ # or else data not found in attributes(hash), not an issue as the data can be optional
274
+ end
275
+
276
+ self
277
+ end
278
+
279
+ # Deserializes the data based on type
280
+ # @param string type Data type
281
+ # @param string value Value to be deserialized
282
+ # @return [Object] Deserialized data
283
+ def _deserialize(type, value)
284
+ case type.to_sym
285
+ when :DateTime
286
+ Time.at(/\d/.match(value)[0].to_f).to_datetime
287
+ when :Date
288
+ Time.at(/\d/.match(value)[0].to_f).to_date
289
+ when :String
290
+ value.to_s
291
+ when :Integer
292
+ value.to_i
293
+ when :Float
294
+ value.to_f
295
+ when :BOOLEAN
296
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
297
+ true
298
+ else
299
+ false
300
+ end
301
+ when :Object
302
+ # generic object (usually a Hash), return directly
303
+ value
304
+ when /\AArray<(?<inner_type>.+)>\z/
305
+ inner_type = Regexp.last_match[:inner_type]
306
+ value.map { |v| _deserialize(inner_type, v) }
307
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
308
+ k_type = Regexp.last_match[:k_type]
309
+ v_type = Regexp.last_match[:v_type]
310
+ {}.tap do |hash|
311
+ value.each do |k, v|
312
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
313
+ end
314
+ end
315
+ else
316
+ # model
317
+ temp_model = AsposeWordsCloud.const_get(type).new
318
+ temp_model.build_from_hash(value)
319
+ end
320
+ end
321
+
322
+ # Returns the string representation of the object
323
+ # @return [String] String presentation of the object
324
+ def to_s
325
+ to_hash.to_s
326
+ end
327
+
328
+ # to_body is an alias to to_hash (backward compatibility)
329
+ # @return [Hash] Returns the object in the form of hash
330
+ def to_body
331
+ to_hash
332
+ end
333
+
334
+ # Returns the object in the form of hash
335
+ # @return [Hash] Returns the object in the form of hash
336
+ def to_hash
337
+ hash = {}
338
+ self.class.attribute_map.each_pair do |attr, param|
339
+ value = self.send(attr)
340
+ next if value.nil?
341
+ hash[param] = _to_hash(value)
342
+ end
343
+ hash
344
+ end
345
+
346
+ # Outputs non-array value in the form of hash
347
+ # For object, use to_hash. Otherwise, just return the value
348
+ # @param [Object] value Any valid value
349
+ # @return [Hash] Returns the value in the form of hash
350
+ def _to_hash(value)
351
+ if value.is_a?(Array)
352
+ value.compact.map { |v| _to_hash(v) }
353
+ elsif value.is_a?(Hash)
354
+ {}.tap do |hash|
355
+ value.each { |k, v| hash[k] = _to_hash(v) }
356
+ end
357
+ elsif value.respond_to? :to_hash
358
+ value.to_hash
359
+ else
360
+ value
361
+ end
362
+ end
363
+
364
+ end
365
+
366
+ end
@@ -0,0 +1,218 @@
1
+
2
+ require 'date'
3
+
4
+ module AsposeWordsCloud
5
+ #
6
+ # --------------------------------------------------------------------------------------------------------------------
7
+ # <copyright company="Aspose" file="ListLevels.rb">
8
+ # Copyright (c) 2019 Aspose.Words for Cloud
9
+ # </copyright>
10
+ # <summary>
11
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ # of this software and associated documentation files (the "Software"), to deal
13
+ # in the Software without restriction, including without limitation the rights
14
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ # copies of the Software, and to permit persons to whom the Software is
16
+ # furnished to do so, subject to the following conditions:
17
+ #
18
+ # The above copyright notice and this permission notice shall be included in all
19
+ # copies or substantial portions of the Software.
20
+ #
21
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ # SOFTWARE.
28
+ # </summary>
29
+ # --------------------------------------------------------------------------------------------------------------------
30
+ #
31
+
32
+ # Represents a single document list.
33
+ class ListLevels
34
+ attr_accessor :link
35
+
36
+ # Gets or sets the collection of list levels for this list.
37
+ attr_accessor :list_level
38
+
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
41
+ def self.attribute_map
42
+ {
43
+ :'link' => :'link',
44
+ :'list_level' => :'ListLevel'
45
+ }
46
+ end
47
+
48
+ # Attribute type mapping.
49
+ def self.swagger_types
50
+ {
51
+ :'link' => :'WordsApiLink',
52
+ :'list_level' => :'Array<ListLevel>'
53
+ }
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ return unless attributes.is_a?(Hash)
60
+
61
+ # convert string to symbol for hash key
62
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
63
+
64
+ if attributes.key?(:'link')
65
+ self.link = attributes[:'link']
66
+ end
67
+
68
+ if attributes.key?(:'ListLevel')
69
+ if (value = attributes[:'ListLevel']).is_a?(Array)
70
+ self.list_level = value
71
+ end
72
+ end
73
+
74
+ end
75
+
76
+ # Show invalid properties with the reasons. Usually used together with valid?
77
+ # @return Array for valid properies with the reasons
78
+ def list_invalid_properties
79
+ invalid_properties = []
80
+ return invalid_properties
81
+ end
82
+
83
+ # Check to see if the all the properties in the model are valid
84
+ # @return true if the model is valid
85
+ def valid?
86
+ return true
87
+ end
88
+
89
+ # Checks equality by comparing each attribute.
90
+ # @param [Object] Object to be compared
91
+ def ==(other)
92
+ return true if self.equal?(other)
93
+ self.class == other.class &&
94
+ link == other.link &&
95
+ list_level == other.list_level
96
+ end
97
+
98
+ # @see the `==` method
99
+ # @param [Object] Object to be compared
100
+ def eql?(other)
101
+ self == other
102
+ end
103
+
104
+ # Calculates hash code according to all attributes.
105
+ # @return [Fixnum] Hash code
106
+ def hash
107
+ [link, list_level].hash
108
+ end
109
+
110
+ # Builds the object from hash
111
+ # @param [Hash] attributes Model attributes in the form of hash
112
+ # @return [Object] Returns the model itself
113
+ def build_from_hash(attributes)
114
+ return nil unless attributes.is_a?(Hash)
115
+ self.class.swagger_types.each_pair do |key, type|
116
+ if type =~ /\AArray<(.*)>/i
117
+ # check to ensure the input is an array given that the the attribute
118
+ # is documented as an array but the input is not
119
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
120
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
121
+ end
122
+ elsif !attributes[self.class.attribute_map[key]].nil?
123
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
124
+ end
125
+ # or else data not found in attributes(hash), not an issue as the data can be optional
126
+ end
127
+
128
+ self
129
+ end
130
+
131
+ # Deserializes the data based on type
132
+ # @param string type Data type
133
+ # @param string value Value to be deserialized
134
+ # @return [Object] Deserialized data
135
+ def _deserialize(type, value)
136
+ case type.to_sym
137
+ when :DateTime
138
+ Time.at(/\d/.match(value)[0].to_f).to_datetime
139
+ when :Date
140
+ Time.at(/\d/.match(value)[0].to_f).to_date
141
+ when :String
142
+ value.to_s
143
+ when :Integer
144
+ value.to_i
145
+ when :Float
146
+ value.to_f
147
+ when :BOOLEAN
148
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
149
+ true
150
+ else
151
+ false
152
+ end
153
+ when :Object
154
+ # generic object (usually a Hash), return directly
155
+ value
156
+ when /\AArray<(?<inner_type>.+)>\z/
157
+ inner_type = Regexp.last_match[:inner_type]
158
+ value.map { |v| _deserialize(inner_type, v) }
159
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
160
+ k_type = Regexp.last_match[:k_type]
161
+ v_type = Regexp.last_match[:v_type]
162
+ {}.tap do |hash|
163
+ value.each do |k, v|
164
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
165
+ end
166
+ end
167
+ else
168
+ # model
169
+ temp_model = AsposeWordsCloud.const_get(type).new
170
+ temp_model.build_from_hash(value)
171
+ end
172
+ end
173
+
174
+ # Returns the string representation of the object
175
+ # @return [String] String presentation of the object
176
+ def to_s
177
+ to_hash.to_s
178
+ end
179
+
180
+ # to_body is an alias to to_hash (backward compatibility)
181
+ # @return [Hash] Returns the object in the form of hash
182
+ def to_body
183
+ to_hash
184
+ end
185
+
186
+ # Returns the object in the form of hash
187
+ # @return [Hash] Returns the object in the form of hash
188
+ def to_hash
189
+ hash = {}
190
+ self.class.attribute_map.each_pair do |attr, param|
191
+ value = self.send(attr)
192
+ next if value.nil?
193
+ hash[param] = _to_hash(value)
194
+ end
195
+ hash
196
+ end
197
+
198
+ # Outputs non-array value in the form of hash
199
+ # For object, use to_hash. Otherwise, just return the value
200
+ # @param [Object] value Any valid value
201
+ # @return [Hash] Returns the value in the form of hash
202
+ def _to_hash(value)
203
+ if value.is_a?(Array)
204
+ value.compact.map { |v| _to_hash(v) }
205
+ elsif value.is_a?(Hash)
206
+ {}.tap do |hash|
207
+ value.each { |k, v| hash[k] = _to_hash(v) }
208
+ end
209
+ elsif value.respond_to? :to_hash
210
+ value.to_hash
211
+ else
212
+ value
213
+ end
214
+ end
215
+
216
+ end
217
+
218
+ end