groupdocs_comparison_cloud 18.9 → 21.3.1
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 +4 -4
- data/lib/groupdocs_comparison_cloud.rb +34 -42
- data/lib/groupdocs_comparison_cloud/api/compare_api.rb +411 -0
- data/lib/groupdocs_comparison_cloud/api/file_api.rb +729 -0
- data/lib/groupdocs_comparison_cloud/api/folder_api.rb +694 -0
- data/lib/groupdocs_comparison_cloud/api/info_api.rb +266 -0
- data/lib/groupdocs_comparison_cloud/api/review_api.rb +314 -0
- data/lib/groupdocs_comparison_cloud/api/storage_api.rb +541 -0
- data/lib/groupdocs_comparison_cloud/api_client.rb +7 -17
- data/lib/groupdocs_comparison_cloud/api_error.rb +19 -4
- data/lib/groupdocs_comparison_cloud/configuration.rb +3 -3
- data/lib/groupdocs_comparison_cloud/models/{comparison_change.rb → apply_revisions_options.rb} +65 -64
- data/lib/groupdocs_comparison_cloud/models/change_info.rb +371 -0
- data/lib/groupdocs_comparison_cloud/models/comparison_options.rb +298 -0
- data/lib/groupdocs_comparison_cloud/models/diagram_master_setting.rb +229 -0
- data/lib/groupdocs_comparison_cloud/models/disc_usage.rb +234 -0
- data/lib/groupdocs_comparison_cloud/models/error.rb +244 -0
- data/lib/groupdocs_comparison_cloud/models/{comparison_file_info.rb → error_details.rb} +39 -36
- data/lib/groupdocs_comparison_cloud/models/{style_settings_values.rb → file_info.rb} +51 -38
- data/lib/groupdocs_comparison_cloud/models/file_version.rb +289 -0
- data/lib/groupdocs_comparison_cloud/models/{value_type.rb → file_versions.rb} +33 -13
- data/lib/groupdocs_comparison_cloud/models/{comparison_changes_category_dto.rb → files_list.rb} +28 -30
- data/lib/groupdocs_comparison_cloud/models/files_upload_result.rb +228 -0
- data/lib/groupdocs_comparison_cloud/models/format.rb +224 -0
- data/lib/groupdocs_comparison_cloud/models/{comparison_style_change.rb → formats_result.rb} +29 -19
- data/lib/groupdocs_comparison_cloud/models/info_result.rb +254 -0
- data/lib/groupdocs_comparison_cloud/models/items_style.rb +304 -0
- data/lib/groupdocs_comparison_cloud/models/link.rb +16 -8
- data/lib/groupdocs_comparison_cloud/models/{comparison_metadata_values.rb → metadata.rb} +28 -20
- data/lib/groupdocs_comparison_cloud/models/object_exist.rb +234 -0
- data/lib/groupdocs_comparison_cloud/models/{comparison_request.rb → page_info.rb} +56 -47
- data/lib/groupdocs_comparison_cloud/models/rectangle.rb +264 -0
- data/lib/groupdocs_comparison_cloud/models/revision_info.rb +322 -0
- data/lib/groupdocs_comparison_cloud/models/settings.rb +581 -0
- data/lib/groupdocs_comparison_cloud/models/size.rb +234 -0
- data/lib/groupdocs_comparison_cloud/models/storage_exist.rb +219 -0
- data/lib/groupdocs_comparison_cloud/models/storage_file.rb +264 -0
- data/lib/groupdocs_comparison_cloud/models/style_change_info.rb +234 -0
- data/lib/groupdocs_comparison_cloud/models/updates_options.rb +310 -0
- data/lib/groupdocs_comparison_cloud/version.rb +2 -2
- metadata +35 -58
- data/lib/groupdocs_comparison_cloud/api/changes_api.rb +0 -470
- data/lib/groupdocs_comparison_cloud/api/comparison_api.rb +0 -365
- data/lib/groupdocs_comparison_cloud/models/color.rb +0 -1404
- data/lib/groupdocs_comparison_cloud/models/comparison_request_settings.rb +0 -378
- data/lib/groupdocs_comparison_cloud/models/requests/comparison_images_request.rb +0 -49
- data/lib/groupdocs_comparison_cloud/models/requests/comparison_images_stream_request.rb +0 -45
- data/lib/groupdocs_comparison_cloud/models/requests/comparison_request.rb +0 -49
- data/lib/groupdocs_comparison_cloud/models/requests/comparison_stream_request.rb +0 -45
- data/lib/groupdocs_comparison_cloud/models/requests/post_categories_changes_request.rb +0 -49
- data/lib/groupdocs_comparison_cloud/models/requests/post_changes_request.rb +0 -45
- data/lib/groupdocs_comparison_cloud/models/requests/put_changes_document_request.rb +0 -49
- data/lib/groupdocs_comparison_cloud/models/requests/put_changes_document_stream_request.rb +0 -45
- data/lib/groupdocs_comparison_cloud/models/requests/put_changes_images_request.rb +0 -49
- 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-
|
3
|
+
# Copyright (c) 2003-2021 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
|
-
|
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
|
-
|
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
|
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-
|
3
|
+
# Copyright (c) 2003-2021 Aspose Pty Ltd
|
4
4
|
# </copyright>
|
5
5
|
# <summary>
|
6
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
@@ -39,13 +39,28 @@ module GroupDocsComparisonCloud
|
|
39
39
|
|
40
40
|
if arg.key?(:response_body) then
|
41
41
|
data = JSON.parse(arg[:response_body], :symbolize_names => true)
|
42
|
-
if !data.nil?
|
43
|
-
|
42
|
+
if !data.nil? then
|
43
|
+
if !data[:error].nil? then
|
44
|
+
error = data[:error]
|
45
|
+
if error.kind_of?(String) then
|
46
|
+
@message = error
|
47
|
+
else
|
48
|
+
@message = error[:message]
|
49
|
+
end
|
50
|
+
else
|
51
|
+
message = data[:message]
|
52
|
+
if !message.nil? && message.kind_of?(String) then
|
53
|
+
@message = message
|
54
|
+
@code = data[:code]
|
55
|
+
else
|
56
|
+
@message = data
|
57
|
+
end
|
58
|
+
end
|
44
59
|
end
|
45
60
|
end
|
46
61
|
|
47
62
|
if arg.key?(:arg) then
|
48
|
-
@code = arg[:
|
63
|
+
@code = arg[:Code]
|
49
64
|
end
|
50
65
|
|
51
66
|
else
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# ------------------------------------------------------------------------------------
|
2
2
|
# <copyright company="Aspose Pty Ltd" file="configuration.rb">
|
3
|
-
# Copyright (c) 2003-
|
3
|
+
# Copyright (c) 2003-2021 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 '/
|
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 = '/
|
84
|
+
@api_version = '/v2.0'
|
85
85
|
@app_sid = app_sid
|
86
86
|
@app_key = app_key
|
87
87
|
@client_side_validation = true
|
data/lib/groupdocs_comparison_cloud/models/{comparison_change.rb → apply_revisions_options.rb}
RENAMED
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# --------------------------------------------------------------------------------------------------------------------
|
3
|
-
# <copyright company="Aspose Pty Ltd" file="
|
4
|
-
# Copyright (c) 2003-
|
3
|
+
# <copyright company="Aspose Pty Ltd" file="apply_revisions_options.rb">
|
4
|
+
# Copyright (c) 2003-2021 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,48 +28,43 @@
|
|
28
28
|
require 'date'
|
29
29
|
|
30
30
|
module GroupDocsComparisonCloud
|
31
|
-
#
|
32
|
-
class
|
31
|
+
# Options for apply revisions method
|
32
|
+
class ApplyRevisionsOptions
|
33
33
|
|
34
|
-
#
|
35
|
-
attr_accessor :
|
34
|
+
# Information about source file
|
35
|
+
attr_accessor :source_file
|
36
36
|
|
37
|
-
#
|
38
|
-
attr_accessor :
|
37
|
+
# Revisions to apply or reject.
|
38
|
+
attr_accessor :revisions
|
39
39
|
|
40
|
-
#
|
41
|
-
attr_accessor :
|
40
|
+
# Indicates whether to apply all revisions in the document
|
41
|
+
attr_accessor :accept_all
|
42
42
|
|
43
|
-
#
|
44
|
-
attr_accessor :
|
43
|
+
# Indicates whether to reject all revisions in the document
|
44
|
+
attr_accessor :reject_all
|
45
45
|
|
46
|
-
#
|
47
|
-
attr_accessor :
|
48
|
-
|
49
|
-
# The style changes
|
50
|
-
attr_accessor :style_changes
|
46
|
+
# Path to the resultant document (if not specified the document will not be saved)
|
47
|
+
attr_accessor :output_path
|
51
48
|
|
52
49
|
# Attribute mapping from ruby-style variable name to JSON key.
|
53
50
|
def self.attribute_map
|
54
51
|
{
|
55
|
-
:'
|
56
|
-
:'
|
57
|
-
:'
|
58
|
-
:'
|
59
|
-
:'
|
60
|
-
:'style_changes' => :'styleChanges'
|
52
|
+
:'source_file' => :'SourceFile',
|
53
|
+
:'revisions' => :'Revisions',
|
54
|
+
:'accept_all' => :'AcceptAll',
|
55
|
+
:'reject_all' => :'RejectAll',
|
56
|
+
:'output_path' => :'OutputPath'
|
61
57
|
}
|
62
58
|
end
|
63
59
|
|
64
60
|
# Attribute type mapping.
|
65
61
|
def self.swagger_types
|
66
62
|
{
|
67
|
-
:'
|
68
|
-
:'
|
69
|
-
:'
|
70
|
-
:'
|
71
|
-
:'
|
72
|
-
:'style_changes' => :'Array<ComparisonStyleChange>'
|
63
|
+
:'source_file' => :'FileInfo',
|
64
|
+
:'revisions' => :'Array<RevisionInfo>',
|
65
|
+
:'accept_all' => :'BOOLEAN',
|
66
|
+
:'reject_all' => :'BOOLEAN',
|
67
|
+
:'output_path' => :'String'
|
73
68
|
}
|
74
69
|
end
|
75
70
|
|
@@ -81,32 +76,26 @@ module GroupDocsComparisonCloud
|
|
81
76
|
# convert string to symbol for hash key
|
82
77
|
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
83
78
|
|
84
|
-
if attributes.key?(:'
|
85
|
-
self.
|
86
|
-
end
|
87
|
-
|
88
|
-
if attributes.key?(:'type')
|
89
|
-
self.type = attributes[:'type']
|
79
|
+
if attributes.key?(:'SourceFile')
|
80
|
+
self.source_file = attributes[:'SourceFile']
|
90
81
|
end
|
91
82
|
|
92
|
-
if attributes.key?(:'
|
93
|
-
|
83
|
+
if attributes.key?(:'Revisions')
|
84
|
+
if (value = attributes[:'Revisions']).is_a?(Array)
|
85
|
+
self.revisions = value
|
86
|
+
end
|
94
87
|
end
|
95
88
|
|
96
|
-
if attributes.key?(:'
|
97
|
-
|
98
|
-
self.authors = value
|
99
|
-
end
|
89
|
+
if attributes.key?(:'AcceptAll')
|
90
|
+
self.accept_all = attributes[:'AcceptAll']
|
100
91
|
end
|
101
92
|
|
102
|
-
if attributes.key?(:'
|
103
|
-
self.
|
93
|
+
if attributes.key?(:'RejectAll')
|
94
|
+
self.reject_all = attributes[:'RejectAll']
|
104
95
|
end
|
105
96
|
|
106
|
-
if attributes.key?(:'
|
107
|
-
|
108
|
-
self.style_changes = value
|
109
|
-
end
|
97
|
+
if attributes.key?(:'OutputPath')
|
98
|
+
self.output_path = attributes[:'OutputPath']
|
110
99
|
end
|
111
100
|
|
112
101
|
end
|
@@ -115,8 +104,12 @@ module GroupDocsComparisonCloud
|
|
115
104
|
# @return Array for valid properies with the reasons
|
116
105
|
def list_invalid_properties
|
117
106
|
invalid_properties = []
|
118
|
-
if @
|
119
|
-
invalid_properties.push("invalid value for '
|
107
|
+
if @accept_all.nil?
|
108
|
+
invalid_properties.push("invalid value for 'accept_all', accept_all cannot be nil.")
|
109
|
+
end
|
110
|
+
|
111
|
+
if @reject_all.nil?
|
112
|
+
invalid_properties.push("invalid value for 'reject_all', reject_all cannot be nil.")
|
120
113
|
end
|
121
114
|
|
122
115
|
return invalid_properties
|
@@ -125,7 +118,8 @@ module GroupDocsComparisonCloud
|
|
125
118
|
# Check to see if the all the properties in the model are valid
|
126
119
|
# @return true if the model is valid
|
127
120
|
def valid?
|
128
|
-
return false if @
|
121
|
+
return false if @accept_all.nil?
|
122
|
+
return false if @reject_all.nil?
|
129
123
|
return true
|
130
124
|
end
|
131
125
|
|
@@ -134,12 +128,11 @@ module GroupDocsComparisonCloud
|
|
134
128
|
def ==(other)
|
135
129
|
return true if self.equal?(other)
|
136
130
|
self.class == other.class &&
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
style_changes == other.style_changes
|
131
|
+
source_file == other.source_file &&
|
132
|
+
revisions == other.revisions &&
|
133
|
+
accept_all == other.accept_all &&
|
134
|
+
reject_all == other.reject_all &&
|
135
|
+
output_path == other.output_path
|
143
136
|
end
|
144
137
|
|
145
138
|
# @see the `==` method
|
@@ -151,7 +144,13 @@ module GroupDocsComparisonCloud
|
|
151
144
|
# Calculates hash code according to all attributes.
|
152
145
|
# @return [Fixnum] Hash code
|
153
146
|
def hash
|
154
|
-
[
|
147
|
+
[source_file, revisions, accept_all, reject_all, output_path].hash
|
148
|
+
end
|
149
|
+
|
150
|
+
# Downcases first letter.
|
151
|
+
# @return downcased string
|
152
|
+
def uncap(str)
|
153
|
+
str[0, 1].downcase + str[1..-1]
|
155
154
|
end
|
156
155
|
|
157
156
|
# Builds the object from hash
|
@@ -160,14 +159,16 @@ module GroupDocsComparisonCloud
|
|
160
159
|
def build_from_hash(attributes)
|
161
160
|
return nil unless attributes.is_a?(Hash)
|
162
161
|
self.class.swagger_types.each_pair do |key, type|
|
162
|
+
pname = uncap(self.class.attribute_map[key]).intern
|
163
|
+
value = attributes[pname]
|
163
164
|
if type =~ /\AArray<(.*)>/i
|
164
165
|
# 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
|
167
|
-
self.send("#{key}=",
|
166
|
+
# is documented as an array but the input is not
|
167
|
+
if value.is_a?(Array)
|
168
|
+
self.send("#{key}=", value.map { |v| _deserialize($1, v) })
|
168
169
|
end
|
169
|
-
elsif !
|
170
|
-
self.send("#{key}=", _deserialize(type,
|
170
|
+
elsif !value.nil?
|
171
|
+
self.send("#{key}=", _deserialize(type, value))
|
171
172
|
end
|
172
173
|
# or else data not found in attributes(hash), not an issue as the data can be optional
|
173
174
|
end
|
@@ -182,9 +183,9 @@ module GroupDocsComparisonCloud
|
|
182
183
|
def _deserialize(type, value)
|
183
184
|
case type.to_sym
|
184
185
|
when :DateTime
|
185
|
-
|
186
|
+
Date.parse value
|
186
187
|
when :Date
|
187
|
-
|
188
|
+
Date.parse value
|
188
189
|
when :String
|
189
190
|
value.to_s
|
190
191
|
when :Integer
|
@@ -0,0 +1,371 @@
|
|
1
|
+
#
|
2
|
+
# --------------------------------------------------------------------------------------------------------------------
|
3
|
+
# <copyright company="Aspose Pty Ltd" file="change_info.rb">
|
4
|
+
# Copyright (c) 2003-2021 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
|
+
# ChangeInfo Object fields
|
32
|
+
class ChangeInfo
|
33
|
+
|
34
|
+
# Id of change
|
35
|
+
attr_accessor :id
|
36
|
+
|
37
|
+
# Action (accept or reject). This field shows comparison what to do with this change
|
38
|
+
attr_accessor :comparison_action
|
39
|
+
|
40
|
+
# Type of change (Inserted, Deleted or StyleChanged)
|
41
|
+
attr_accessor :type
|
42
|
+
|
43
|
+
# Text of changed element
|
44
|
+
attr_accessor :text
|
45
|
+
|
46
|
+
# Changed text of target doc
|
47
|
+
attr_accessor :target_text
|
48
|
+
|
49
|
+
# Array of authors who made this change (used for multi comparison)
|
50
|
+
attr_accessor :authors
|
51
|
+
|
52
|
+
# Array of style changes
|
53
|
+
attr_accessor :style_change_info
|
54
|
+
|
55
|
+
# Page where current change is placed
|
56
|
+
attr_accessor :page_info
|
57
|
+
|
58
|
+
# Coordinates of changed element
|
59
|
+
attr_accessor :box
|
60
|
+
class EnumAttributeValidator
|
61
|
+
attr_reader :datatype
|
62
|
+
attr_reader :allowable_values
|
63
|
+
|
64
|
+
def initialize(datatype, allowable_values)
|
65
|
+
@allowable_values = allowable_values.map do |value|
|
66
|
+
case datatype.to_s
|
67
|
+
when /Integer/i
|
68
|
+
value.to_i
|
69
|
+
when /Float/i
|
70
|
+
value.to_f
|
71
|
+
else
|
72
|
+
value
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def valid?(value)
|
78
|
+
!value || allowable_values.include?(value)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
83
|
+
def self.attribute_map
|
84
|
+
{
|
85
|
+
:'id' => :'Id',
|
86
|
+
:'comparison_action' => :'ComparisonAction',
|
87
|
+
:'type' => :'Type',
|
88
|
+
:'text' => :'Text',
|
89
|
+
:'target_text' => :'TargetText',
|
90
|
+
:'authors' => :'Authors',
|
91
|
+
:'style_change_info' => :'StyleChangeInfo',
|
92
|
+
:'page_info' => :'PageInfo',
|
93
|
+
:'box' => :'Box'
|
94
|
+
}
|
95
|
+
end
|
96
|
+
|
97
|
+
# Attribute type mapping.
|
98
|
+
def self.swagger_types
|
99
|
+
{
|
100
|
+
:'id' => :'Integer',
|
101
|
+
:'comparison_action' => :'String',
|
102
|
+
:'type' => :'String',
|
103
|
+
:'text' => :'String',
|
104
|
+
:'target_text' => :'String',
|
105
|
+
:'authors' => :'Array<String>',
|
106
|
+
:'style_change_info' => :'Array<StyleChangeInfo>',
|
107
|
+
:'page_info' => :'PageInfo',
|
108
|
+
:'box' => :'Rectangle'
|
109
|
+
}
|
110
|
+
end
|
111
|
+
|
112
|
+
# Initializes the object
|
113
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
114
|
+
def initialize(attributes = {})
|
115
|
+
return unless attributes.is_a?(Hash)
|
116
|
+
|
117
|
+
# convert string to symbol for hash key
|
118
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
119
|
+
|
120
|
+
if attributes.key?(:'Id')
|
121
|
+
self.id = attributes[:'Id']
|
122
|
+
end
|
123
|
+
|
124
|
+
if attributes.key?(:'ComparisonAction')
|
125
|
+
self.comparison_action = attributes[:'ComparisonAction']
|
126
|
+
end
|
127
|
+
|
128
|
+
if attributes.key?(:'Type')
|
129
|
+
self.type = attributes[:'Type']
|
130
|
+
end
|
131
|
+
|
132
|
+
if attributes.key?(:'Text')
|
133
|
+
self.text = attributes[:'Text']
|
134
|
+
end
|
135
|
+
|
136
|
+
if attributes.key?(:'TargetText')
|
137
|
+
self.target_text = attributes[:'TargetText']
|
138
|
+
end
|
139
|
+
|
140
|
+
if attributes.key?(:'Authors')
|
141
|
+
if (value = attributes[:'Authors']).is_a?(Array)
|
142
|
+
self.authors = value
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
if attributes.key?(:'StyleChangeInfo')
|
147
|
+
if (value = attributes[:'StyleChangeInfo']).is_a?(Array)
|
148
|
+
self.style_change_info = value
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
if attributes.key?(:'PageInfo')
|
153
|
+
self.page_info = attributes[:'PageInfo']
|
154
|
+
end
|
155
|
+
|
156
|
+
if attributes.key?(:'Box')
|
157
|
+
self.box = attributes[:'Box']
|
158
|
+
end
|
159
|
+
|
160
|
+
end
|
161
|
+
|
162
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
163
|
+
# @return Array for valid properies with the reasons
|
164
|
+
def list_invalid_properties
|
165
|
+
invalid_properties = []
|
166
|
+
if @id.nil?
|
167
|
+
invalid_properties.push("invalid value for 'id', id cannot be nil.")
|
168
|
+
end
|
169
|
+
|
170
|
+
if @comparison_action.nil?
|
171
|
+
invalid_properties.push("invalid value for 'comparison_action', comparison_action cannot be nil.")
|
172
|
+
end
|
173
|
+
|
174
|
+
if @type.nil?
|
175
|
+
invalid_properties.push("invalid value for 'type', type cannot be nil.")
|
176
|
+
end
|
177
|
+
|
178
|
+
if @box.nil?
|
179
|
+
invalid_properties.push("invalid value for 'box', box cannot be nil.")
|
180
|
+
end
|
181
|
+
|
182
|
+
return invalid_properties
|
183
|
+
end
|
184
|
+
|
185
|
+
# Check to see if the all the properties in the model are valid
|
186
|
+
# @return true if the model is valid
|
187
|
+
def valid?
|
188
|
+
return false if @id.nil?
|
189
|
+
return false if @comparison_action.nil?
|
190
|
+
comparison_action_validator = EnumAttributeValidator.new('String', ["None", "Accept", "Reject"])
|
191
|
+
return false unless comparison_action_validator.valid?(@comparison_action)
|
192
|
+
return false if @type.nil?
|
193
|
+
type_validator = EnumAttributeValidator.new('String', ["None", "Modified", "Inserted", "Deleted", "Added", "NotModified", "StyleChanged", "Resized", "Moved", "MovedAndResized", "ShiftedAndResized"])
|
194
|
+
return false unless type_validator.valid?(@type)
|
195
|
+
return false if @box.nil?
|
196
|
+
return true
|
197
|
+
end
|
198
|
+
|
199
|
+
# Custom attribute writer method checking allowed values (enum).
|
200
|
+
# @param [Object] comparison_action Object to be assigned
|
201
|
+
def comparison_action=(comparison_action)
|
202
|
+
validator = EnumAttributeValidator.new('String', ["None", "Accept", "Reject"])
|
203
|
+
if comparison_action.to_i == 0
|
204
|
+
unless validator.valid?(comparison_action)
|
205
|
+
raise ArgumentError, "invalid value for 'comparison_action', must be one of #{validator.allowable_values}."
|
206
|
+
end
|
207
|
+
@comparison_action = comparison_action
|
208
|
+
else
|
209
|
+
@comparison_action = validator.allowable_values[comparison_action.to_i]
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
# Custom attribute writer method checking allowed values (enum).
|
214
|
+
# @param [Object] type Object to be assigned
|
215
|
+
def type=(type)
|
216
|
+
validator = EnumAttributeValidator.new('String', ["None", "Modified", "Inserted", "Deleted", "Added", "NotModified", "StyleChanged", "Resized", "Moved", "MovedAndResized", "ShiftedAndResized"])
|
217
|
+
if type.to_i == 0
|
218
|
+
unless validator.valid?(type)
|
219
|
+
raise ArgumentError, "invalid value for 'type', must be one of #{validator.allowable_values}."
|
220
|
+
end
|
221
|
+
@type = type
|
222
|
+
else
|
223
|
+
@type = validator.allowable_values[type.to_i]
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
# Checks equality by comparing each attribute.
|
228
|
+
# @param [Object] Object to be compared
|
229
|
+
def ==(other)
|
230
|
+
return true if self.equal?(other)
|
231
|
+
self.class == other.class &&
|
232
|
+
id == other.id &&
|
233
|
+
comparison_action == other.comparison_action &&
|
234
|
+
type == other.type &&
|
235
|
+
text == other.text &&
|
236
|
+
target_text == other.target_text &&
|
237
|
+
authors == other.authors &&
|
238
|
+
style_change_info == other.style_change_info &&
|
239
|
+
page_info == other.page_info &&
|
240
|
+
box == other.box
|
241
|
+
end
|
242
|
+
|
243
|
+
# @see the `==` method
|
244
|
+
# @param [Object] Object to be compared
|
245
|
+
def eql?(other)
|
246
|
+
self == other
|
247
|
+
end
|
248
|
+
|
249
|
+
# Calculates hash code according to all attributes.
|
250
|
+
# @return [Fixnum] Hash code
|
251
|
+
def hash
|
252
|
+
[id, comparison_action, type, text, target_text, authors, style_change_info, page_info, box].hash
|
253
|
+
end
|
254
|
+
|
255
|
+
# Downcases first letter.
|
256
|
+
# @return downcased string
|
257
|
+
def uncap(str)
|
258
|
+
str[0, 1].downcase + str[1..-1]
|
259
|
+
end
|
260
|
+
|
261
|
+
# Builds the object from hash
|
262
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
263
|
+
# @return [Object] Returns the model itself
|
264
|
+
def build_from_hash(attributes)
|
265
|
+
return nil unless attributes.is_a?(Hash)
|
266
|
+
self.class.swagger_types.each_pair do |key, type|
|
267
|
+
pname = uncap(self.class.attribute_map[key]).intern
|
268
|
+
value = attributes[pname]
|
269
|
+
if type =~ /\AArray<(.*)>/i
|
270
|
+
# check to ensure the input is an array given that the the attribute
|
271
|
+
# is documented as an array but the input is not
|
272
|
+
if value.is_a?(Array)
|
273
|
+
self.send("#{key}=", value.map { |v| _deserialize($1, v) })
|
274
|
+
end
|
275
|
+
elsif !value.nil?
|
276
|
+
self.send("#{key}=", _deserialize(type, value))
|
277
|
+
end
|
278
|
+
# or else data not found in attributes(hash), not an issue as the data can be optional
|
279
|
+
end
|
280
|
+
|
281
|
+
self
|
282
|
+
end
|
283
|
+
|
284
|
+
# Deserializes the data based on type
|
285
|
+
# @param string type Data type
|
286
|
+
# @param string value Value to be deserialized
|
287
|
+
# @return [Object] Deserialized data
|
288
|
+
def _deserialize(type, value)
|
289
|
+
case type.to_sym
|
290
|
+
when :DateTime
|
291
|
+
Date.parse value
|
292
|
+
when :Date
|
293
|
+
Date.parse value
|
294
|
+
when :String
|
295
|
+
value.to_s
|
296
|
+
when :Integer
|
297
|
+
value.to_i
|
298
|
+
when :Float
|
299
|
+
value.to_f
|
300
|
+
when :BOOLEAN
|
301
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
302
|
+
true
|
303
|
+
else
|
304
|
+
false
|
305
|
+
end
|
306
|
+
when :Object
|
307
|
+
# generic object (usually a Hash), return directly
|
308
|
+
value
|
309
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
310
|
+
inner_type = Regexp.last_match[:inner_type]
|
311
|
+
value.map { |v| _deserialize(inner_type, v) }
|
312
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
313
|
+
k_type = Regexp.last_match[:k_type]
|
314
|
+
v_type = Regexp.last_match[:v_type]
|
315
|
+
{}.tap do |hash|
|
316
|
+
value.each do |k, v|
|
317
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
318
|
+
end
|
319
|
+
end
|
320
|
+
else
|
321
|
+
# model
|
322
|
+
temp_model = GroupDocsComparisonCloud.const_get(type).new
|
323
|
+
temp_model.build_from_hash(value)
|
324
|
+
end
|
325
|
+
end
|
326
|
+
|
327
|
+
# Returns the string representation of the object
|
328
|
+
# @return [String] String presentation of the object
|
329
|
+
def to_s
|
330
|
+
to_hash.to_s
|
331
|
+
end
|
332
|
+
|
333
|
+
# to_body is an alias to to_hash (backward compatibility)
|
334
|
+
# @return [Hash] Returns the object in the form of hash
|
335
|
+
def to_body
|
336
|
+
to_hash
|
337
|
+
end
|
338
|
+
|
339
|
+
# Returns the object in the form of hash
|
340
|
+
# @return [Hash] Returns the object in the form of hash
|
341
|
+
def to_hash
|
342
|
+
hash = {}
|
343
|
+
self.class.attribute_map.each_pair do |attr, param|
|
344
|
+
value = self.send(attr)
|
345
|
+
next if value.nil?
|
346
|
+
hash[param] = _to_hash(value)
|
347
|
+
end
|
348
|
+
hash
|
349
|
+
end
|
350
|
+
|
351
|
+
# Outputs non-array value in the form of hash
|
352
|
+
# For object, use to_hash. Otherwise, just return the value
|
353
|
+
# @param [Object] value Any valid value
|
354
|
+
# @return [Hash] Returns the value in the form of hash
|
355
|
+
def _to_hash(value)
|
356
|
+
if value.is_a?(Array)
|
357
|
+
value.compact.map { |v| _to_hash(v) }
|
358
|
+
elsif value.is_a?(Hash)
|
359
|
+
{}.tap do |hash|
|
360
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
361
|
+
end
|
362
|
+
elsif value.respond_to? :to_hash
|
363
|
+
value.to_hash
|
364
|
+
else
|
365
|
+
value
|
366
|
+
end
|
367
|
+
end
|
368
|
+
|
369
|
+
end
|
370
|
+
|
371
|
+
end
|