groupdocs_comparison_cloud 20.5 → 20.12

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c3d15eabf7059b1c257df768dcb17aa069e68f9f
4
- data.tar.gz: de9e909270ad4e0c21476478d56872d3d32b1599
3
+ metadata.gz: c500e02bed6b8f9a62e8cf3b1e2117a62e9a5ba5
4
+ data.tar.gz: 464c3b7feee3c2ea45f5af653b753cb00faa78cc
5
5
  SHA512:
6
- metadata.gz: f19f56eeac4f06e1a2e9b847198d6591a3dc3d375b225e12ae974747f1e0c14e45fece664f23dd5685c49abf059212fd7bf718165b5fd3991d4a46ba1e29b3ca
7
- data.tar.gz: f37f83a710b3119d466af1e39b541aa195c19dbfdc4d13eb1baeef544cb9f62d27836ea3173deaff549fd8a4e3946f90569ecc8ec4d9a9d0970d613766d96e91
6
+ metadata.gz: 2da1ee0d737fc8e521c3b415c9eca8d355808188c8678939cc1483d7bb741c0191da4e520e06c46aa71490119e158f537fafbf1992c2fb22a718a15d4ad6f5de
7
+ data.tar.gz: 604d87f5466aef5f8ab39a8ccf0e250c4eff4056712d0d4ec82a41d2d3fa17bf29e5eea369406ffff22e115d5e3ec644241f3f041448c9db632df59dad1f4ce3
@@ -30,6 +30,7 @@ require_relative 'groupdocs_comparison_cloud/version'
30
30
  require_relative 'groupdocs_comparison_cloud/configuration'
31
31
 
32
32
  # Models
33
+ require_relative 'groupdocs_comparison_cloud/models/apply_revisions_options'
33
34
  require_relative 'groupdocs_comparison_cloud/models/change_info'
34
35
  require_relative 'groupdocs_comparison_cloud/models/comparison_options'
35
36
  require_relative 'groupdocs_comparison_cloud/models/diagram_master_setting'
@@ -49,6 +50,7 @@ require_relative 'groupdocs_comparison_cloud/models/metadata'
49
50
  require_relative 'groupdocs_comparison_cloud/models/object_exist'
50
51
  require_relative 'groupdocs_comparison_cloud/models/page_info'
51
52
  require_relative 'groupdocs_comparison_cloud/models/rectangle'
53
+ require_relative 'groupdocs_comparison_cloud/models/revision_info'
52
54
  require_relative 'groupdocs_comparison_cloud/models/settings'
53
55
  require_relative 'groupdocs_comparison_cloud/models/size'
54
56
  require_relative 'groupdocs_comparison_cloud/models/storage_exist'
@@ -62,4 +64,5 @@ require_relative 'groupdocs_comparison_cloud/api/compare_api'
62
64
  require_relative 'groupdocs_comparison_cloud/api/file_api'
63
65
  require_relative 'groupdocs_comparison_cloud/api/folder_api'
64
66
  require_relative 'groupdocs_comparison_cloud/api/info_api'
67
+ require_relative 'groupdocs_comparison_cloud/api/review_api'
65
68
  require_relative 'groupdocs_comparison_cloud/api/storage_api'
@@ -0,0 +1,314 @@
1
+ # -----------------------------------------------------------------------------------
2
+ # <copyright company="Aspose Pty Ltd" file="review.rb">
3
+ # Copyright (c) 2003-2020 Aspose Pty Ltd
4
+ # </copyright>
5
+ # <summary>
6
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ # of this software and associated documentation files (the "Software"), to deal
8
+ # in the Software without restriction, including without limitation the rights
9
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ # copies of the Software, and to permit persons to whom the Software is
11
+ # furnished to do so, subject to the following conditions:
12
+ #
13
+ # The above copyright notice and this permission notice shall be included in all
14
+ # copies or substantial portions of the Software.
15
+ #
16
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ # SOFTWARE.
23
+ # </summary>
24
+ # -----------------------------------------------------------------------------------
25
+
26
+ require 'uri'
27
+ require 'date'
28
+
29
+ module GroupDocsComparisonCloud
30
+ #
31
+ # GroupDocs.Comparison Cloud API
32
+ #
33
+ class ReviewApi
34
+ attr_accessor :config
35
+
36
+ #make ReviewApi.new private
37
+ private_class_method :new
38
+
39
+ # Initializes new instance of ReviewApi
40
+ #
41
+ # @param [config] Configuration
42
+ # @return [ReviewApi] New instance of ReviewApi
43
+ def initialize(config)
44
+ @config = config
45
+ @api_client = ApiClient.new(config)
46
+ @access_token = nil
47
+ end
48
+
49
+ # Initializes new instance of ReviewApi
50
+ #
51
+ # @param [app_sid] Application identifier (App SID)
52
+ # @param [app_key] Application private key (App Key)
53
+ # @return [ReviewApi] New instance of ReviewApi
54
+ def self.from_keys(app_sid, app_key)
55
+ config = Configuration.new(app_sid, app_key)
56
+ return new(config)
57
+ end
58
+
59
+ # Initializes new instance of ReviewApi
60
+ #
61
+ # @param [config] Configuration
62
+ # @return [ReviewApi] New instance of ReviewApi
63
+ def self.from_config(config)
64
+ return new(config)
65
+ end
66
+
67
+ # Accepts or rejects revisions in DOCX document
68
+ #
69
+ # @param request apply_revisions_request
70
+ # @return [Link]
71
+ def apply_revisions(request)
72
+ data, _status_code, _headers = apply_revisions_with_http_info(request)
73
+ data
74
+ end
75
+
76
+ # Accepts or rejects revisions in DOCX document
77
+ #
78
+ # @param request apply_revisions_request
79
+ # @return [Array<(Link, Fixnum, Hash)>]
80
+ # Link data, response status code and response headers
81
+ def apply_revisions_with_http_info(request)
82
+ raise ArgumentError, 'Incorrect request type' unless request.is_a? ApplyRevisionsRequest
83
+
84
+ @api_client.config.logger.debug 'Calling API: ReviewApi.apply_revisions ...' if @api_client.config.debugging
85
+ # verify the required parameter 'revision_options' is set
86
+ raise ArgumentError, 'Missing the required parameter revision_options when calling ReviewApi.apply_revisions' if @api_client.config.client_side_validation && request.revision_options.nil?
87
+ # resource path
88
+ local_var_path = '/comparison/revisions'
89
+
90
+ # query parameters
91
+ query_params = {}
92
+
93
+ # header parameters
94
+ header_params = {}
95
+ # HTTP header 'Accept' (if needed)
96
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
97
+ # HTTP header 'Content-Type'
98
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
99
+
100
+ # form parameters
101
+ form_params = {}
102
+
103
+ # http body (model)
104
+ post_body = @api_client.object_to_http_body(request.revision_options)
105
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
106
+ header_params: header_params,
107
+ query_params: query_params,
108
+ form_params: form_params,
109
+ body: post_body,
110
+ access_token: get_access_token,
111
+ return_type: 'Link')
112
+ if @api_client.config.debugging
113
+ @api_client.config.logger.debug "API called:
114
+ ReviewApi#apply_revisions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
115
+ end
116
+ [data, status_code, headers]
117
+ end
118
+
119
+ # Get list of DOCX document revisions.
120
+ #
121
+ # @param request get_revisions_request
122
+ # @return [Array<RevisionInfo>]
123
+ def get_revisions(request)
124
+ data, _status_code, _headers = get_revisions_with_http_info(request)
125
+ data
126
+ end
127
+
128
+ # Get list of DOCX document revisions.
129
+ #
130
+ # @param request get_revisions_request
131
+ # @return [Array<(Array<RevisionInfo>, Fixnum, Hash)>]
132
+ # Array<RevisionInfo> data, response status code and response headers
133
+ def get_revisions_with_http_info(request)
134
+ raise ArgumentError, 'Incorrect request type' unless request.is_a? GetRevisionsRequest
135
+
136
+ @api_client.config.logger.debug 'Calling API: ReviewApi.get_revisions ...' if @api_client.config.debugging
137
+ # verify the required parameter 'file_info' is set
138
+ raise ArgumentError, 'Missing the required parameter file_info when calling ReviewApi.get_revisions' if @api_client.config.client_side_validation && request.file_info.nil?
139
+ # resource path
140
+ local_var_path = '/comparison/revisions'
141
+
142
+ # query parameters
143
+ query_params = {}
144
+
145
+ # header parameters
146
+ header_params = {}
147
+ # HTTP header 'Accept' (if needed)
148
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
149
+ # HTTP header 'Content-Type'
150
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
151
+
152
+ # form parameters
153
+ form_params = {}
154
+
155
+ # http body (model)
156
+ post_body = @api_client.object_to_http_body(request.file_info)
157
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
158
+ header_params: header_params,
159
+ query_params: query_params,
160
+ form_params: form_params,
161
+ body: post_body,
162
+ access_token: get_access_token,
163
+ return_type: 'Array<RevisionInfo>')
164
+ if @api_client.config.debugging
165
+ @api_client.config.logger.debug "API called:
166
+ ReviewApi#get_revisions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
167
+ end
168
+ [data, status_code, headers]
169
+ end
170
+
171
+ #
172
+ # Helper method to convert first letter to downcase
173
+ #
174
+ private def downcase_first_letter(str)
175
+ value = str[0].downcase + str[1..-1]
176
+ value
177
+ end
178
+
179
+ #
180
+ # Retrieves access token
181
+ #
182
+ private def get_access_token
183
+ if @access_token.nil? then
184
+ request_access_token
185
+ end
186
+
187
+ @access_token
188
+ end
189
+
190
+ #
191
+ # Gets a access token from server
192
+ #
193
+ private def request_access_token
194
+ auth_config = Configuration.new(@config.app_sid, @config.app_key)
195
+ auth_config.api_base_url = @config.api_base_url
196
+ auth_config.debugging = @config.debugging
197
+ auth_config.logger = @config.logger
198
+ auth_config.temp_folder_path = @config.temp_folder_path
199
+ auth_config.client_side_validation = @config.client_side_validation
200
+ auth_config.api_version = ''
201
+
202
+ auth_api_client = ApiClient.new(auth_config)
203
+
204
+ request_url = "/connect/token"
205
+ post_data = "grant_type=client_credentials&client_id=#{@config.app_sid}&client_secret=#{@config.app_key}"
206
+
207
+ data, _status_code, _header = auth_api_client.call_api(:POST, request_url, :body => post_data, :return_type => 'Object')
208
+
209
+ @access_token = data[:access_token]
210
+
211
+ expires_in_seconds = data[:expires_in].to_i - 5 * 60
212
+ expires_in_days = Rational(expires_in_seconds, 60 * 60 * 24)
213
+ @access_token_expires_at = DateTime.now + expires_in_days
214
+ end
215
+
216
+ # requires all files inside a directory from current dir
217
+ # @param _dir can be relative path like '/lib' or "../lib"
218
+ private def require_all(_dir)
219
+ Dir[File.expand_path(File.join(File.dirname(File.absolute_path(__FILE__)), _dir)) + "/*.rb"].each do |file|
220
+ require file
221
+ end
222
+ end
223
+ end
224
+ end
225
+ #
226
+ # --------------------------------------------------------------------------------------------------------------------
227
+ # <copyright company="Aspose Pty Ltd" file="apply_revisions_request.rb">
228
+ # Copyright (c) 2003-2020 Aspose Pty Ltd
229
+ # </copyright>
230
+ # <summary>
231
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
232
+ # of this software and associated documentation files (the "Software"), to deal
233
+ # in the Software without restriction, including without limitation the rights
234
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
235
+ # copies of the Software, and to permit persons to whom the Software is
236
+ # furnished to do so, subject to the following conditions:
237
+ #
238
+ # The above copyright notice and this permission notice shall be included in all
239
+ # copies or substantial portions of the Software.
240
+ #
241
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
242
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
243
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
244
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
245
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
246
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
247
+ # SOFTWARE.
248
+ # </summary>
249
+ # --------------------------------------------------------------------------------------------------------------------
250
+ #
251
+
252
+ module GroupDocsComparisonCloud
253
+
254
+ #
255
+ # Request model for apply_revisions operation.
256
+ #
257
+ class ApplyRevisionsRequest
258
+
259
+ # Apply revisions options
260
+ attr_accessor :revision_options
261
+
262
+ #
263
+ # Initializes a new instance.
264
+ # @param revision_options Apply revisions options
265
+ def initialize(revision_options)
266
+ self.revision_options = revision_options
267
+ end
268
+ end
269
+ end
270
+ #
271
+ # --------------------------------------------------------------------------------------------------------------------
272
+ # <copyright company="Aspose Pty Ltd" file="get_revisions_request.rb">
273
+ # Copyright (c) 2003-2020 Aspose Pty Ltd
274
+ # </copyright>
275
+ # <summary>
276
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
277
+ # of this software and associated documentation files (the "Software"), to deal
278
+ # in the Software without restriction, including without limitation the rights
279
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
280
+ # copies of the Software, and to permit persons to whom the Software is
281
+ # furnished to do so, subject to the following conditions:
282
+ #
283
+ # The above copyright notice and this permission notice shall be included in all
284
+ # copies or substantial portions of the Software.
285
+ #
286
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
287
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
288
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
289
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
290
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
291
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
292
+ # SOFTWARE.
293
+ # </summary>
294
+ # --------------------------------------------------------------------------------------------------------------------
295
+ #
296
+
297
+ module GroupDocsComparisonCloud
298
+
299
+ #
300
+ # Request model for get_revisions operation.
301
+ #
302
+ class GetRevisionsRequest
303
+
304
+ # File information
305
+ attr_accessor :file_info
306
+
307
+ #
308
+ # Initializes a new instance.
309
+ # @param file_info File information
310
+ def initialize(file_info)
311
+ self.file_info = file_info
312
+ end
313
+ end
314
+ end
@@ -0,0 +1,236 @@
1
+ #
2
+ # --------------------------------------------------------------------------------------------------------------------
3
+ # <copyright company="Aspose Pty Ltd" file="apply_revisions_options.rb">
4
+ # Copyright (c) 2003-2020 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
+ # Options for apply revisions method
32
+ class ApplyRevisionsOptions
33
+
34
+ # Information about source file
35
+ attr_accessor :source_file
36
+
37
+ # Revisions to apply or reject.
38
+ attr_accessor :revisions
39
+
40
+ # Path to the resultant document (if not specified the document will not be saved)
41
+ attr_accessor :output_path
42
+
43
+ # Attribute mapping from ruby-style variable name to JSON key.
44
+ def self.attribute_map
45
+ {
46
+ :'source_file' => :'SourceFile',
47
+ :'revisions' => :'Revisions',
48
+ :'output_path' => :'OutputPath'
49
+ }
50
+ end
51
+
52
+ # Attribute type mapping.
53
+ def self.swagger_types
54
+ {
55
+ :'source_file' => :'FileInfo',
56
+ :'revisions' => :'Array<RevisionInfo>',
57
+ :'output_path' => :'String'
58
+ }
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ return unless attributes.is_a?(Hash)
65
+
66
+ # convert string to symbol for hash key
67
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
68
+
69
+ if attributes.key?(:'SourceFile')
70
+ self.source_file = attributes[:'SourceFile']
71
+ end
72
+
73
+ if attributes.key?(:'Revisions')
74
+ if (value = attributes[:'Revisions']).is_a?(Array)
75
+ self.revisions = value
76
+ end
77
+ end
78
+
79
+ if attributes.key?(:'OutputPath')
80
+ self.output_path = attributes[:'OutputPath']
81
+ end
82
+
83
+ end
84
+
85
+ # Show invalid properties with the reasons. Usually used together with valid?
86
+ # @return Array for valid properies with the reasons
87
+ def list_invalid_properties
88
+ invalid_properties = []
89
+ return invalid_properties
90
+ end
91
+
92
+ # Check to see if the all the properties in the model are valid
93
+ # @return true if the model is valid
94
+ def valid?
95
+ return true
96
+ end
97
+
98
+ # Checks equality by comparing each attribute.
99
+ # @param [Object] Object to be compared
100
+ def ==(other)
101
+ return true if self.equal?(other)
102
+ self.class == other.class &&
103
+ source_file == other.source_file &&
104
+ revisions == other.revisions &&
105
+ output_path == other.output_path
106
+ end
107
+
108
+ # @see the `==` method
109
+ # @param [Object] Object to be compared
110
+ def eql?(other)
111
+ self == other
112
+ end
113
+
114
+ # Calculates hash code according to all attributes.
115
+ # @return [Fixnum] Hash code
116
+ def hash
117
+ [source_file, revisions, output_path].hash
118
+ end
119
+
120
+ # Downcases first letter.
121
+ # @return downcased string
122
+ def uncap(str)
123
+ str[0, 1].downcase + str[1..-1]
124
+ end
125
+
126
+ # Builds the object from hash
127
+ # @param [Hash] attributes Model attributes in the form of hash
128
+ # @return [Object] Returns the model itself
129
+ def build_from_hash(attributes)
130
+ return nil unless attributes.is_a?(Hash)
131
+ self.class.swagger_types.each_pair do |key, type|
132
+ pname = uncap(self.class.attribute_map[key]).intern
133
+ value = attributes[pname]
134
+ if type =~ /\AArray<(.*)>/i
135
+ # check to ensure the input is an array given that the the attribute
136
+ # is documented as an array but the input is not
137
+ if value.is_a?(Array)
138
+ self.send("#{key}=", value.map { |v| _deserialize($1, v) })
139
+ end
140
+ elsif !value.nil?
141
+ self.send("#{key}=", _deserialize(type, value))
142
+ end
143
+ # or else data not found in attributes(hash), not an issue as the data can be optional
144
+ end
145
+
146
+ self
147
+ end
148
+
149
+ # Deserializes the data based on type
150
+ # @param string type Data type
151
+ # @param string value Value to be deserialized
152
+ # @return [Object] Deserialized data
153
+ def _deserialize(type, value)
154
+ case type.to_sym
155
+ when :DateTime
156
+ Date.parse value
157
+ when :Date
158
+ Date.parse value
159
+ when :String
160
+ value.to_s
161
+ when :Integer
162
+ value.to_i
163
+ when :Float
164
+ value.to_f
165
+ when :BOOLEAN
166
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
167
+ true
168
+ else
169
+ false
170
+ end
171
+ when :Object
172
+ # generic object (usually a Hash), return directly
173
+ value
174
+ when /\AArray<(?<inner_type>.+)>\z/
175
+ inner_type = Regexp.last_match[:inner_type]
176
+ value.map { |v| _deserialize(inner_type, v) }
177
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
178
+ k_type = Regexp.last_match[:k_type]
179
+ v_type = Regexp.last_match[:v_type]
180
+ {}.tap do |hash|
181
+ value.each do |k, v|
182
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
183
+ end
184
+ end
185
+ else
186
+ # model
187
+ temp_model = GroupDocsComparisonCloud.const_get(type).new
188
+ temp_model.build_from_hash(value)
189
+ end
190
+ end
191
+
192
+ # Returns the string representation of the object
193
+ # @return [String] String presentation of the object
194
+ def to_s
195
+ to_hash.to_s
196
+ end
197
+
198
+ # to_body is an alias to to_hash (backward compatibility)
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_body
201
+ to_hash
202
+ end
203
+
204
+ # Returns the object in the form of hash
205
+ # @return [Hash] Returns the object in the form of hash
206
+ def to_hash
207
+ hash = {}
208
+ self.class.attribute_map.each_pair do |attr, param|
209
+ value = self.send(attr)
210
+ next if value.nil?
211
+ hash[param] = _to_hash(value)
212
+ end
213
+ hash
214
+ end
215
+
216
+ # Outputs non-array value in the form of hash
217
+ # For object, use to_hash. Otherwise, just return the value
218
+ # @param [Object] value Any valid value
219
+ # @return [Hash] Returns the value in the form of hash
220
+ def _to_hash(value)
221
+ if value.is_a?(Array)
222
+ value.compact.map { |v| _to_hash(v) }
223
+ elsif value.is_a?(Hash)
224
+ {}.tap do |hash|
225
+ value.each { |k, v| hash[k] = _to_hash(v) }
226
+ end
227
+ elsif value.respond_to? :to_hash
228
+ value.to_hash
229
+ else
230
+ value
231
+ end
232
+ end
233
+
234
+ end
235
+
236
+ end
@@ -0,0 +1,322 @@
1
+ #
2
+ # --------------------------------------------------------------------------------------------------------------------
3
+ # <copyright company="Aspose Pty Ltd" file="revision_info.rb">
4
+ # Copyright (c) 2003-2020 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
+ # Provides information about one revision.
32
+ class RevisionInfo
33
+
34
+ # Id of revision
35
+ attr_accessor :id
36
+
37
+ # Action (accept or reject). This field allows you to influence the display of the revision.
38
+ attr_accessor :action
39
+
40
+ # The text that is in revision.
41
+ attr_accessor :text
42
+
43
+ # Author.
44
+ attr_accessor :author
45
+
46
+ # RevisionHandler type, depending on the type the Action (accept or reject) logic changes.
47
+ attr_accessor :type
48
+ class EnumAttributeValidator
49
+ attr_reader :datatype
50
+ attr_reader :allowable_values
51
+
52
+ def initialize(datatype, allowable_values)
53
+ @allowable_values = allowable_values.map do |value|
54
+ case datatype.to_s
55
+ when /Integer/i
56
+ value.to_i
57
+ when /Float/i
58
+ value.to_f
59
+ else
60
+ value
61
+ end
62
+ end
63
+ end
64
+
65
+ def valid?(value)
66
+ !value || allowable_values.include?(value)
67
+ end
68
+ end
69
+
70
+ # Attribute mapping from ruby-style variable name to JSON key.
71
+ def self.attribute_map
72
+ {
73
+ :'id' => :'Id',
74
+ :'action' => :'Action',
75
+ :'text' => :'Text',
76
+ :'author' => :'Author',
77
+ :'type' => :'Type'
78
+ }
79
+ end
80
+
81
+ # Attribute type mapping.
82
+ def self.swagger_types
83
+ {
84
+ :'id' => :'Integer',
85
+ :'action' => :'String',
86
+ :'text' => :'String',
87
+ :'author' => :'String',
88
+ :'type' => :'String'
89
+ }
90
+ end
91
+
92
+ # Initializes the object
93
+ # @param [Hash] attributes Model attributes in the form of hash
94
+ def initialize(attributes = {})
95
+ return unless attributes.is_a?(Hash)
96
+
97
+ # convert string to symbol for hash key
98
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
99
+
100
+ if attributes.key?(:'Id')
101
+ self.id = attributes[:'Id']
102
+ end
103
+
104
+ if attributes.key?(:'Action')
105
+ self.action = attributes[:'Action']
106
+ end
107
+
108
+ if attributes.key?(:'Text')
109
+ self.text = attributes[:'Text']
110
+ end
111
+
112
+ if attributes.key?(:'Author')
113
+ self.author = attributes[:'Author']
114
+ end
115
+
116
+ if attributes.key?(:'Type')
117
+ self.type = attributes[:'Type']
118
+ end
119
+
120
+ end
121
+
122
+ # Show invalid properties with the reasons. Usually used together with valid?
123
+ # @return Array for valid properies with the reasons
124
+ def list_invalid_properties
125
+ invalid_properties = []
126
+ if @id.nil?
127
+ invalid_properties.push("invalid value for 'id', id cannot be nil.")
128
+ end
129
+
130
+ if @action.nil?
131
+ invalid_properties.push("invalid value for 'action', action cannot be nil.")
132
+ end
133
+
134
+ if @type.nil?
135
+ invalid_properties.push("invalid value for 'type', type cannot be nil.")
136
+ end
137
+
138
+ return invalid_properties
139
+ end
140
+
141
+ # Check to see if the all the properties in the model are valid
142
+ # @return true if the model is valid
143
+ def valid?
144
+ return false if @id.nil?
145
+ return false if @action.nil?
146
+ action_validator = EnumAttributeValidator.new('String', ["None", "Accept", "Reject"])
147
+ return false unless action_validator.valid?(@action)
148
+ return false if @type.nil?
149
+ type_validator = EnumAttributeValidator.new('String', ["Insertion", "Deletion", "FormatChange", "StyleDefinitionChange", "Moving"])
150
+ return false unless type_validator.valid?(@type)
151
+ return true
152
+ end
153
+
154
+ # Custom attribute writer method checking allowed values (enum).
155
+ # @param [Object] action Object to be assigned
156
+ def action=(action)
157
+ validator = EnumAttributeValidator.new('String', ["None", "Accept", "Reject"])
158
+ if action.to_i == 0
159
+ unless validator.valid?(action)
160
+ raise ArgumentError, "invalid value for 'action', must be one of #{validator.allowable_values}."
161
+ end
162
+ @action = action
163
+ else
164
+ @action = validator.allowable_values[action.to_i]
165
+ end
166
+ end
167
+
168
+ # Custom attribute writer method checking allowed values (enum).
169
+ # @param [Object] type Object to be assigned
170
+ def type=(type)
171
+ validator = EnumAttributeValidator.new('String', ["Insertion", "Deletion", "FormatChange", "StyleDefinitionChange", "Moving"])
172
+ if type.to_i == 0
173
+ unless validator.valid?(type)
174
+ raise ArgumentError, "invalid value for 'type', must be one of #{validator.allowable_values}."
175
+ end
176
+ @type = type
177
+ else
178
+ @type = validator.allowable_values[type.to_i]
179
+ end
180
+ end
181
+
182
+ # Checks equality by comparing each attribute.
183
+ # @param [Object] Object to be compared
184
+ def ==(other)
185
+ return true if self.equal?(other)
186
+ self.class == other.class &&
187
+ id == other.id &&
188
+ action == other.action &&
189
+ text == other.text &&
190
+ author == other.author &&
191
+ type == other.type
192
+ end
193
+
194
+ # @see the `==` method
195
+ # @param [Object] Object to be compared
196
+ def eql?(other)
197
+ self == other
198
+ end
199
+
200
+ # Calculates hash code according to all attributes.
201
+ # @return [Fixnum] Hash code
202
+ def hash
203
+ [id, action, text, author, type].hash
204
+ end
205
+
206
+ # Downcases first letter.
207
+ # @return downcased string
208
+ def uncap(str)
209
+ str[0, 1].downcase + str[1..-1]
210
+ end
211
+
212
+ # Builds the object from hash
213
+ # @param [Hash] attributes Model attributes in the form of hash
214
+ # @return [Object] Returns the model itself
215
+ def build_from_hash(attributes)
216
+ return nil unless attributes.is_a?(Hash)
217
+ self.class.swagger_types.each_pair do |key, type|
218
+ pname = uncap(self.class.attribute_map[key]).intern
219
+ value = attributes[pname]
220
+ if type =~ /\AArray<(.*)>/i
221
+ # check to ensure the input is an array given that the the attribute
222
+ # is documented as an array but the input is not
223
+ if value.is_a?(Array)
224
+ self.send("#{key}=", value.map { |v| _deserialize($1, v) })
225
+ end
226
+ elsif !value.nil?
227
+ self.send("#{key}=", _deserialize(type, value))
228
+ end
229
+ # or else data not found in attributes(hash), not an issue as the data can be optional
230
+ end
231
+
232
+ self
233
+ end
234
+
235
+ # Deserializes the data based on type
236
+ # @param string type Data type
237
+ # @param string value Value to be deserialized
238
+ # @return [Object] Deserialized data
239
+ def _deserialize(type, value)
240
+ case type.to_sym
241
+ when :DateTime
242
+ Date.parse value
243
+ when :Date
244
+ Date.parse value
245
+ when :String
246
+ value.to_s
247
+ when :Integer
248
+ value.to_i
249
+ when :Float
250
+ value.to_f
251
+ when :BOOLEAN
252
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
253
+ true
254
+ else
255
+ false
256
+ end
257
+ when :Object
258
+ # generic object (usually a Hash), return directly
259
+ value
260
+ when /\AArray<(?<inner_type>.+)>\z/
261
+ inner_type = Regexp.last_match[:inner_type]
262
+ value.map { |v| _deserialize(inner_type, v) }
263
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
264
+ k_type = Regexp.last_match[:k_type]
265
+ v_type = Regexp.last_match[:v_type]
266
+ {}.tap do |hash|
267
+ value.each do |k, v|
268
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
269
+ end
270
+ end
271
+ else
272
+ # model
273
+ temp_model = GroupDocsComparisonCloud.const_get(type).new
274
+ temp_model.build_from_hash(value)
275
+ end
276
+ end
277
+
278
+ # Returns the string representation of the object
279
+ # @return [String] String presentation of the object
280
+ def to_s
281
+ to_hash.to_s
282
+ end
283
+
284
+ # to_body is an alias to to_hash (backward compatibility)
285
+ # @return [Hash] Returns the object in the form of hash
286
+ def to_body
287
+ to_hash
288
+ end
289
+
290
+ # Returns the object in the form of hash
291
+ # @return [Hash] Returns the object in the form of hash
292
+ def to_hash
293
+ hash = {}
294
+ self.class.attribute_map.each_pair do |attr, param|
295
+ value = self.send(attr)
296
+ next if value.nil?
297
+ hash[param] = _to_hash(value)
298
+ end
299
+ hash
300
+ end
301
+
302
+ # Outputs non-array value in the form of hash
303
+ # For object, use to_hash. Otherwise, just return the value
304
+ # @param [Object] value Any valid value
305
+ # @return [Hash] Returns the value in the form of hash
306
+ def _to_hash(value)
307
+ if value.is_a?(Array)
308
+ value.compact.map { |v| _to_hash(v) }
309
+ elsif value.is_a?(Hash)
310
+ {}.tap do |hash|
311
+ value.each { |k, v| hash[k] = _to_hash(v) }
312
+ end
313
+ elsif value.respond_to? :to_hash
314
+ value.to_hash
315
+ else
316
+ value
317
+ end
318
+ end
319
+
320
+ end
321
+
322
+ end
@@ -25,5 +25,5 @@
25
25
  # --------------------------------------------------------------------------------------------------------------------
26
26
  #
27
27
  module GroupDocsComparisonCloud
28
- VERSION = "20.5".freeze
28
+ VERSION = "20.12".freeze
29
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: groupdocs_comparison_cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: '20.5'
4
+ version: '20.12'
5
5
  platform: ruby
6
6
  authors:
7
7
  - GroupDocs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-21 00:00:00.000000000 Z
11
+ date: 2020-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -89,10 +89,12 @@ files:
89
89
  - lib/groupdocs_comparison_cloud/api/file_api.rb
90
90
  - lib/groupdocs_comparison_cloud/api/folder_api.rb
91
91
  - lib/groupdocs_comparison_cloud/api/info_api.rb
92
+ - lib/groupdocs_comparison_cloud/api/review_api.rb
92
93
  - lib/groupdocs_comparison_cloud/api/storage_api.rb
93
94
  - lib/groupdocs_comparison_cloud/api_client.rb
94
95
  - lib/groupdocs_comparison_cloud/api_error.rb
95
96
  - lib/groupdocs_comparison_cloud/configuration.rb
97
+ - lib/groupdocs_comparison_cloud/models/apply_revisions_options.rb
96
98
  - lib/groupdocs_comparison_cloud/models/change_info.rb
97
99
  - lib/groupdocs_comparison_cloud/models/comparison_options.rb
98
100
  - lib/groupdocs_comparison_cloud/models/diagram_master_setting.rb
@@ -113,6 +115,7 @@ files:
113
115
  - lib/groupdocs_comparison_cloud/models/object_exist.rb
114
116
  - lib/groupdocs_comparison_cloud/models/page_info.rb
115
117
  - lib/groupdocs_comparison_cloud/models/rectangle.rb
118
+ - lib/groupdocs_comparison_cloud/models/revision_info.rb
116
119
  - lib/groupdocs_comparison_cloud/models/settings.rb
117
120
  - lib/groupdocs_comparison_cloud/models/size.rb
118
121
  - lib/groupdocs_comparison_cloud/models/storage_exist.rb