groupdocs_editor_cloud 19.11

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 (43) hide show
  1. checksums.yaml +7 -0
  2. data/lib/groupdocs_editor_cloud.rb +70 -0
  3. data/lib/groupdocs_editor_cloud/api/edit_api.rb +314 -0
  4. data/lib/groupdocs_editor_cloud/api/file_api.rb +729 -0
  5. data/lib/groupdocs_editor_cloud/api/folder_api.rb +694 -0
  6. data/lib/groupdocs_editor_cloud/api/info_api.rb +266 -0
  7. data/lib/groupdocs_editor_cloud/api/storage_api.rb +541 -0
  8. data/lib/groupdocs_editor_cloud/api_client.rb +380 -0
  9. data/lib/groupdocs_editor_cloud/api_error.rb +58 -0
  10. data/lib/groupdocs_editor_cloud/configuration.rb +95 -0
  11. data/lib/groupdocs_editor_cloud/models/delimited_text_load_options.rb +279 -0
  12. data/lib/groupdocs_editor_cloud/models/delimited_text_save_options.rb +304 -0
  13. data/lib/groupdocs_editor_cloud/models/disc_usage.rb +234 -0
  14. data/lib/groupdocs_editor_cloud/models/document_result.rb +214 -0
  15. data/lib/groupdocs_editor_cloud/models/error.rb +244 -0
  16. data/lib/groupdocs_editor_cloud/models/error_details.rb +229 -0
  17. data/lib/groupdocs_editor_cloud/models/file_info.rb +244 -0
  18. data/lib/groupdocs_editor_cloud/models/file_version.rb +289 -0
  19. data/lib/groupdocs_editor_cloud/models/file_versions.rb +216 -0
  20. data/lib/groupdocs_editor_cloud/models/files_list.rb +216 -0
  21. data/lib/groupdocs_editor_cloud/models/files_upload_result.rb +228 -0
  22. data/lib/groupdocs_editor_cloud/models/format.rb +224 -0
  23. data/lib/groupdocs_editor_cloud/models/formats_result.rb +216 -0
  24. data/lib/groupdocs_editor_cloud/models/info_result.rb +269 -0
  25. data/lib/groupdocs_editor_cloud/models/load_options.rb +224 -0
  26. data/lib/groupdocs_editor_cloud/models/load_result.rb +224 -0
  27. data/lib/groupdocs_editor_cloud/models/object_exist.rb +234 -0
  28. data/lib/groupdocs_editor_cloud/models/options.rb +224 -0
  29. data/lib/groupdocs_editor_cloud/models/pdf_save_options.rb +316 -0
  30. data/lib/groupdocs_editor_cloud/models/presentation_load_options.rb +254 -0
  31. data/lib/groupdocs_editor_cloud/models/presentation_save_options.rb +264 -0
  32. data/lib/groupdocs_editor_cloud/models/save_options.rb +254 -0
  33. data/lib/groupdocs_editor_cloud/models/spreadsheet_load_options.rb +254 -0
  34. data/lib/groupdocs_editor_cloud/models/spreadsheet_save_options.rb +326 -0
  35. data/lib/groupdocs_editor_cloud/models/storage_exist.rb +219 -0
  36. data/lib/groupdocs_editor_cloud/models/storage_file.rb +264 -0
  37. data/lib/groupdocs_editor_cloud/models/text_load_options.rb +347 -0
  38. data/lib/groupdocs_editor_cloud/models/text_save_options.rb +294 -0
  39. data/lib/groupdocs_editor_cloud/models/word_processing_load_options.rb +306 -0
  40. data/lib/groupdocs_editor_cloud/models/word_processing_save_options.rb +371 -0
  41. data/lib/groupdocs_editor_cloud/models/xml_load_options.rb +346 -0
  42. data/lib/groupdocs_editor_cloud/version.rb +29 -0
  43. metadata +153 -0
@@ -0,0 +1,264 @@
1
+ #
2
+ # --------------------------------------------------------------------------------------------------------------------
3
+ # <copyright company="Aspose Pty Ltd" file="storage_file.rb">
4
+ # Copyright (c) 2003-2019 Aspose Pty Ltd
5
+ # </copyright>
6
+ # <summary>
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"), to deal
9
+ # in the Software without restriction, including without limitation the rights
10
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ # copies of the Software, and to permit persons to whom the Software is
12
+ # furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included in all
15
+ # copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ # SOFTWARE.
24
+ # </summary>
25
+ # --------------------------------------------------------------------------------------------------------------------
26
+ #
27
+
28
+ require 'date'
29
+
30
+ module GroupDocsEditorCloud
31
+ # File or folder information
32
+ class StorageFile
33
+
34
+ # File or folder name.
35
+ attr_accessor :name
36
+
37
+ # True if it is a folder.
38
+ attr_accessor :is_folder
39
+
40
+ # File or folder last modified DateTime.
41
+ attr_accessor :modified_date
42
+
43
+ # File or folder size.
44
+ attr_accessor :size
45
+
46
+ # File or folder path.
47
+ attr_accessor :path
48
+
49
+ # Attribute mapping from ruby-style variable name to JSON key.
50
+ def self.attribute_map
51
+ {
52
+ :'name' => :'Name',
53
+ :'is_folder' => :'IsFolder',
54
+ :'modified_date' => :'ModifiedDate',
55
+ :'size' => :'Size',
56
+ :'path' => :'Path'
57
+ }
58
+ end
59
+
60
+ # Attribute type mapping.
61
+ def self.swagger_types
62
+ {
63
+ :'name' => :'String',
64
+ :'is_folder' => :'BOOLEAN',
65
+ :'modified_date' => :'DateTime',
66
+ :'size' => :'Integer',
67
+ :'path' => :'String'
68
+ }
69
+ end
70
+
71
+ # Initializes the object
72
+ # @param [Hash] attributes Model attributes in the form of hash
73
+ def initialize(attributes = {})
74
+ return unless attributes.is_a?(Hash)
75
+
76
+ # convert string to symbol for hash key
77
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
78
+
79
+ if attributes.key?(:'Name')
80
+ self.name = attributes[:'Name']
81
+ end
82
+
83
+ if attributes.key?(:'IsFolder')
84
+ self.is_folder = attributes[:'IsFolder']
85
+ end
86
+
87
+ if attributes.key?(:'ModifiedDate')
88
+ self.modified_date = attributes[:'ModifiedDate']
89
+ end
90
+
91
+ if attributes.key?(:'Size')
92
+ self.size = attributes[:'Size']
93
+ end
94
+
95
+ if attributes.key?(:'Path')
96
+ self.path = attributes[:'Path']
97
+ end
98
+
99
+ end
100
+
101
+ # Show invalid properties with the reasons. Usually used together with valid?
102
+ # @return Array for valid properies with the reasons
103
+ def list_invalid_properties
104
+ invalid_properties = []
105
+ if @is_folder.nil?
106
+ invalid_properties.push("invalid value for 'is_folder', is_folder cannot be nil.")
107
+ end
108
+
109
+ if @size.nil?
110
+ invalid_properties.push("invalid value for 'size', size cannot be nil.")
111
+ end
112
+
113
+ return invalid_properties
114
+ end
115
+
116
+ # Check to see if the all the properties in the model are valid
117
+ # @return true if the model is valid
118
+ def valid?
119
+ return false if @is_folder.nil?
120
+ return false if @size.nil?
121
+ return true
122
+ end
123
+
124
+ # Checks equality by comparing each attribute.
125
+ # @param [Object] Object to be compared
126
+ def ==(other)
127
+ return true if self.equal?(other)
128
+ self.class == other.class &&
129
+ name == other.name &&
130
+ is_folder == other.is_folder &&
131
+ modified_date == other.modified_date &&
132
+ size == other.size &&
133
+ path == other.path
134
+ end
135
+
136
+ # @see the `==` method
137
+ # @param [Object] Object to be compared
138
+ def eql?(other)
139
+ self == other
140
+ end
141
+
142
+ # Calculates hash code according to all attributes.
143
+ # @return [Fixnum] Hash code
144
+ def hash
145
+ [name, is_folder, modified_date, size, path].hash
146
+ end
147
+
148
+ # Downcases first letter.
149
+ # @return downcased string
150
+ def uncap(str)
151
+ str[0, 1].downcase + str[1..-1]
152
+ end
153
+
154
+ # Builds the object from hash
155
+ # @param [Hash] attributes Model attributes in the form of hash
156
+ # @return [Object] Returns the model itself
157
+ def build_from_hash(attributes)
158
+ return nil unless attributes.is_a?(Hash)
159
+ self.class.swagger_types.each_pair do |key, type|
160
+ pname = uncap(self.class.attribute_map[key]).intern
161
+ value = attributes[pname]
162
+ if type =~ /\AArray<(.*)>/i
163
+ # check to ensure the input is an array given that the the attribute
164
+ # is documented as an array but the input is not
165
+ if value.is_a?(Array)
166
+ self.send("#{key}=", value.map { |v| _deserialize($1, v) })
167
+ end
168
+ elsif !value.nil?
169
+ self.send("#{key}=", _deserialize(type, value))
170
+ end
171
+ # or else data not found in attributes(hash), not an issue as the data can be optional
172
+ end
173
+
174
+ self
175
+ end
176
+
177
+ # Deserializes the data based on type
178
+ # @param string type Data type
179
+ # @param string value Value to be deserialized
180
+ # @return [Object] Deserialized data
181
+ def _deserialize(type, value)
182
+ case type.to_sym
183
+ when :DateTime
184
+ Date.parse value
185
+ when :Date
186
+ Date.parse value
187
+ when :String
188
+ value.to_s
189
+ when :Integer
190
+ value.to_i
191
+ when :Float
192
+ value.to_f
193
+ when :BOOLEAN
194
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
195
+ true
196
+ else
197
+ false
198
+ end
199
+ when :Object
200
+ # generic object (usually a Hash), return directly
201
+ value
202
+ when /\AArray<(?<inner_type>.+)>\z/
203
+ inner_type = Regexp.last_match[:inner_type]
204
+ value.map { |v| _deserialize(inner_type, v) }
205
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
206
+ k_type = Regexp.last_match[:k_type]
207
+ v_type = Regexp.last_match[:v_type]
208
+ {}.tap do |hash|
209
+ value.each do |k, v|
210
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
211
+ end
212
+ end
213
+ else
214
+ # model
215
+ temp_model = GroupDocsEditorCloud.const_get(type).new
216
+ temp_model.build_from_hash(value)
217
+ end
218
+ end
219
+
220
+ # Returns the string representation of the object
221
+ # @return [String] String presentation of the object
222
+ def to_s
223
+ to_hash.to_s
224
+ end
225
+
226
+ # to_body is an alias to to_hash (backward compatibility)
227
+ # @return [Hash] Returns the object in the form of hash
228
+ def to_body
229
+ to_hash
230
+ end
231
+
232
+ # Returns the object in the form of hash
233
+ # @return [Hash] Returns the object in the form of hash
234
+ def to_hash
235
+ hash = {}
236
+ self.class.attribute_map.each_pair do |attr, param|
237
+ value = self.send(attr)
238
+ next if value.nil?
239
+ hash[param] = _to_hash(value)
240
+ end
241
+ hash
242
+ end
243
+
244
+ # Outputs non-array value in the form of hash
245
+ # For object, use to_hash. Otherwise, just return the value
246
+ # @param [Object] value Any valid value
247
+ # @return [Hash] Returns the value in the form of hash
248
+ def _to_hash(value)
249
+ if value.is_a?(Array)
250
+ value.compact.map { |v| _to_hash(v) }
251
+ elsif value.is_a?(Hash)
252
+ {}.tap do |hash|
253
+ value.each { |k, v| hash[k] = _to_hash(v) }
254
+ end
255
+ elsif value.respond_to? :to_hash
256
+ value.to_hash
257
+ else
258
+ value
259
+ end
260
+ end
261
+
262
+ end
263
+
264
+ end
@@ -0,0 +1,347 @@
1
+ #
2
+ # --------------------------------------------------------------------------------------------------------------------
3
+ # <copyright company="Aspose Pty Ltd" file="text_load_options.rb">
4
+ # Copyright (c) 2003-2019 Aspose Pty Ltd
5
+ # </copyright>
6
+ # <summary>
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"), to deal
9
+ # in the Software without restriction, including without limitation the rights
10
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ # copies of the Software, and to permit persons to whom the Software is
12
+ # furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included in all
15
+ # copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ # SOFTWARE.
24
+ # </summary>
25
+ # --------------------------------------------------------------------------------------------------------------------
26
+ #
27
+
28
+ require 'date'
29
+
30
+ module GroupDocsEditorCloud
31
+ # Allows to specify custom options for loading plain text (TXT) documents
32
+ class TextLoadOptions
33
+
34
+ # File info
35
+ attr_accessor :file_info
36
+
37
+ # The full output path
38
+ attr_accessor :output_path
39
+
40
+ # Character encoding of the text document, which will be applied for its opening
41
+ attr_accessor :encoding
42
+
43
+ # Allows to specify how numbered list items are recognized when document is imported from plain text format. The default value is true.
44
+ attr_accessor :recognize_lists
45
+
46
+ # Gets or sets preferred option of a leading space handling. By default converts leading spaces to the left indent.
47
+ attr_accessor :leading_spaces
48
+
49
+ # Gets or sets preferred option of a trailing space handling. By default truncates all trailing spaces.
50
+ attr_accessor :trailing_spaces
51
+
52
+ # Allows to enable or disable pagination in the resultant HTML document. By default is disabled (false).
53
+ attr_accessor :enable_pagination
54
+ class EnumAttributeValidator
55
+ attr_reader :datatype
56
+ attr_reader :allowable_values
57
+
58
+ def initialize(datatype, allowable_values)
59
+ @allowable_values = allowable_values.map do |value|
60
+ case datatype.to_s
61
+ when /Integer/i
62
+ value.to_i
63
+ when /Float/i
64
+ value.to_f
65
+ else
66
+ value
67
+ end
68
+ end
69
+ end
70
+
71
+ def valid?(value)
72
+ !value || allowable_values.include?(value)
73
+ end
74
+ end
75
+
76
+ # Attribute mapping from ruby-style variable name to JSON key.
77
+ def self.attribute_map
78
+ {
79
+ :'file_info' => :'FileInfo',
80
+ :'output_path' => :'OutputPath',
81
+ :'encoding' => :'Encoding',
82
+ :'recognize_lists' => :'RecognizeLists',
83
+ :'leading_spaces' => :'LeadingSpaces',
84
+ :'trailing_spaces' => :'TrailingSpaces',
85
+ :'enable_pagination' => :'EnablePagination'
86
+ }
87
+ end
88
+
89
+ # Attribute type mapping.
90
+ def self.swagger_types
91
+ {
92
+ :'file_info' => :'FileInfo',
93
+ :'output_path' => :'String',
94
+ :'encoding' => :'String',
95
+ :'recognize_lists' => :'BOOLEAN',
96
+ :'leading_spaces' => :'String',
97
+ :'trailing_spaces' => :'String',
98
+ :'enable_pagination' => :'BOOLEAN'
99
+ }
100
+ end
101
+
102
+ # Initializes the object
103
+ # @param [Hash] attributes Model attributes in the form of hash
104
+ def initialize(attributes = {})
105
+ return unless attributes.is_a?(Hash)
106
+
107
+ # convert string to symbol for hash key
108
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
109
+
110
+ if attributes.key?(:'FileInfo')
111
+ self.file_info = attributes[:'FileInfo']
112
+ end
113
+
114
+ if attributes.key?(:'OutputPath')
115
+ self.output_path = attributes[:'OutputPath']
116
+ end
117
+
118
+ if attributes.key?(:'Encoding')
119
+ self.encoding = attributes[:'Encoding']
120
+ end
121
+
122
+ if attributes.key?(:'RecognizeLists')
123
+ self.recognize_lists = attributes[:'RecognizeLists']
124
+ end
125
+
126
+ if attributes.key?(:'LeadingSpaces')
127
+ self.leading_spaces = attributes[:'LeadingSpaces']
128
+ end
129
+
130
+ if attributes.key?(:'TrailingSpaces')
131
+ self.trailing_spaces = attributes[:'TrailingSpaces']
132
+ end
133
+
134
+ if attributes.key?(:'EnablePagination')
135
+ self.enable_pagination = attributes[:'EnablePagination']
136
+ end
137
+
138
+ end
139
+
140
+ # Show invalid properties with the reasons. Usually used together with valid?
141
+ # @return Array for valid properies with the reasons
142
+ def list_invalid_properties
143
+ invalid_properties = []
144
+ if @recognize_lists.nil?
145
+ invalid_properties.push("invalid value for 'recognize_lists', recognize_lists cannot be nil.")
146
+ end
147
+
148
+ if @leading_spaces.nil?
149
+ invalid_properties.push("invalid value for 'leading_spaces', leading_spaces cannot be nil.")
150
+ end
151
+
152
+ if @trailing_spaces.nil?
153
+ invalid_properties.push("invalid value for 'trailing_spaces', trailing_spaces cannot be nil.")
154
+ end
155
+
156
+ if @enable_pagination.nil?
157
+ invalid_properties.push("invalid value for 'enable_pagination', enable_pagination cannot be nil.")
158
+ end
159
+
160
+ return invalid_properties
161
+ end
162
+
163
+ # Check to see if the all the properties in the model are valid
164
+ # @return true if the model is valid
165
+ def valid?
166
+ return false if @recognize_lists.nil?
167
+ return false if @leading_spaces.nil?
168
+ leading_spaces_validator = EnumAttributeValidator.new('String', ["ConvertToIndent", "Preserve", "Trim"])
169
+ return false unless leading_spaces_validator.valid?(@leading_spaces)
170
+ return false if @trailing_spaces.nil?
171
+ trailing_spaces_validator = EnumAttributeValidator.new('String', ["Trim", "Preserve"])
172
+ return false unless trailing_spaces_validator.valid?(@trailing_spaces)
173
+ return false if @enable_pagination.nil?
174
+ return true
175
+ end
176
+
177
+ # Custom attribute writer method checking allowed values (enum).
178
+ # @param [Object] leading_spaces Object to be assigned
179
+ def leading_spaces=(leading_spaces)
180
+ validator = EnumAttributeValidator.new('String', ["ConvertToIndent", "Preserve", "Trim"])
181
+ if leading_spaces.to_i == 0
182
+ unless validator.valid?(leading_spaces)
183
+ raise ArgumentError, "invalid value for 'leading_spaces', must be one of #{validator.allowable_values}."
184
+ end
185
+ @leading_spaces = leading_spaces
186
+ else
187
+ @leading_spaces = validator.allowable_values[leading_spaces.to_i]
188
+ end
189
+ end
190
+
191
+ # Custom attribute writer method checking allowed values (enum).
192
+ # @param [Object] trailing_spaces Object to be assigned
193
+ def trailing_spaces=(trailing_spaces)
194
+ validator = EnumAttributeValidator.new('String', ["Trim", "Preserve"])
195
+ if trailing_spaces.to_i == 0
196
+ unless validator.valid?(trailing_spaces)
197
+ raise ArgumentError, "invalid value for 'trailing_spaces', must be one of #{validator.allowable_values}."
198
+ end
199
+ @trailing_spaces = trailing_spaces
200
+ else
201
+ @trailing_spaces = validator.allowable_values[trailing_spaces.to_i]
202
+ end
203
+ end
204
+
205
+ # Checks equality by comparing each attribute.
206
+ # @param [Object] Object to be compared
207
+ def ==(other)
208
+ return true if self.equal?(other)
209
+ self.class == other.class &&
210
+ file_info == other.file_info &&
211
+ output_path == other.output_path &&
212
+ encoding == other.encoding &&
213
+ recognize_lists == other.recognize_lists &&
214
+ leading_spaces == other.leading_spaces &&
215
+ trailing_spaces == other.trailing_spaces &&
216
+ enable_pagination == other.enable_pagination
217
+ end
218
+
219
+ # @see the `==` method
220
+ # @param [Object] Object to be compared
221
+ def eql?(other)
222
+ self == other
223
+ end
224
+
225
+ # Calculates hash code according to all attributes.
226
+ # @return [Fixnum] Hash code
227
+ def hash
228
+ [file_info, output_path, encoding, recognize_lists, leading_spaces, trailing_spaces, enable_pagination].hash
229
+ end
230
+
231
+ # Downcases first letter.
232
+ # @return downcased string
233
+ def uncap(str)
234
+ str[0, 1].downcase + str[1..-1]
235
+ end
236
+
237
+ # Builds the object from hash
238
+ # @param [Hash] attributes Model attributes in the form of hash
239
+ # @return [Object] Returns the model itself
240
+ def build_from_hash(attributes)
241
+ return nil unless attributes.is_a?(Hash)
242
+ self.class.swagger_types.each_pair do |key, type|
243
+ pname = uncap(self.class.attribute_map[key]).intern
244
+ value = attributes[pname]
245
+ if type =~ /\AArray<(.*)>/i
246
+ # check to ensure the input is an array given that the the attribute
247
+ # is documented as an array but the input is not
248
+ if value.is_a?(Array)
249
+ self.send("#{key}=", value.map { |v| _deserialize($1, v) })
250
+ end
251
+ elsif !value.nil?
252
+ self.send("#{key}=", _deserialize(type, value))
253
+ end
254
+ # or else data not found in attributes(hash), not an issue as the data can be optional
255
+ end
256
+
257
+ self
258
+ end
259
+
260
+ # Deserializes the data based on type
261
+ # @param string type Data type
262
+ # @param string value Value to be deserialized
263
+ # @return [Object] Deserialized data
264
+ def _deserialize(type, value)
265
+ case type.to_sym
266
+ when :DateTime
267
+ Date.parse value
268
+ when :Date
269
+ Date.parse value
270
+ when :String
271
+ value.to_s
272
+ when :Integer
273
+ value.to_i
274
+ when :Float
275
+ value.to_f
276
+ when :BOOLEAN
277
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
278
+ true
279
+ else
280
+ false
281
+ end
282
+ when :Object
283
+ # generic object (usually a Hash), return directly
284
+ value
285
+ when /\AArray<(?<inner_type>.+)>\z/
286
+ inner_type = Regexp.last_match[:inner_type]
287
+ value.map { |v| _deserialize(inner_type, v) }
288
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
289
+ k_type = Regexp.last_match[:k_type]
290
+ v_type = Regexp.last_match[:v_type]
291
+ {}.tap do |hash|
292
+ value.each do |k, v|
293
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
294
+ end
295
+ end
296
+ else
297
+ # model
298
+ temp_model = GroupDocsEditorCloud.const_get(type).new
299
+ temp_model.build_from_hash(value)
300
+ end
301
+ end
302
+
303
+ # Returns the string representation of the object
304
+ # @return [String] String presentation of the object
305
+ def to_s
306
+ to_hash.to_s
307
+ end
308
+
309
+ # to_body is an alias to to_hash (backward compatibility)
310
+ # @return [Hash] Returns the object in the form of hash
311
+ def to_body
312
+ to_hash
313
+ end
314
+
315
+ # Returns the object in the form of hash
316
+ # @return [Hash] Returns the object in the form of hash
317
+ def to_hash
318
+ hash = {}
319
+ self.class.attribute_map.each_pair do |attr, param|
320
+ value = self.send(attr)
321
+ next if value.nil?
322
+ hash[param] = _to_hash(value)
323
+ end
324
+ hash
325
+ end
326
+
327
+ # Outputs non-array value in the form of hash
328
+ # For object, use to_hash. Otherwise, just return the value
329
+ # @param [Object] value Any valid value
330
+ # @return [Hash] Returns the value in the form of hash
331
+ def _to_hash(value)
332
+ if value.is_a?(Array)
333
+ value.compact.map { |v| _to_hash(v) }
334
+ elsif value.is_a?(Hash)
335
+ {}.tap do |hash|
336
+ value.each { |k, v| hash[k] = _to_hash(v) }
337
+ end
338
+ elsif value.respond_to? :to_hash
339
+ value.to_hash
340
+ else
341
+ value
342
+ end
343
+ end
344
+
345
+ end
346
+
347
+ end