groupdocs_comparison_cloud 18.9 → 19.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/lib/groupdocs_comparison_cloud.rb +28 -42
  3. data/lib/groupdocs_comparison_cloud/api/compare_api.rb +411 -0
  4. data/lib/groupdocs_comparison_cloud/api/file_api.rb +729 -0
  5. data/lib/groupdocs_comparison_cloud/api/folder_api.rb +694 -0
  6. data/lib/groupdocs_comparison_cloud/api/info_api.rb +169 -0
  7. data/lib/groupdocs_comparison_cloud/api/storage_api.rb +541 -0
  8. data/lib/groupdocs_comparison_cloud/api_client.rb +7 -17
  9. data/lib/groupdocs_comparison_cloud/api_error.rb +5 -3
  10. data/lib/groupdocs_comparison_cloud/configuration.rb +3 -3
  11. data/lib/groupdocs_comparison_cloud/models/{comparison_change.rb → change_info.rb} +57 -49
  12. data/lib/groupdocs_comparison_cloud/models/diagram_master_setting.rb +259 -0
  13. data/lib/groupdocs_comparison_cloud/models/disc_usage.rb +234 -0
  14. data/lib/groupdocs_comparison_cloud/models/error.rb +244 -0
  15. data/lib/groupdocs_comparison_cloud/models/{comparison_file_info.rb → error_details.rb} +39 -36
  16. data/lib/groupdocs_comparison_cloud/models/{style_settings_values.rb → file_info.rb} +51 -38
  17. data/lib/groupdocs_comparison_cloud/models/file_version.rb +289 -0
  18. data/lib/groupdocs_comparison_cloud/models/{value_type.rb → file_versions.rb} +33 -13
  19. data/lib/groupdocs_comparison_cloud/models/{comparison_changes_category_dto.rb → files_list.rb} +28 -30
  20. data/lib/groupdocs_comparison_cloud/models/files_upload_result.rb +228 -0
  21. data/lib/groupdocs_comparison_cloud/models/format.rb +224 -0
  22. data/lib/groupdocs_comparison_cloud/models/{comparison_style_change.rb → formats_result.rb} +29 -19
  23. data/lib/groupdocs_comparison_cloud/models/items_style.rb +289 -0
  24. data/lib/groupdocs_comparison_cloud/models/link.rb +16 -8
  25. data/lib/groupdocs_comparison_cloud/models/{comparison_metadata_values.rb → metadata.rb} +28 -20
  26. data/lib/groupdocs_comparison_cloud/models/object_exist.rb +234 -0
  27. data/lib/groupdocs_comparison_cloud/models/{comparison_request.rb → options.rb} +39 -33
  28. data/lib/groupdocs_comparison_cloud/models/original_size.rb +234 -0
  29. data/lib/groupdocs_comparison_cloud/models/{comparison_request_settings.rb → settings.rb} +98 -70
  30. data/lib/groupdocs_comparison_cloud/models/storage_exist.rb +219 -0
  31. data/lib/groupdocs_comparison_cloud/models/storage_file.rb +264 -0
  32. data/lib/groupdocs_comparison_cloud/models/style_change_info.rb +234 -0
  33. data/lib/groupdocs_comparison_cloud/models/updates_options.rb +258 -0
  34. data/lib/groupdocs_comparison_cloud/version.rb +2 -2
  35. metadata +29 -44
  36. data/lib/groupdocs_comparison_cloud/api/changes_api.rb +0 -470
  37. data/lib/groupdocs_comparison_cloud/api/comparison_api.rb +0 -365
  38. data/lib/groupdocs_comparison_cloud/models/color.rb +0 -1404
  39. data/lib/groupdocs_comparison_cloud/models/requests/comparison_images_request.rb +0 -49
  40. data/lib/groupdocs_comparison_cloud/models/requests/comparison_images_stream_request.rb +0 -45
  41. data/lib/groupdocs_comparison_cloud/models/requests/comparison_request.rb +0 -49
  42. data/lib/groupdocs_comparison_cloud/models/requests/comparison_stream_request.rb +0 -45
  43. data/lib/groupdocs_comparison_cloud/models/requests/post_categories_changes_request.rb +0 -49
  44. data/lib/groupdocs_comparison_cloud/models/requests/post_changes_request.rb +0 -45
  45. data/lib/groupdocs_comparison_cloud/models/requests/put_changes_document_request.rb +0 -49
  46. data/lib/groupdocs_comparison_cloud/models/requests/put_changes_document_stream_request.rb +0 -45
  47. data/lib/groupdocs_comparison_cloud/models/requests/put_changes_images_request.rb +0 -49
  48. data/lib/groupdocs_comparison_cloud/models/requests/put_changes_images_stream_request.rb +0 -45
@@ -0,0 +1,224 @@
1
+ #
2
+ # --------------------------------------------------------------------------------------------------------------------
3
+ # <copyright company="Aspose Pty Ltd" file="format.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 GroupDocsComparisonCloud
31
+ # File-format
32
+ class Format
33
+
34
+ # File format extension
35
+ attr_accessor :extension
36
+
37
+ # File format name
38
+ attr_accessor :file_format
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
41
+ def self.attribute_map
42
+ {
43
+ :'extension' => :'Extension',
44
+ :'file_format' => :'FileFormat'
45
+ }
46
+ end
47
+
48
+ # Attribute type mapping.
49
+ def self.swagger_types
50
+ {
51
+ :'extension' => :'String',
52
+ :'file_format' => :'String'
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?(:'Extension')
65
+ self.extension = attributes[:'Extension']
66
+ end
67
+
68
+ if attributes.key?(:'FileFormat')
69
+ self.file_format = attributes[:'FileFormat']
70
+ end
71
+
72
+ end
73
+
74
+ # Show invalid properties with the reasons. Usually used together with valid?
75
+ # @return Array for valid properies with the reasons
76
+ def list_invalid_properties
77
+ invalid_properties = []
78
+ return invalid_properties
79
+ end
80
+
81
+ # Check to see if the all the properties in the model are valid
82
+ # @return true if the model is valid
83
+ def valid?
84
+ return true
85
+ end
86
+
87
+ # Checks equality by comparing each attribute.
88
+ # @param [Object] Object to be compared
89
+ def ==(other)
90
+ return true if self.equal?(other)
91
+ self.class == other.class &&
92
+ extension == other.extension &&
93
+ file_format == other.file_format
94
+ end
95
+
96
+ # @see the `==` method
97
+ # @param [Object] Object to be compared
98
+ def eql?(other)
99
+ self == other
100
+ end
101
+
102
+ # Calculates hash code according to all attributes.
103
+ # @return [Fixnum] Hash code
104
+ def hash
105
+ [extension, file_format].hash
106
+ end
107
+
108
+ # Downcases first letter.
109
+ # @return downcased string
110
+ def uncap(str)
111
+ str[0, 1].downcase + str[1..-1]
112
+ end
113
+
114
+ # Builds the object from hash
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ # @return [Object] Returns the model itself
117
+ def build_from_hash(attributes)
118
+ return nil unless attributes.is_a?(Hash)
119
+ self.class.swagger_types.each_pair do |key, type|
120
+ pname = uncap(self.class.attribute_map[key]).intern
121
+ value = attributes[pname]
122
+ if type =~ /\AArray<(.*)>/i
123
+ # check to ensure the input is an array given that the the attribute
124
+ # is documented as an array but the input is not
125
+ if value.is_a?(Array)
126
+ self.send("#{key}=", value.map { |v| _deserialize($1, v) })
127
+ end
128
+ elsif !value.nil?
129
+ self.send("#{key}=", _deserialize(type, value))
130
+ end
131
+ # or else data not found in attributes(hash), not an issue as the data can be optional
132
+ end
133
+
134
+ self
135
+ end
136
+
137
+ # Deserializes the data based on type
138
+ # @param string type Data type
139
+ # @param string value Value to be deserialized
140
+ # @return [Object] Deserialized data
141
+ def _deserialize(type, value)
142
+ case type.to_sym
143
+ when :DateTime
144
+ Date.parse value
145
+ when :Date
146
+ Date.parse value
147
+ when :String
148
+ value.to_s
149
+ when :Integer
150
+ value.to_i
151
+ when :Float
152
+ value.to_f
153
+ when :BOOLEAN
154
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
155
+ true
156
+ else
157
+ false
158
+ end
159
+ when :Object
160
+ # generic object (usually a Hash), return directly
161
+ value
162
+ when /\AArray<(?<inner_type>.+)>\z/
163
+ inner_type = Regexp.last_match[:inner_type]
164
+ value.map { |v| _deserialize(inner_type, v) }
165
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
166
+ k_type = Regexp.last_match[:k_type]
167
+ v_type = Regexp.last_match[:v_type]
168
+ {}.tap do |hash|
169
+ value.each do |k, v|
170
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
171
+ end
172
+ end
173
+ else
174
+ # model
175
+ temp_model = GroupDocsComparisonCloud.const_get(type).new
176
+ temp_model.build_from_hash(value)
177
+ end
178
+ end
179
+
180
+ # Returns the string representation of the object
181
+ # @return [String] String presentation of the object
182
+ def to_s
183
+ to_hash.to_s
184
+ end
185
+
186
+ # to_body is an alias to to_hash (backward compatibility)
187
+ # @return [Hash] Returns the object in the form of hash
188
+ def to_body
189
+ to_hash
190
+ end
191
+
192
+ # Returns the object in the form of hash
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_hash
195
+ hash = {}
196
+ self.class.attribute_map.each_pair do |attr, param|
197
+ value = self.send(attr)
198
+ next if value.nil?
199
+ hash[param] = _to_hash(value)
200
+ end
201
+ hash
202
+ end
203
+
204
+ # Outputs non-array value in the form of hash
205
+ # For object, use to_hash. Otherwise, just return the value
206
+ # @param [Object] value Any valid value
207
+ # @return [Hash] Returns the value in the form of hash
208
+ def _to_hash(value)
209
+ if value.is_a?(Array)
210
+ value.compact.map { |v| _to_hash(v) }
211
+ elsif value.is_a?(Hash)
212
+ {}.tap do |hash|
213
+ value.each { |k, v| hash[k] = _to_hash(v) }
214
+ end
215
+ elsif value.respond_to? :to_hash
216
+ value.to_hash
217
+ else
218
+ value
219
+ end
220
+ end
221
+
222
+ end
223
+
224
+ end
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # --------------------------------------------------------------------------------------------------------------------
3
- # <copyright company="Aspose Pty Ltd" file="comparison_style_change.rb">
4
- # Copyright (c) 2003-2018 Aspose Pty Ltd
3
+ # <copyright company="Aspose Pty Ltd" file="formats_result.rb">
4
+ # Copyright (c) 2003-2019 Aspose Pty Ltd
5
5
  # </copyright>
6
6
  # <summary>
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -28,23 +28,23 @@
28
28
  require 'date'
29
29
 
30
30
  module GroupDocsComparisonCloud
31
- # ComparisonStyleChange dto
32
- class ComparisonStyleChange
31
+ # Describes list of supported file formats
32
+ class FormatsResult
33
33
 
34
- # Gets or Sets the name of th property that was changes
35
- attr_accessor :changed_property
34
+ # Supported file formats
35
+ attr_accessor :formats
36
36
 
37
37
  # Attribute mapping from ruby-style variable name to JSON key.
38
38
  def self.attribute_map
39
39
  {
40
- :'changed_property' => :'ChangedProperty'
40
+ :'formats' => :'Formats'
41
41
  }
42
42
  end
43
43
 
44
44
  # Attribute type mapping.
45
45
  def self.swagger_types
46
46
  {
47
- :'changed_property' => :'String'
47
+ :'formats' => :'Array<Format>'
48
48
  }
49
49
  end
50
50
 
@@ -56,8 +56,10 @@ module GroupDocsComparisonCloud
56
56
  # convert string to symbol for hash key
57
57
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
58
58
 
59
- if attributes.key?(:'changedProperty')
60
- self.changed_property = attributes[:'changedProperty']
59
+ if attributes.key?(:'Formats')
60
+ if (value = attributes[:'Formats']).is_a?(Array)
61
+ self.formats = value
62
+ end
61
63
  end
62
64
 
63
65
  end
@@ -80,7 +82,7 @@ module GroupDocsComparisonCloud
80
82
  def ==(other)
81
83
  return true if self.equal?(other)
82
84
  self.class == other.class &&
83
- changed_property == other.changed_property
85
+ formats == other.formats
84
86
  end
85
87
 
86
88
  # @see the `==` method
@@ -92,7 +94,13 @@ module GroupDocsComparisonCloud
92
94
  # Calculates hash code according to all attributes.
93
95
  # @return [Fixnum] Hash code
94
96
  def hash
95
- [changed_property].hash
97
+ [formats].hash
98
+ end
99
+
100
+ # Downcases first letter.
101
+ # @return downcased string
102
+ def uncap(str)
103
+ str[0, 1].downcase + str[1..-1]
96
104
  end
97
105
 
98
106
  # Builds the object from hash
@@ -101,14 +109,16 @@ module GroupDocsComparisonCloud
101
109
  def build_from_hash(attributes)
102
110
  return nil unless attributes.is_a?(Hash)
103
111
  self.class.swagger_types.each_pair do |key, type|
112
+ pname = uncap(self.class.attribute_map[key]).intern
113
+ value = attributes[pname]
104
114
  if type =~ /\AArray<(.*)>/i
105
115
  # check to ensure the input is an array given that the the attribute
106
- # is documented as an array but the input is not
107
- if attributes[self.class.attribute_map[key]].is_a?(Array)
108
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
116
+ # is documented as an array but the input is not
117
+ if value.is_a?(Array)
118
+ self.send("#{key}=", value.map { |v| _deserialize($1, v) })
109
119
  end
110
- elsif !attributes[self.class.attribute_map[key]].nil?
111
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
120
+ elsif !value.nil?
121
+ self.send("#{key}=", _deserialize(type, value))
112
122
  end
113
123
  # or else data not found in attributes(hash), not an issue as the data can be optional
114
124
  end
@@ -123,9 +133,9 @@ module GroupDocsComparisonCloud
123
133
  def _deserialize(type, value)
124
134
  case type.to_sym
125
135
  when :DateTime
126
- Time.at(/\d/.match(value)[0].to_f).to_datetime
136
+ Date.parse value
127
137
  when :Date
128
- Time.at(/\d/.match(value)[0].to_f).to_date
138
+ Date.parse value
129
139
  when :String
130
140
  value.to_s
131
141
  when :Integer
@@ -0,0 +1,289 @@
1
+ #
2
+ # --------------------------------------------------------------------------------------------------------------------
3
+ # <copyright company="Aspose Pty Ltd" file="items_style.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 GroupDocsComparisonCloud
31
+ # ItemsStyle Object fields
32
+ class ItemsStyle
33
+
34
+ # Font color for changed components
35
+ attr_accessor :font_color
36
+
37
+ # Highlight color for changed components
38
+ attr_accessor :highlight_color
39
+
40
+ # Start tag for changed components
41
+ attr_accessor :begin_separator_string
42
+
43
+ # End tag for changed components
44
+ attr_accessor :end_separator_string
45
+
46
+ # Bold style for changed components
47
+ attr_accessor :bold
48
+
49
+ # Italic style for changed components
50
+ attr_accessor :italic
51
+
52
+ # Strikethrough style for changed components
53
+ attr_accessor :strike_through
54
+
55
+ # Attribute mapping from ruby-style variable name to JSON key.
56
+ def self.attribute_map
57
+ {
58
+ :'font_color' => :'FontColor',
59
+ :'highlight_color' => :'HighlightColor',
60
+ :'begin_separator_string' => :'BeginSeparatorString',
61
+ :'end_separator_string' => :'EndSeparatorString',
62
+ :'bold' => :'Bold',
63
+ :'italic' => :'Italic',
64
+ :'strike_through' => :'StrikeThrough'
65
+ }
66
+ end
67
+
68
+ # Attribute type mapping.
69
+ def self.swagger_types
70
+ {
71
+ :'font_color' => :'String',
72
+ :'highlight_color' => :'String',
73
+ :'begin_separator_string' => :'String',
74
+ :'end_separator_string' => :'String',
75
+ :'bold' => :'BOOLEAN',
76
+ :'italic' => :'BOOLEAN',
77
+ :'strike_through' => :'BOOLEAN'
78
+ }
79
+ end
80
+
81
+ # Initializes the object
82
+ # @param [Hash] attributes Model attributes in the form of hash
83
+ def initialize(attributes = {})
84
+ return unless attributes.is_a?(Hash)
85
+
86
+ # convert string to symbol for hash key
87
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
88
+
89
+ if attributes.key?(:'FontColor')
90
+ self.font_color = attributes[:'FontColor']
91
+ end
92
+
93
+ if attributes.key?(:'HighlightColor')
94
+ self.highlight_color = attributes[:'HighlightColor']
95
+ end
96
+
97
+ if attributes.key?(:'BeginSeparatorString')
98
+ self.begin_separator_string = attributes[:'BeginSeparatorString']
99
+ end
100
+
101
+ if attributes.key?(:'EndSeparatorString')
102
+ self.end_separator_string = attributes[:'EndSeparatorString']
103
+ end
104
+
105
+ if attributes.key?(:'Bold')
106
+ self.bold = attributes[:'Bold']
107
+ end
108
+
109
+ if attributes.key?(:'Italic')
110
+ self.italic = attributes[:'Italic']
111
+ end
112
+
113
+ if attributes.key?(:'StrikeThrough')
114
+ self.strike_through = attributes[:'StrikeThrough']
115
+ end
116
+
117
+ end
118
+
119
+ # Show invalid properties with the reasons. Usually used together with valid?
120
+ # @return Array for valid properies with the reasons
121
+ def list_invalid_properties
122
+ invalid_properties = []
123
+ if @bold.nil?
124
+ invalid_properties.push("invalid value for 'bold', bold cannot be nil.")
125
+ end
126
+
127
+ if @italic.nil?
128
+ invalid_properties.push("invalid value for 'italic', italic cannot be nil.")
129
+ end
130
+
131
+ if @strike_through.nil?
132
+ invalid_properties.push("invalid value for 'strike_through', strike_through cannot be nil.")
133
+ end
134
+
135
+ return invalid_properties
136
+ end
137
+
138
+ # Check to see if the all the properties in the model are valid
139
+ # @return true if the model is valid
140
+ def valid?
141
+ return false if @bold.nil?
142
+ return false if @italic.nil?
143
+ return false if @strike_through.nil?
144
+ return true
145
+ end
146
+
147
+ # Checks equality by comparing each attribute.
148
+ # @param [Object] Object to be compared
149
+ def ==(other)
150
+ return true if self.equal?(other)
151
+ self.class == other.class &&
152
+ font_color == other.font_color &&
153
+ highlight_color == other.highlight_color &&
154
+ begin_separator_string == other.begin_separator_string &&
155
+ end_separator_string == other.end_separator_string &&
156
+ bold == other.bold &&
157
+ italic == other.italic &&
158
+ strike_through == other.strike_through
159
+ end
160
+
161
+ # @see the `==` method
162
+ # @param [Object] Object to be compared
163
+ def eql?(other)
164
+ self == other
165
+ end
166
+
167
+ # Calculates hash code according to all attributes.
168
+ # @return [Fixnum] Hash code
169
+ def hash
170
+ [font_color, highlight_color, begin_separator_string, end_separator_string, bold, italic, strike_through].hash
171
+ end
172
+
173
+ # Downcases first letter.
174
+ # @return downcased string
175
+ def uncap(str)
176
+ str[0, 1].downcase + str[1..-1]
177
+ end
178
+
179
+ # Builds the object from hash
180
+ # @param [Hash] attributes Model attributes in the form of hash
181
+ # @return [Object] Returns the model itself
182
+ def build_from_hash(attributes)
183
+ return nil unless attributes.is_a?(Hash)
184
+ self.class.swagger_types.each_pair do |key, type|
185
+ pname = uncap(self.class.attribute_map[key]).intern
186
+ value = attributes[pname]
187
+ if type =~ /\AArray<(.*)>/i
188
+ # check to ensure the input is an array given that the the attribute
189
+ # is documented as an array but the input is not
190
+ if value.is_a?(Array)
191
+ self.send("#{key}=", value.map { |v| _deserialize($1, v) })
192
+ end
193
+ elsif !value.nil?
194
+ self.send("#{key}=", _deserialize(type, value))
195
+ end
196
+ # or else data not found in attributes(hash), not an issue as the data can be optional
197
+ end
198
+
199
+ self
200
+ end
201
+
202
+ # Deserializes the data based on type
203
+ # @param string type Data type
204
+ # @param string value Value to be deserialized
205
+ # @return [Object] Deserialized data
206
+ def _deserialize(type, value)
207
+ case type.to_sym
208
+ when :DateTime
209
+ Date.parse value
210
+ when :Date
211
+ Date.parse value
212
+ when :String
213
+ value.to_s
214
+ when :Integer
215
+ value.to_i
216
+ when :Float
217
+ value.to_f
218
+ when :BOOLEAN
219
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
220
+ true
221
+ else
222
+ false
223
+ end
224
+ when :Object
225
+ # generic object (usually a Hash), return directly
226
+ value
227
+ when /\AArray<(?<inner_type>.+)>\z/
228
+ inner_type = Regexp.last_match[:inner_type]
229
+ value.map { |v| _deserialize(inner_type, v) }
230
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
231
+ k_type = Regexp.last_match[:k_type]
232
+ v_type = Regexp.last_match[:v_type]
233
+ {}.tap do |hash|
234
+ value.each do |k, v|
235
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
236
+ end
237
+ end
238
+ else
239
+ # model
240
+ temp_model = GroupDocsComparisonCloud.const_get(type).new
241
+ temp_model.build_from_hash(value)
242
+ end
243
+ end
244
+
245
+ # Returns the string representation of the object
246
+ # @return [String] String presentation of the object
247
+ def to_s
248
+ to_hash.to_s
249
+ end
250
+
251
+ # to_body is an alias to to_hash (backward compatibility)
252
+ # @return [Hash] Returns the object in the form of hash
253
+ def to_body
254
+ to_hash
255
+ end
256
+
257
+ # Returns the object in the form of hash
258
+ # @return [Hash] Returns the object in the form of hash
259
+ def to_hash
260
+ hash = {}
261
+ self.class.attribute_map.each_pair do |attr, param|
262
+ value = self.send(attr)
263
+ next if value.nil?
264
+ hash[param] = _to_hash(value)
265
+ end
266
+ hash
267
+ end
268
+
269
+ # Outputs non-array value in the form of hash
270
+ # For object, use to_hash. Otherwise, just return the value
271
+ # @param [Object] value Any valid value
272
+ # @return [Hash] Returns the value in the form of hash
273
+ def _to_hash(value)
274
+ if value.is_a?(Array)
275
+ value.compact.map { |v| _to_hash(v) }
276
+ elsif value.is_a?(Hash)
277
+ {}.tap do |hash|
278
+ value.each { |k, v| hash[k] = _to_hash(v) }
279
+ end
280
+ elsif value.respond_to? :to_hash
281
+ value.to_hash
282
+ else
283
+ value
284
+ end
285
+ end
286
+
287
+ end
288
+
289
+ end