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,6 +1,6 @@
1
1
  # -----------------------------------------------------------------------------------
2
2
  # <copyright company="Aspose Pty Ltd" file="api_client.rb">
3
- # Copyright (c) 2003-2018 Aspose Pty Ltd
3
+ # Copyright (c) 2003-2019 Aspose Pty Ltd
4
4
  # </copyright>
5
5
  # <summary>
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -51,7 +51,7 @@ module GroupDocsComparisonCloud
51
51
  def initialize(config)
52
52
  @config = config
53
53
  @default_headers = {
54
- 'Content-Type' => "application/json",
54
+ 'Content-Type' => config.api_version == '' ? "application/x-www-form-urlencoded" : "application/json",
55
55
  'x-groupdocs-client' => "ruby sdk",
56
56
  'x-groupdocs-version' => GroupDocsComparisonCloud::VERSION.to_s
57
57
  }
@@ -69,18 +69,8 @@ module GroupDocsComparisonCloud
69
69
  end
70
70
 
71
71
  unless response.success?
72
- if response.status == 0
73
- # Errors from libcurl will be made visible here
74
- raise ApiError.new(:code => 0,
75
- :message => response.reason_phrase)
76
- else
77
- raise ApiError.new(:code => response.status,
78
- :response_headers => response.headers,
79
- :response_body => response.body),
80
- response.reason_phrase
81
- end
72
+ raise ApiError.new(:code => response.status, :response_body => response.body)
82
73
  end
83
-
84
74
 
85
75
  data = deserialize(response, opts[:return_type]) if opts[:return_type]
86
76
  [data, response.status, response.headers]
@@ -250,7 +240,7 @@ module GroupDocsComparisonCloud
250
240
  encoding = response.body.encoding
251
241
  tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
252
242
  @tempfile = tempfile
253
- IO.binwrite(tempfile, response.body)
243
+ tempfile.write(response.body)
254
244
  response.on_complete do |resp|
255
245
  tempfile.close
256
246
  @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
@@ -283,7 +273,9 @@ module GroupDocsComparisonCloud
283
273
  # @return [String] HTTP body data in the form of string
284
274
  def build_request_body(header_params, form_params, body)
285
275
  # http form
286
- if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
276
+ if body
277
+ data = body.is_a?(String) ? body : body.to_json
278
+ elsif header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
287
279
  header_params['Content-Type'] == 'multipart/form-data'
288
280
  data = {}
289
281
  form_params.each do |key, value|
@@ -296,8 +288,6 @@ module GroupDocsComparisonCloud
296
288
  data[key] = value.to_s
297
289
  end
298
290
  end
299
- elsif body
300
- data = body.is_a?(String) ? body : body.to_json
301
291
  else
302
292
  data = nil
303
293
  end
@@ -1,6 +1,6 @@
1
1
  # -----------------------------------------------------------------------------------
2
2
  # <copyright company="Aspose Pty Ltd" file="api_error.rb">
3
- # Copyright (c) 2003-2018 Aspose Pty Ltd
3
+ # Copyright (c) 2003-2019 Aspose Pty Ltd
4
4
  # </copyright>
5
5
  # <summary>
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -40,12 +40,14 @@ module GroupDocsComparisonCloud
40
40
  if arg.key?(:response_body) then
41
41
  data = JSON.parse(arg[:response_body], :symbolize_names => true)
42
42
  if !data.nil? && !data[:error].nil? then
43
- @message = data[:error][:message]
43
+ @message = data[:error]
44
+ elsif !data.nil? && !data[:Error].nil? && !data[:Error][:Message].nil? then
45
+ @message = data[:Error][:Message]
44
46
  end
45
47
  end
46
48
 
47
49
  if arg.key?(:arg) then
48
- @code = arg[:code]
50
+ @code = arg[:Code]
49
51
  end
50
52
 
51
53
  else
@@ -1,6 +1,6 @@
1
1
  # ------------------------------------------------------------------------------------
2
2
  # <copyright company="Aspose Pty Ltd" file="configuration.rb">
3
- # Copyright (c) 2003-2018 Aspose Pty Ltd
3
+ # Copyright (c) 2003-2019 Aspose Pty Ltd
4
4
  # </copyright>
5
5
  # <summary>
6
6
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -34,7 +34,7 @@ module GroupDocsComparisonCloud
34
34
  # @return [String] Api base url
35
35
  attr_accessor :api_base_url
36
36
 
37
- # Api version, default is '/v1'
37
+ # Api version, default is '/v2.0'
38
38
  #
39
39
  # @return [String] Api version
40
40
  attr_accessor :api_version
@@ -81,7 +81,7 @@ module GroupDocsComparisonCloud
81
81
  # @return [Configuration] New instance of Configuration
82
82
  def initialize(app_sid, app_key)
83
83
  @api_base_url = "https://api.groupdocs.cloud"
84
- @api_version = '/v1'
84
+ @api_version = '/v2.0'
85
85
  @app_sid = app_sid
86
86
  @app_key = app_key
87
87
  @client_side_validation = true
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # --------------------------------------------------------------------------------------------------------------------
3
- # <copyright company="Aspose Pty Ltd" file="comparison_change.rb">
4
- # Copyright (c) 2003-2018 Aspose Pty Ltd
3
+ # <copyright company="Aspose Pty Ltd" file="change_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,36 +28,36 @@
28
28
  require 'date'
29
29
 
30
30
  module GroupDocsComparisonCloud
31
- # ComparisonChange dto
32
- class ComparisonChange
31
+ # ChangeInfo Object fields
32
+ class ChangeInfo
33
33
 
34
- # The identifier
34
+ # Id of change
35
35
  attr_accessor :id
36
36
 
37
- # The type change
38
- attr_accessor :type
37
+ # Action (accept or reject). This field shows comparison what to do with this change
38
+ attr_accessor :comparison_action
39
39
 
40
- # The text
40
+ # Type of change (Inserted, Deleted or StyleChanged)
41
+ attr_accessor :comparison_type_changed
42
+
43
+ # Text of changed element
41
44
  attr_accessor :text
42
45
 
43
- # The authors
46
+ # Array of authors who made this change (used for multi comparison)
44
47
  attr_accessor :authors
45
48
 
46
- # The action
47
- attr_accessor :action
48
-
49
- # The style changes
50
- attr_accessor :style_changes
49
+ # Array of style changes
50
+ attr_accessor :style_change_info
51
51
 
52
52
  # Attribute mapping from ruby-style variable name to JSON key.
53
53
  def self.attribute_map
54
54
  {
55
- :'id' => :'id',
56
- :'type' => :'type',
57
- :'text' => :'text',
58
- :'authors' => :'authors',
59
- :'action' => :'action',
60
- :'style_changes' => :'styleChanges'
55
+ :'id' => :'Id',
56
+ :'comparison_action' => :'ComparisonAction',
57
+ :'comparison_type_changed' => :'ComparisonTypeChanged',
58
+ :'text' => :'Text',
59
+ :'authors' => :'Authors',
60
+ :'style_change_info' => :'StyleChangeInfo'
61
61
  }
62
62
  end
63
63
 
@@ -65,11 +65,11 @@ module GroupDocsComparisonCloud
65
65
  def self.swagger_types
66
66
  {
67
67
  :'id' => :'Integer',
68
- :'type' => :'String',
68
+ :'comparison_action' => :'String',
69
+ :'comparison_type_changed' => :'String',
69
70
  :'text' => :'String',
70
71
  :'authors' => :'Array<String>',
71
- :'action' => :'String',
72
- :'style_changes' => :'Array<ComparisonStyleChange>'
72
+ :'style_change_info' => :'Array<StyleChangeInfo>'
73
73
  }
74
74
  end
75
75
 
@@ -81,31 +81,31 @@ module GroupDocsComparisonCloud
81
81
  # convert string to symbol for hash key
82
82
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
83
83
 
84
- if attributes.key?(:'id')
85
- self.id = attributes[:'id']
84
+ if attributes.key?(:'Id')
85
+ self.id = attributes[:'Id']
86
86
  end
87
87
 
88
- if attributes.key?(:'type')
89
- self.type = attributes[:'type']
88
+ if attributes.key?(:'ComparisonAction')
89
+ self.comparison_action = attributes[:'ComparisonAction']
90
90
  end
91
91
 
92
- if attributes.key?(:'text')
93
- self.text = attributes[:'text']
92
+ if attributes.key?(:'ComparisonTypeChanged')
93
+ self.comparison_type_changed = attributes[:'ComparisonTypeChanged']
94
94
  end
95
95
 
96
- if attributes.key?(:'authors')
97
- if (value = attributes[:'authors']).is_a?(Array)
98
- self.authors = value
99
- end
96
+ if attributes.key?(:'Text')
97
+ self.text = attributes[:'Text']
100
98
  end
101
99
 
102
- if attributes.key?(:'action')
103
- self.action = attributes[:'action']
100
+ if attributes.key?(:'Authors')
101
+ if (value = attributes[:'Authors']).is_a?(Array)
102
+ self.authors = value
103
+ end
104
104
  end
105
105
 
106
- if attributes.key?(:'styleChanges')
107
- if (value = attributes[:'styleChanges']).is_a?(Array)
108
- self.style_changes = value
106
+ if attributes.key?(:'StyleChangeInfo')
107
+ if (value = attributes[:'StyleChangeInfo']).is_a?(Array)
108
+ self.style_change_info = value
109
109
  end
110
110
  end
111
111
 
@@ -135,11 +135,11 @@ module GroupDocsComparisonCloud
135
135
  return true if self.equal?(other)
136
136
  self.class == other.class &&
137
137
  id == other.id &&
138
- type == other.type &&
138
+ comparison_action == other.comparison_action &&
139
+ comparison_type_changed == other.comparison_type_changed &&
139
140
  text == other.text &&
140
141
  authors == other.authors &&
141
- action == other.action &&
142
- style_changes == other.style_changes
142
+ style_change_info == other.style_change_info
143
143
  end
144
144
 
145
145
  # @see the `==` method
@@ -151,7 +151,13 @@ module GroupDocsComparisonCloud
151
151
  # Calculates hash code according to all attributes.
152
152
  # @return [Fixnum] Hash code
153
153
  def hash
154
- [id, type, text, authors, action, style_changes].hash
154
+ [id, comparison_action, comparison_type_changed, text, authors, style_change_info].hash
155
+ end
156
+
157
+ # Downcases first letter.
158
+ # @return downcased string
159
+ def uncap(str)
160
+ str[0, 1].downcase + str[1..-1]
155
161
  end
156
162
 
157
163
  # Builds the object from hash
@@ -160,14 +166,16 @@ module GroupDocsComparisonCloud
160
166
  def build_from_hash(attributes)
161
167
  return nil unless attributes.is_a?(Hash)
162
168
  self.class.swagger_types.each_pair do |key, type|
169
+ pname = uncap(self.class.attribute_map[key]).intern
170
+ value = attributes[pname]
163
171
  if type =~ /\AArray<(.*)>/i
164
172
  # check to ensure the input is an array given that the the attribute
165
- # is documented as an array but the input is not
166
- if attributes[self.class.attribute_map[key]].is_a?(Array)
167
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
173
+ # is documented as an array but the input is not
174
+ if value.is_a?(Array)
175
+ self.send("#{key}=", value.map { |v| _deserialize($1, v) })
168
176
  end
169
- elsif !attributes[self.class.attribute_map[key]].nil?
170
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
177
+ elsif !value.nil?
178
+ self.send("#{key}=", _deserialize(type, value))
171
179
  end
172
180
  # or else data not found in attributes(hash), not an issue as the data can be optional
173
181
  end
@@ -182,9 +190,9 @@ module GroupDocsComparisonCloud
182
190
  def _deserialize(type, value)
183
191
  case type.to_sym
184
192
  when :DateTime
185
- Time.at(/\d/.match(value)[0].to_f).to_datetime
193
+ Date.parse value
186
194
  when :Date
187
- Time.at(/\d/.match(value)[0].to_f).to_date
195
+ Date.parse value
188
196
  when :String
189
197
  value.to_s
190
198
  when :Integer
@@ -0,0 +1,259 @@
1
+ #
2
+ # --------------------------------------------------------------------------------------------------------------------
3
+ # <copyright company="Aspose Pty Ltd" file="diagram_master_setting.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
+ # DiagramMasterSetting Object fields
32
+ class DiagramMasterSetting
33
+
34
+ # Path to custom master path
35
+ attr_accessor :master_path
36
+
37
+ # Value of using master from source and target document together
38
+ attr_accessor :use_source_master
39
+
40
+ # Width of original document
41
+ attr_accessor :width
42
+
43
+ # Height of original document
44
+ attr_accessor :height
45
+
46
+ # Attribute mapping from ruby-style variable name to JSON key.
47
+ def self.attribute_map
48
+ {
49
+ :'master_path' => :'MasterPath',
50
+ :'use_source_master' => :'UseSourceMaster',
51
+ :'width' => :'Width',
52
+ :'height' => :'Height'
53
+ }
54
+ end
55
+
56
+ # Attribute type mapping.
57
+ def self.swagger_types
58
+ {
59
+ :'master_path' => :'String',
60
+ :'use_source_master' => :'BOOLEAN',
61
+ :'width' => :'Integer',
62
+ :'height' => :'Integer'
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?(:'MasterPath')
75
+ self.master_path = attributes[:'MasterPath']
76
+ end
77
+
78
+ if attributes.key?(:'UseSourceMaster')
79
+ self.use_source_master = attributes[:'UseSourceMaster']
80
+ end
81
+
82
+ if attributes.key?(:'Width')
83
+ self.width = attributes[:'Width']
84
+ end
85
+
86
+ if attributes.key?(:'Height')
87
+ self.height = attributes[:'Height']
88
+ end
89
+
90
+ end
91
+
92
+ # Show invalid properties with the reasons. Usually used together with valid?
93
+ # @return Array for valid properies with the reasons
94
+ def list_invalid_properties
95
+ invalid_properties = []
96
+ if @use_source_master.nil?
97
+ invalid_properties.push("invalid value for 'use_source_master', use_source_master cannot be nil.")
98
+ end
99
+
100
+ if @width.nil?
101
+ invalid_properties.push("invalid value for 'width', width cannot be nil.")
102
+ end
103
+
104
+ if @height.nil?
105
+ invalid_properties.push("invalid value for 'height', height cannot be nil.")
106
+ end
107
+
108
+ return invalid_properties
109
+ end
110
+
111
+ # Check to see if the all the properties in the model are valid
112
+ # @return true if the model is valid
113
+ def valid?
114
+ return false if @use_source_master.nil?
115
+ return false if @width.nil?
116
+ return false if @height.nil?
117
+ return true
118
+ end
119
+
120
+ # Checks equality by comparing each attribute.
121
+ # @param [Object] Object to be compared
122
+ def ==(other)
123
+ return true if self.equal?(other)
124
+ self.class == other.class &&
125
+ master_path == other.master_path &&
126
+ use_source_master == other.use_source_master &&
127
+ width == other.width &&
128
+ height == other.height
129
+ end
130
+
131
+ # @see the `==` method
132
+ # @param [Object] Object to be compared
133
+ def eql?(other)
134
+ self == other
135
+ end
136
+
137
+ # Calculates hash code according to all attributes.
138
+ # @return [Fixnum] Hash code
139
+ def hash
140
+ [master_path, use_source_master, width, height].hash
141
+ end
142
+
143
+ # Downcases first letter.
144
+ # @return downcased string
145
+ def uncap(str)
146
+ str[0, 1].downcase + str[1..-1]
147
+ end
148
+
149
+ # Builds the object from hash
150
+ # @param [Hash] attributes Model attributes in the form of hash
151
+ # @return [Object] Returns the model itself
152
+ def build_from_hash(attributes)
153
+ return nil unless attributes.is_a?(Hash)
154
+ self.class.swagger_types.each_pair do |key, type|
155
+ pname = uncap(self.class.attribute_map[key]).intern
156
+ value = attributes[pname]
157
+ if type =~ /\AArray<(.*)>/i
158
+ # check to ensure the input is an array given that the the attribute
159
+ # is documented as an array but the input is not
160
+ if value.is_a?(Array)
161
+ self.send("#{key}=", value.map { |v| _deserialize($1, v) })
162
+ end
163
+ elsif !value.nil?
164
+ self.send("#{key}=", _deserialize(type, value))
165
+ end
166
+ # or else data not found in attributes(hash), not an issue as the data can be optional
167
+ end
168
+
169
+ self
170
+ end
171
+
172
+ # Deserializes the data based on type
173
+ # @param string type Data type
174
+ # @param string value Value to be deserialized
175
+ # @return [Object] Deserialized data
176
+ def _deserialize(type, value)
177
+ case type.to_sym
178
+ when :DateTime
179
+ Date.parse value
180
+ when :Date
181
+ Date.parse value
182
+ when :String
183
+ value.to_s
184
+ when :Integer
185
+ value.to_i
186
+ when :Float
187
+ value.to_f
188
+ when :BOOLEAN
189
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
190
+ true
191
+ else
192
+ false
193
+ end
194
+ when :Object
195
+ # generic object (usually a Hash), return directly
196
+ value
197
+ when /\AArray<(?<inner_type>.+)>\z/
198
+ inner_type = Regexp.last_match[:inner_type]
199
+ value.map { |v| _deserialize(inner_type, v) }
200
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
201
+ k_type = Regexp.last_match[:k_type]
202
+ v_type = Regexp.last_match[:v_type]
203
+ {}.tap do |hash|
204
+ value.each do |k, v|
205
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
206
+ end
207
+ end
208
+ else
209
+ # model
210
+ temp_model = GroupDocsComparisonCloud.const_get(type).new
211
+ temp_model.build_from_hash(value)
212
+ end
213
+ end
214
+
215
+ # Returns the string representation of the object
216
+ # @return [String] String presentation of the object
217
+ def to_s
218
+ to_hash.to_s
219
+ end
220
+
221
+ # to_body is an alias to to_hash (backward compatibility)
222
+ # @return [Hash] Returns the object in the form of hash
223
+ def to_body
224
+ to_hash
225
+ end
226
+
227
+ # Returns the object in the form of hash
228
+ # @return [Hash] Returns the object in the form of hash
229
+ def to_hash
230
+ hash = {}
231
+ self.class.attribute_map.each_pair do |attr, param|
232
+ value = self.send(attr)
233
+ next if value.nil?
234
+ hash[param] = _to_hash(value)
235
+ end
236
+ hash
237
+ end
238
+
239
+ # Outputs non-array value in the form of hash
240
+ # For object, use to_hash. Otherwise, just return the value
241
+ # @param [Object] value Any valid value
242
+ # @return [Hash] Returns the value in the form of hash
243
+ def _to_hash(value)
244
+ if value.is_a?(Array)
245
+ value.compact.map { |v| _to_hash(v) }
246
+ elsif value.is_a?(Hash)
247
+ {}.tap do |hash|
248
+ value.each { |k, v| hash[k] = _to_hash(v) }
249
+ end
250
+ elsif value.respond_to? :to_hash
251
+ value.to_hash
252
+ else
253
+ value
254
+ end
255
+ end
256
+
257
+ end
258
+
259
+ end