groupdocs_comparison_cloud 18.9

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 (30) hide show
  1. checksums.yaml +7 -0
  2. data/lib/groupdocs_comparison_cloud.rb +76 -0
  3. data/lib/groupdocs_comparison_cloud/api/changes_api.rb +470 -0
  4. data/lib/groupdocs_comparison_cloud/api/comparison_api.rb +365 -0
  5. data/lib/groupdocs_comparison_cloud/api_client.rb +390 -0
  6. data/lib/groupdocs_comparison_cloud/api_error.rb +56 -0
  7. data/lib/groupdocs_comparison_cloud/configuration.rb +95 -0
  8. data/lib/groupdocs_comparison_cloud/models/color.rb +1404 -0
  9. data/lib/groupdocs_comparison_cloud/models/comparison_change.rb +265 -0
  10. data/lib/groupdocs_comparison_cloud/models/comparison_changes_category_dto.rb +218 -0
  11. data/lib/groupdocs_comparison_cloud/models/comparison_file_info.rb +226 -0
  12. data/lib/groupdocs_comparison_cloud/models/comparison_metadata_values.rb +226 -0
  13. data/lib/groupdocs_comparison_cloud/models/comparison_request.rb +240 -0
  14. data/lib/groupdocs_comparison_cloud/models/comparison_request_settings.rb +378 -0
  15. data/lib/groupdocs_comparison_cloud/models/comparison_style_change.rb +206 -0
  16. data/lib/groupdocs_comparison_cloud/models/link.rb +236 -0
  17. data/lib/groupdocs_comparison_cloud/models/requests/comparison_images_request.rb +49 -0
  18. data/lib/groupdocs_comparison_cloud/models/requests/comparison_images_stream_request.rb +45 -0
  19. data/lib/groupdocs_comparison_cloud/models/requests/comparison_request.rb +49 -0
  20. data/lib/groupdocs_comparison_cloud/models/requests/comparison_stream_request.rb +45 -0
  21. data/lib/groupdocs_comparison_cloud/models/requests/post_categories_changes_request.rb +49 -0
  22. data/lib/groupdocs_comparison_cloud/models/requests/post_changes_request.rb +45 -0
  23. data/lib/groupdocs_comparison_cloud/models/requests/put_changes_document_request.rb +49 -0
  24. data/lib/groupdocs_comparison_cloud/models/requests/put_changes_document_stream_request.rb +45 -0
  25. data/lib/groupdocs_comparison_cloud/models/requests/put_changes_images_request.rb +49 -0
  26. data/lib/groupdocs_comparison_cloud/models/requests/put_changes_images_stream_request.rb +45 -0
  27. data/lib/groupdocs_comparison_cloud/models/style_settings_values.rb +231 -0
  28. data/lib/groupdocs_comparison_cloud/models/value_type.rb +196 -0
  29. data/lib/groupdocs_comparison_cloud/version.rb +29 -0
  30. metadata +160 -0
@@ -0,0 +1,240 @@
1
+ #
2
+ # --------------------------------------------------------------------------------------------------------------------
3
+ # <copyright company="Aspose Pty Ltd" file="comparison_request.rb">
4
+ # Copyright (c) 2003-2018 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 GroupDocsComparisonCloud
31
+ # ComparisonRequest
32
+ class ComparisonRequest
33
+
34
+ # The source name
35
+ attr_accessor :source_file
36
+
37
+ # The files names
38
+ attr_accessor :target_files
39
+
40
+ # The settings
41
+ attr_accessor :settings
42
+
43
+ # The changes
44
+ attr_accessor :changes
45
+
46
+ # Attribute mapping from ruby-style variable name to JSON key.
47
+ def self.attribute_map
48
+ {
49
+ :'source_file' => :'SourceFile',
50
+ :'target_files' => :'TargetFiles',
51
+ :'settings' => :'Settings',
52
+ :'changes' => :'Changes'
53
+ }
54
+ end
55
+
56
+ # Attribute type mapping.
57
+ def self.swagger_types
58
+ {
59
+ :'source_file' => :'ComparisonFileInfo',
60
+ :'target_files' => :'Array<ComparisonFileInfo>',
61
+ :'settings' => :'ComparisonRequestSettings',
62
+ :'changes' => :'Array<ComparisonChange>'
63
+ }
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ return unless attributes.is_a?(Hash)
70
+
71
+ # convert string to symbol for hash key
72
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
73
+
74
+ if attributes.key?(:'sourceFile')
75
+ self.source_file = attributes[:'sourceFile']
76
+ end
77
+
78
+ if attributes.key?(:'targetFiles')
79
+ if (value = attributes[:'targetFiles']).is_a?(Array)
80
+ self.target_files = value
81
+ end
82
+ end
83
+
84
+ if attributes.key?(:'settings')
85
+ self.settings = attributes[:'settings']
86
+ end
87
+
88
+ if attributes.key?(:'changes')
89
+ if (value = attributes[:'changes']).is_a?(Array)
90
+ self.changes = value
91
+ end
92
+ end
93
+
94
+ end
95
+
96
+ # Show invalid properties with the reasons. Usually used together with valid?
97
+ # @return Array for valid properies with the reasons
98
+ def list_invalid_properties
99
+ invalid_properties = []
100
+ return invalid_properties
101
+ end
102
+
103
+ # Check to see if the all the properties in the model are valid
104
+ # @return true if the model is valid
105
+ def valid?
106
+ return true
107
+ end
108
+
109
+ # Checks equality by comparing each attribute.
110
+ # @param [Object] Object to be compared
111
+ def ==(other)
112
+ return true if self.equal?(other)
113
+ self.class == other.class &&
114
+ source_file == other.source_file &&
115
+ target_files == other.target_files &&
116
+ settings == other.settings &&
117
+ changes == other.changes
118
+ end
119
+
120
+ # @see the `==` method
121
+ # @param [Object] Object to be compared
122
+ def eql?(other)
123
+ self == other
124
+ end
125
+
126
+ # Calculates hash code according to all attributes.
127
+ # @return [Fixnum] Hash code
128
+ def hash
129
+ [source_file, target_files, settings, changes].hash
130
+ end
131
+
132
+ # Builds the object from hash
133
+ # @param [Hash] attributes Model attributes in the form of hash
134
+ # @return [Object] Returns the model itself
135
+ def build_from_hash(attributes)
136
+ return nil unless attributes.is_a?(Hash)
137
+ self.class.swagger_types.each_pair do |key, type|
138
+ if type =~ /\AArray<(.*)>/i
139
+ # check to ensure the input is an array given that the the attribute
140
+ # is documented as an array but the input is not
141
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
142
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
143
+ end
144
+ elsif !attributes[self.class.attribute_map[key]].nil?
145
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
146
+ end
147
+ # or else data not found in attributes(hash), not an issue as the data can be optional
148
+ end
149
+
150
+ self
151
+ end
152
+
153
+ # Deserializes the data based on type
154
+ # @param string type Data type
155
+ # @param string value Value to be deserialized
156
+ # @return [Object] Deserialized data
157
+ def _deserialize(type, value)
158
+ case type.to_sym
159
+ when :DateTime
160
+ Time.at(/\d/.match(value)[0].to_f).to_datetime
161
+ when :Date
162
+ Time.at(/\d/.match(value)[0].to_f).to_date
163
+ when :String
164
+ value.to_s
165
+ when :Integer
166
+ value.to_i
167
+ when :Float
168
+ value.to_f
169
+ when :BOOLEAN
170
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
171
+ true
172
+ else
173
+ false
174
+ end
175
+ when :Object
176
+ # generic object (usually a Hash), return directly
177
+ value
178
+ when /\AArray<(?<inner_type>.+)>\z/
179
+ inner_type = Regexp.last_match[:inner_type]
180
+ value.map { |v| _deserialize(inner_type, v) }
181
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
182
+ k_type = Regexp.last_match[:k_type]
183
+ v_type = Regexp.last_match[:v_type]
184
+ {}.tap do |hash|
185
+ value.each do |k, v|
186
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
187
+ end
188
+ end
189
+ else
190
+ # model
191
+ temp_model = GroupDocsComparisonCloud.const_get(type).new
192
+ temp_model.build_from_hash(value)
193
+ end
194
+ end
195
+
196
+ # Returns the string representation of the object
197
+ # @return [String] String presentation of the object
198
+ def to_s
199
+ to_hash.to_s
200
+ end
201
+
202
+ # to_body is an alias to to_hash (backward compatibility)
203
+ # @return [Hash] Returns the object in the form of hash
204
+ def to_body
205
+ to_hash
206
+ end
207
+
208
+ # Returns the object in the form of hash
209
+ # @return [Hash] Returns the object in the form of hash
210
+ def to_hash
211
+ hash = {}
212
+ self.class.attribute_map.each_pair do |attr, param|
213
+ value = self.send(attr)
214
+ next if value.nil?
215
+ hash[param] = _to_hash(value)
216
+ end
217
+ hash
218
+ end
219
+
220
+ # Outputs non-array value in the form of hash
221
+ # For object, use to_hash. Otherwise, just return the value
222
+ # @param [Object] value Any valid value
223
+ # @return [Hash] Returns the value in the form of hash
224
+ def _to_hash(value)
225
+ if value.is_a?(Array)
226
+ value.compact.map { |v| _to_hash(v) }
227
+ elsif value.is_a?(Hash)
228
+ {}.tap do |hash|
229
+ value.each { |k, v| hash[k] = _to_hash(v) }
230
+ end
231
+ elsif value.respond_to? :to_hash
232
+ value.to_hash
233
+ else
234
+ value
235
+ end
236
+ end
237
+
238
+ end
239
+
240
+ end
@@ -0,0 +1,378 @@
1
+ #
2
+ # --------------------------------------------------------------------------------------------------------------------
3
+ # <copyright company="Aspose Pty Ltd" file="comparison_request_settings.rb">
4
+ # Copyright (c) 2003-2018 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 GroupDocsComparisonCloud
31
+ # ComparisonRequestSettings dto
32
+ class ComparisonRequestSettings
33
+
34
+ # The generate summary page
35
+ attr_accessor :generate_summary_page
36
+
37
+ # The show deleted content
38
+ attr_accessor :show_deleted_content
39
+
40
+ # The style change detection
41
+ attr_accessor :style_change_detection
42
+
43
+ # The inserted items style
44
+ attr_accessor :inserted_items_style
45
+
46
+ # The deleted items style
47
+ attr_accessor :deleted_items_style
48
+
49
+ # The style changed items style
50
+ attr_accessor :style_changed_items_style
51
+
52
+ # The words separator chars
53
+ attr_accessor :words_separator_chars
54
+
55
+ # The use frames for delete ins elements
56
+ attr_accessor :use_frames_for_del_ins_elements
57
+
58
+ # The detail level
59
+ attr_accessor :detail_level
60
+
61
+ # The calculate component coordinates
62
+ attr_accessor :calculate_component_coordinates
63
+
64
+ # The clone metadata
65
+ attr_accessor :clone_metadata
66
+
67
+ # The metadata
68
+ attr_accessor :meta_data
69
+
70
+ # The password save option
71
+ attr_accessor :password_save_option
72
+
73
+ # The password
74
+ attr_accessor :password
75
+
76
+ # The mark deleted inserted content deep
77
+ attr_accessor :mark_deleted_inserted_content_deep
78
+
79
+ # Attribute mapping from ruby-style variable name to JSON key.
80
+ def self.attribute_map
81
+ {
82
+ :'generate_summary_page' => :'GenerateSummaryPage',
83
+ :'show_deleted_content' => :'ShowDeletedContent',
84
+ :'style_change_detection' => :'StyleChangeDetection',
85
+ :'inserted_items_style' => :'InsertedItemsStyle',
86
+ :'deleted_items_style' => :'DeletedItemsStyle',
87
+ :'style_changed_items_style' => :'StyleChangedItemsStyle',
88
+ :'words_separator_chars' => :'WordsSeparatorChars',
89
+ :'use_frames_for_del_ins_elements' => :'UseFramesForDelInsElements',
90
+ :'detail_level' => :'DetailLevel',
91
+ :'calculate_component_coordinates' => :'CalculateComponentCoordinates',
92
+ :'clone_metadata' => :'CloneMetadata',
93
+ :'meta_data' => :'MetaData',
94
+ :'password_save_option' => :'PasswordSaveOption',
95
+ :'password' => :'Password',
96
+ :'mark_deleted_inserted_content_deep' => :'MarkDeletedInsertedContentDeep'
97
+ }
98
+ end
99
+
100
+ # Attribute type mapping.
101
+ def self.swagger_types
102
+ {
103
+ :'generate_summary_page' => :'BOOLEAN',
104
+ :'show_deleted_content' => :'BOOLEAN',
105
+ :'style_change_detection' => :'BOOLEAN',
106
+ :'inserted_items_style' => :'StyleSettingsValues',
107
+ :'deleted_items_style' => :'StyleSettingsValues',
108
+ :'style_changed_items_style' => :'StyleSettingsValues',
109
+ :'words_separator_chars' => :'Array<String>',
110
+ :'use_frames_for_del_ins_elements' => :'BOOLEAN',
111
+ :'detail_level' => :'String',
112
+ :'calculate_component_coordinates' => :'BOOLEAN',
113
+ :'clone_metadata' => :'String',
114
+ :'meta_data' => :'ComparisonMetadataValues',
115
+ :'password_save_option' => :'String',
116
+ :'password' => :'String',
117
+ :'mark_deleted_inserted_content_deep' => :'BOOLEAN'
118
+ }
119
+ end
120
+
121
+ # Initializes the object
122
+ # @param [Hash] attributes Model attributes in the form of hash
123
+ def initialize(attributes = {})
124
+ return unless attributes.is_a?(Hash)
125
+
126
+ # convert string to symbol for hash key
127
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
128
+
129
+ if attributes.key?(:'generateSummaryPage')
130
+ self.generate_summary_page = attributes[:'generateSummaryPage']
131
+ end
132
+
133
+ if attributes.key?(:'showDeletedContent')
134
+ self.show_deleted_content = attributes[:'showDeletedContent']
135
+ end
136
+
137
+ if attributes.key?(:'styleChangeDetection')
138
+ self.style_change_detection = attributes[:'styleChangeDetection']
139
+ end
140
+
141
+ if attributes.key?(:'insertedItemsStyle')
142
+ self.inserted_items_style = attributes[:'insertedItemsStyle']
143
+ end
144
+
145
+ if attributes.key?(:'deletedItemsStyle')
146
+ self.deleted_items_style = attributes[:'deletedItemsStyle']
147
+ end
148
+
149
+ if attributes.key?(:'styleChangedItemsStyle')
150
+ self.style_changed_items_style = attributes[:'styleChangedItemsStyle']
151
+ end
152
+
153
+ if attributes.key?(:'wordsSeparatorChars')
154
+ if (value = attributes[:'wordsSeparatorChars']).is_a?(Array)
155
+ self.words_separator_chars = value
156
+ end
157
+ end
158
+
159
+ if attributes.key?(:'useFramesForDelInsElements')
160
+ self.use_frames_for_del_ins_elements = attributes[:'useFramesForDelInsElements']
161
+ end
162
+
163
+ if attributes.key?(:'detailLevel')
164
+ self.detail_level = attributes[:'detailLevel']
165
+ end
166
+
167
+ if attributes.key?(:'calculateComponentCoordinates')
168
+ self.calculate_component_coordinates = attributes[:'calculateComponentCoordinates']
169
+ end
170
+
171
+ if attributes.key?(:'cloneMetadata')
172
+ self.clone_metadata = attributes[:'cloneMetadata']
173
+ end
174
+
175
+ if attributes.key?(:'metaData')
176
+ self.meta_data = attributes[:'metaData']
177
+ end
178
+
179
+ if attributes.key?(:'passwordSaveOption')
180
+ self.password_save_option = attributes[:'passwordSaveOption']
181
+ end
182
+
183
+ if attributes.key?(:'password')
184
+ self.password = attributes[:'password']
185
+ end
186
+
187
+ if attributes.key?(:'markDeletedInsertedContentDeep')
188
+ self.mark_deleted_inserted_content_deep = attributes[:'markDeletedInsertedContentDeep']
189
+ end
190
+
191
+ end
192
+
193
+ # Show invalid properties with the reasons. Usually used together with valid?
194
+ # @return Array for valid properies with the reasons
195
+ def list_invalid_properties
196
+ invalid_properties = []
197
+ if @generate_summary_page.nil?
198
+ invalid_properties.push("invalid value for 'generate_summary_page', generate_summary_page cannot be nil.")
199
+ end
200
+
201
+ if @show_deleted_content.nil?
202
+ invalid_properties.push("invalid value for 'show_deleted_content', show_deleted_content cannot be nil.")
203
+ end
204
+
205
+ if @style_change_detection.nil?
206
+ invalid_properties.push("invalid value for 'style_change_detection', style_change_detection cannot be nil.")
207
+ end
208
+
209
+ if @use_frames_for_del_ins_elements.nil?
210
+ invalid_properties.push("invalid value for 'use_frames_for_del_ins_elements', use_frames_for_del_ins_elements cannot be nil.")
211
+ end
212
+
213
+ if @calculate_component_coordinates.nil?
214
+ invalid_properties.push("invalid value for 'calculate_component_coordinates', calculate_component_coordinates cannot be nil.")
215
+ end
216
+
217
+ if @mark_deleted_inserted_content_deep.nil?
218
+ invalid_properties.push("invalid value for 'mark_deleted_inserted_content_deep', mark_deleted_inserted_content_deep cannot be nil.")
219
+ end
220
+
221
+ return invalid_properties
222
+ end
223
+
224
+ # Check to see if the all the properties in the model are valid
225
+ # @return true if the model is valid
226
+ def valid?
227
+ return false if @generate_summary_page.nil?
228
+ return false if @show_deleted_content.nil?
229
+ return false if @style_change_detection.nil?
230
+ return false if @use_frames_for_del_ins_elements.nil?
231
+ return false if @calculate_component_coordinates.nil?
232
+ return false if @mark_deleted_inserted_content_deep.nil?
233
+ return true
234
+ end
235
+
236
+ # Checks equality by comparing each attribute.
237
+ # @param [Object] Object to be compared
238
+ def ==(other)
239
+ return true if self.equal?(other)
240
+ self.class == other.class &&
241
+ generate_summary_page == other.generate_summary_page &&
242
+ show_deleted_content == other.show_deleted_content &&
243
+ style_change_detection == other.style_change_detection &&
244
+ inserted_items_style == other.inserted_items_style &&
245
+ deleted_items_style == other.deleted_items_style &&
246
+ style_changed_items_style == other.style_changed_items_style &&
247
+ words_separator_chars == other.words_separator_chars &&
248
+ use_frames_for_del_ins_elements == other.use_frames_for_del_ins_elements &&
249
+ detail_level == other.detail_level &&
250
+ calculate_component_coordinates == other.calculate_component_coordinates &&
251
+ clone_metadata == other.clone_metadata &&
252
+ meta_data == other.meta_data &&
253
+ password_save_option == other.password_save_option &&
254
+ password == other.password &&
255
+ mark_deleted_inserted_content_deep == other.mark_deleted_inserted_content_deep
256
+ end
257
+
258
+ # @see the `==` method
259
+ # @param [Object] Object to be compared
260
+ def eql?(other)
261
+ self == other
262
+ end
263
+
264
+ # Calculates hash code according to all attributes.
265
+ # @return [Fixnum] Hash code
266
+ def hash
267
+ [generate_summary_page, show_deleted_content, style_change_detection, inserted_items_style, deleted_items_style, style_changed_items_style, words_separator_chars, use_frames_for_del_ins_elements, detail_level, calculate_component_coordinates, clone_metadata, meta_data, password_save_option, password, mark_deleted_inserted_content_deep].hash
268
+ end
269
+
270
+ # Builds the object from hash
271
+ # @param [Hash] attributes Model attributes in the form of hash
272
+ # @return [Object] Returns the model itself
273
+ def build_from_hash(attributes)
274
+ return nil unless attributes.is_a?(Hash)
275
+ self.class.swagger_types.each_pair do |key, type|
276
+ if type =~ /\AArray<(.*)>/i
277
+ # check to ensure the input is an array given that the the attribute
278
+ # is documented as an array but the input is not
279
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
280
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
281
+ end
282
+ elsif !attributes[self.class.attribute_map[key]].nil?
283
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
284
+ end
285
+ # or else data not found in attributes(hash), not an issue as the data can be optional
286
+ end
287
+
288
+ self
289
+ end
290
+
291
+ # Deserializes the data based on type
292
+ # @param string type Data type
293
+ # @param string value Value to be deserialized
294
+ # @return [Object] Deserialized data
295
+ def _deserialize(type, value)
296
+ case type.to_sym
297
+ when :DateTime
298
+ Time.at(/\d/.match(value)[0].to_f).to_datetime
299
+ when :Date
300
+ Time.at(/\d/.match(value)[0].to_f).to_date
301
+ when :String
302
+ value.to_s
303
+ when :Integer
304
+ value.to_i
305
+ when :Float
306
+ value.to_f
307
+ when :BOOLEAN
308
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
309
+ true
310
+ else
311
+ false
312
+ end
313
+ when :Object
314
+ # generic object (usually a Hash), return directly
315
+ value
316
+ when /\AArray<(?<inner_type>.+)>\z/
317
+ inner_type = Regexp.last_match[:inner_type]
318
+ value.map { |v| _deserialize(inner_type, v) }
319
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
320
+ k_type = Regexp.last_match[:k_type]
321
+ v_type = Regexp.last_match[:v_type]
322
+ {}.tap do |hash|
323
+ value.each do |k, v|
324
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
325
+ end
326
+ end
327
+ else
328
+ # model
329
+ temp_model = GroupDocsComparisonCloud.const_get(type).new
330
+ temp_model.build_from_hash(value)
331
+ end
332
+ end
333
+
334
+ # Returns the string representation of the object
335
+ # @return [String] String presentation of the object
336
+ def to_s
337
+ to_hash.to_s
338
+ end
339
+
340
+ # to_body is an alias to to_hash (backward compatibility)
341
+ # @return [Hash] Returns the object in the form of hash
342
+ def to_body
343
+ to_hash
344
+ end
345
+
346
+ # Returns the object in the form of hash
347
+ # @return [Hash] Returns the object in the form of hash
348
+ def to_hash
349
+ hash = {}
350
+ self.class.attribute_map.each_pair do |attr, param|
351
+ value = self.send(attr)
352
+ next if value.nil?
353
+ hash[param] = _to_hash(value)
354
+ end
355
+ hash
356
+ end
357
+
358
+ # Outputs non-array value in the form of hash
359
+ # For object, use to_hash. Otherwise, just return the value
360
+ # @param [Object] value Any valid value
361
+ # @return [Hash] Returns the value in the form of hash
362
+ def _to_hash(value)
363
+ if value.is_a?(Array)
364
+ value.compact.map { |v| _to_hash(v) }
365
+ elsif value.is_a?(Hash)
366
+ {}.tap do |hash|
367
+ value.each { |k, v| hash[k] = _to_hash(v) }
368
+ end
369
+ elsif value.respond_to? :to_hash
370
+ value.to_hash
371
+ else
372
+ value
373
+ end
374
+ end
375
+
376
+ end
377
+
378
+ end