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
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # --------------------------------------------------------------------------------------------------------------------
3
- # <copyright company="Aspose Pty Ltd" file="comparison_file_info.rb">
4
- # Copyright (c) 2003-2018 Aspose Pty Ltd
3
+ # <copyright company="Aspose Pty Ltd" file="error_details.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,33 +28,28 @@
28
28
  require 'date'
29
29
 
30
30
  module GroupDocsComparisonCloud
31
- # ComparisonFileInfo dto
32
- class ComparisonFileInfo
31
+ # The error details
32
+ class ErrorDetails
33
33
 
34
- # The folder
35
- attr_accessor :folder
34
+ # The request id
35
+ attr_accessor :request_id
36
36
 
37
- # The name
38
- attr_accessor :name
39
-
40
- # The password
41
- attr_accessor :password
37
+ # Date
38
+ attr_accessor :date
42
39
 
43
40
  # Attribute mapping from ruby-style variable name to JSON key.
44
41
  def self.attribute_map
45
42
  {
46
- :'folder' => :'Folder',
47
- :'name' => :'Name',
48
- :'password' => :'Password'
43
+ :'request_id' => :'RequestId',
44
+ :'date' => :'Date'
49
45
  }
50
46
  end
51
47
 
52
48
  # Attribute type mapping.
53
49
  def self.swagger_types
54
50
  {
55
- :'folder' => :'String',
56
- :'name' => :'String',
57
- :'password' => :'String'
51
+ :'request_id' => :'String',
52
+ :'date' => :'DateTime'
58
53
  }
59
54
  end
60
55
 
@@ -66,16 +61,12 @@ module GroupDocsComparisonCloud
66
61
  # convert string to symbol for hash key
67
62
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
68
63
 
69
- if attributes.key?(:'folder')
70
- self.folder = attributes[:'folder']
71
- end
72
-
73
- if attributes.key?(:'name')
74
- self.name = attributes[:'name']
64
+ if attributes.key?(:'RequestId')
65
+ self.request_id = attributes[:'RequestId']
75
66
  end
76
67
 
77
- if attributes.key?(:'password')
78
- self.password = attributes[:'password']
68
+ if attributes.key?(:'Date')
69
+ self.date = attributes[:'Date']
79
70
  end
80
71
 
81
72
  end
@@ -84,12 +75,17 @@ module GroupDocsComparisonCloud
84
75
  # @return Array for valid properies with the reasons
85
76
  def list_invalid_properties
86
77
  invalid_properties = []
78
+ if @date.nil?
79
+ invalid_properties.push("invalid value for 'date', date cannot be nil.")
80
+ end
81
+
87
82
  return invalid_properties
88
83
  end
89
84
 
90
85
  # Check to see if the all the properties in the model are valid
91
86
  # @return true if the model is valid
92
87
  def valid?
88
+ return false if @date.nil?
93
89
  return true
94
90
  end
95
91
 
@@ -98,9 +94,8 @@ module GroupDocsComparisonCloud
98
94
  def ==(other)
99
95
  return true if self.equal?(other)
100
96
  self.class == other.class &&
101
- folder == other.folder &&
102
- name == other.name &&
103
- password == other.password
97
+ request_id == other.request_id &&
98
+ date == other.date
104
99
  end
105
100
 
106
101
  # @see the `==` method
@@ -112,7 +107,13 @@ module GroupDocsComparisonCloud
112
107
  # Calculates hash code according to all attributes.
113
108
  # @return [Fixnum] Hash code
114
109
  def hash
115
- [folder, name, password].hash
110
+ [request_id, date].hash
111
+ end
112
+
113
+ # Downcases first letter.
114
+ # @return downcased string
115
+ def uncap(str)
116
+ str[0, 1].downcase + str[1..-1]
116
117
  end
117
118
 
118
119
  # Builds the object from hash
@@ -121,14 +122,16 @@ module GroupDocsComparisonCloud
121
122
  def build_from_hash(attributes)
122
123
  return nil unless attributes.is_a?(Hash)
123
124
  self.class.swagger_types.each_pair do |key, type|
125
+ pname = uncap(self.class.attribute_map[key]).intern
126
+ value = attributes[pname]
124
127
  if type =~ /\AArray<(.*)>/i
125
128
  # check to ensure the input is an array given that the the attribute
126
- # is documented as an array but the input is not
127
- if attributes[self.class.attribute_map[key]].is_a?(Array)
128
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
129
+ # is documented as an array but the input is not
130
+ if value.is_a?(Array)
131
+ self.send("#{key}=", value.map { |v| _deserialize($1, v) })
129
132
  end
130
- elsif !attributes[self.class.attribute_map[key]].nil?
131
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
133
+ elsif !value.nil?
134
+ self.send("#{key}=", _deserialize(type, value))
132
135
  end
133
136
  # or else data not found in attributes(hash), not an issue as the data can be optional
134
137
  end
@@ -143,9 +146,9 @@ module GroupDocsComparisonCloud
143
146
  def _deserialize(type, value)
144
147
  case type.to_sym
145
148
  when :DateTime
146
- Time.at(/\d/.match(value)[0].to_f).to_datetime
149
+ Date.parse value
147
150
  when :Date
148
- Time.at(/\d/.match(value)[0].to_f).to_date
151
+ Date.parse value
149
152
  when :String
150
153
  value.to_s
151
154
  when :Integer
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # --------------------------------------------------------------------------------------------------------------------
3
- # <copyright company="Aspose Pty Ltd" file="style_settings_values.rb">
4
- # Copyright (c) 2003-2018 Aspose Pty Ltd
3
+ # <copyright company="Aspose Pty Ltd" file="file_info.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,33 +28,38 @@
28
28
  require 'date'
29
29
 
30
30
  module GroupDocsComparisonCloud
31
- # StyleSettingsValues dto
32
- class StyleSettingsValues
31
+ # Describes compared document
32
+ class FileInfo
33
33
 
34
- # Gets or sets the color.
35
- attr_accessor :color
34
+ # Path to the compared document
35
+ attr_accessor :file_path
36
36
 
37
- # Gets or sets the begin separator string.
38
- attr_accessor :begin_separator_string
37
+ # Document version
38
+ attr_accessor :version_id
39
39
 
40
- # Gets or sets the end separator string.
41
- attr_accessor :end_separator_string
40
+ # Storage name
41
+ attr_accessor :storage_name
42
+
43
+ # Password for encrypted document
44
+ attr_accessor :password
42
45
 
43
46
  # Attribute mapping from ruby-style variable name to JSON key.
44
47
  def self.attribute_map
45
48
  {
46
- :'color' => :'Color',
47
- :'begin_separator_string' => :'BeginSeparatorString',
48
- :'end_separator_string' => :'EndSeparatorString'
49
+ :'file_path' => :'FilePath',
50
+ :'version_id' => :'VersionId',
51
+ :'storage_name' => :'StorageName',
52
+ :'password' => :'Password'
49
53
  }
50
54
  end
51
55
 
52
56
  # Attribute type mapping.
53
57
  def self.swagger_types
54
58
  {
55
- :'color' => :'Color',
56
- :'begin_separator_string' => :'String',
57
- :'end_separator_string' => :'String'
59
+ :'file_path' => :'String',
60
+ :'version_id' => :'String',
61
+ :'storage_name' => :'String',
62
+ :'password' => :'String'
58
63
  }
59
64
  end
60
65
 
@@ -66,16 +71,20 @@ module GroupDocsComparisonCloud
66
71
  # convert string to symbol for hash key
67
72
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
68
73
 
69
- if attributes.key?(:'color')
70
- self.color = attributes[:'color']
74
+ if attributes.key?(:'FilePath')
75
+ self.file_path = attributes[:'FilePath']
76
+ end
77
+
78
+ if attributes.key?(:'VersionId')
79
+ self.version_id = attributes[:'VersionId']
71
80
  end
72
81
 
73
- if attributes.key?(:'beginSeparatorString')
74
- self.begin_separator_string = attributes[:'beginSeparatorString']
82
+ if attributes.key?(:'StorageName')
83
+ self.storage_name = attributes[:'StorageName']
75
84
  end
76
85
 
77
- if attributes.key?(:'endSeparatorString')
78
- self.end_separator_string = attributes[:'endSeparatorString']
86
+ if attributes.key?(:'Password')
87
+ self.password = attributes[:'Password']
79
88
  end
80
89
 
81
90
  end
@@ -84,17 +93,12 @@ module GroupDocsComparisonCloud
84
93
  # @return Array for valid properies with the reasons
85
94
  def list_invalid_properties
86
95
  invalid_properties = []
87
- if @color.nil?
88
- invalid_properties.push("invalid value for 'color', color cannot be nil.")
89
- end
90
-
91
96
  return invalid_properties
92
97
  end
93
98
 
94
99
  # Check to see if the all the properties in the model are valid
95
100
  # @return true if the model is valid
96
101
  def valid?
97
- return false if @color.nil?
98
102
  return true
99
103
  end
100
104
 
@@ -103,9 +107,10 @@ module GroupDocsComparisonCloud
103
107
  def ==(other)
104
108
  return true if self.equal?(other)
105
109
  self.class == other.class &&
106
- color == other.color &&
107
- begin_separator_string == other.begin_separator_string &&
108
- end_separator_string == other.end_separator_string
110
+ file_path == other.file_path &&
111
+ version_id == other.version_id &&
112
+ storage_name == other.storage_name &&
113
+ password == other.password
109
114
  end
110
115
 
111
116
  # @see the `==` method
@@ -117,7 +122,13 @@ module GroupDocsComparisonCloud
117
122
  # Calculates hash code according to all attributes.
118
123
  # @return [Fixnum] Hash code
119
124
  def hash
120
- [color, begin_separator_string, end_separator_string].hash
125
+ [file_path, version_id, storage_name, password].hash
126
+ end
127
+
128
+ # Downcases first letter.
129
+ # @return downcased string
130
+ def uncap(str)
131
+ str[0, 1].downcase + str[1..-1]
121
132
  end
122
133
 
123
134
  # Builds the object from hash
@@ -126,14 +137,16 @@ module GroupDocsComparisonCloud
126
137
  def build_from_hash(attributes)
127
138
  return nil unless attributes.is_a?(Hash)
128
139
  self.class.swagger_types.each_pair do |key, type|
140
+ pname = uncap(self.class.attribute_map[key]).intern
141
+ value = attributes[pname]
129
142
  if type =~ /\AArray<(.*)>/i
130
143
  # check to ensure the input is an array given that the the attribute
131
- # is documented as an array but the input is not
132
- if attributes[self.class.attribute_map[key]].is_a?(Array)
133
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
144
+ # is documented as an array but the input is not
145
+ if value.is_a?(Array)
146
+ self.send("#{key}=", value.map { |v| _deserialize($1, v) })
134
147
  end
135
- elsif !attributes[self.class.attribute_map[key]].nil?
136
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
148
+ elsif !value.nil?
149
+ self.send("#{key}=", _deserialize(type, value))
137
150
  end
138
151
  # or else data not found in attributes(hash), not an issue as the data can be optional
139
152
  end
@@ -148,9 +161,9 @@ module GroupDocsComparisonCloud
148
161
  def _deserialize(type, value)
149
162
  case type.to_sym
150
163
  when :DateTime
151
- Time.at(/\d/.match(value)[0].to_f).to_datetime
164
+ Date.parse value
152
165
  when :Date
153
- Time.at(/\d/.match(value)[0].to_f).to_date
166
+ Date.parse value
154
167
  when :String
155
168
  value.to_s
156
169
  when :Integer
@@ -0,0 +1,289 @@
1
+ #
2
+ # --------------------------------------------------------------------------------------------------------------------
3
+ # <copyright company="Aspose Pty Ltd" file="file_version.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 Version
32
+ class FileVersion
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
+ # File Version ID.
50
+ attr_accessor :version_id
51
+
52
+ # Specifies whether the file is (true) or is not (false) the latest version of an file.
53
+ attr_accessor :is_latest
54
+
55
+ # Attribute mapping from ruby-style variable name to JSON key.
56
+ def self.attribute_map
57
+ {
58
+ :'name' => :'Name',
59
+ :'is_folder' => :'IsFolder',
60
+ :'modified_date' => :'ModifiedDate',
61
+ :'size' => :'Size',
62
+ :'path' => :'Path',
63
+ :'version_id' => :'VersionId',
64
+ :'is_latest' => :'IsLatest'
65
+ }
66
+ end
67
+
68
+ # Attribute type mapping.
69
+ def self.swagger_types
70
+ {
71
+ :'name' => :'String',
72
+ :'is_folder' => :'BOOLEAN',
73
+ :'modified_date' => :'DateTime',
74
+ :'size' => :'Integer',
75
+ :'path' => :'String',
76
+ :'version_id' => :'String',
77
+ :'is_latest' => :'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?(:'Name')
90
+ self.name = attributes[:'Name']
91
+ end
92
+
93
+ if attributes.key?(:'IsFolder')
94
+ self.is_folder = attributes[:'IsFolder']
95
+ end
96
+
97
+ if attributes.key?(:'ModifiedDate')
98
+ self.modified_date = attributes[:'ModifiedDate']
99
+ end
100
+
101
+ if attributes.key?(:'Size')
102
+ self.size = attributes[:'Size']
103
+ end
104
+
105
+ if attributes.key?(:'Path')
106
+ self.path = attributes[:'Path']
107
+ end
108
+
109
+ if attributes.key?(:'VersionId')
110
+ self.version_id = attributes[:'VersionId']
111
+ end
112
+
113
+ if attributes.key?(:'IsLatest')
114
+ self.is_latest = attributes[:'IsLatest']
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 @is_folder.nil?
124
+ invalid_properties.push("invalid value for 'is_folder', is_folder cannot be nil.")
125
+ end
126
+
127
+ if @size.nil?
128
+ invalid_properties.push("invalid value for 'size', size cannot be nil.")
129
+ end
130
+
131
+ if @is_latest.nil?
132
+ invalid_properties.push("invalid value for 'is_latest', is_latest 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 @is_folder.nil?
142
+ return false if @size.nil?
143
+ return false if @is_latest.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
+ name == other.name &&
153
+ is_folder == other.is_folder &&
154
+ modified_date == other.modified_date &&
155
+ size == other.size &&
156
+ path == other.path &&
157
+ version_id == other.version_id &&
158
+ is_latest == other.is_latest
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
+ [name, is_folder, modified_date, size, path, version_id, is_latest].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