groupdocs_editor_cloud 19.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/groupdocs_editor_cloud.rb +70 -0
- data/lib/groupdocs_editor_cloud/api/edit_api.rb +314 -0
- data/lib/groupdocs_editor_cloud/api/file_api.rb +729 -0
- data/lib/groupdocs_editor_cloud/api/folder_api.rb +694 -0
- data/lib/groupdocs_editor_cloud/api/info_api.rb +266 -0
- data/lib/groupdocs_editor_cloud/api/storage_api.rb +541 -0
- data/lib/groupdocs_editor_cloud/api_client.rb +380 -0
- data/lib/groupdocs_editor_cloud/api_error.rb +58 -0
- data/lib/groupdocs_editor_cloud/configuration.rb +95 -0
- data/lib/groupdocs_editor_cloud/models/delimited_text_load_options.rb +279 -0
- data/lib/groupdocs_editor_cloud/models/delimited_text_save_options.rb +304 -0
- data/lib/groupdocs_editor_cloud/models/disc_usage.rb +234 -0
- data/lib/groupdocs_editor_cloud/models/document_result.rb +214 -0
- data/lib/groupdocs_editor_cloud/models/error.rb +244 -0
- data/lib/groupdocs_editor_cloud/models/error_details.rb +229 -0
- data/lib/groupdocs_editor_cloud/models/file_info.rb +244 -0
- data/lib/groupdocs_editor_cloud/models/file_version.rb +289 -0
- data/lib/groupdocs_editor_cloud/models/file_versions.rb +216 -0
- data/lib/groupdocs_editor_cloud/models/files_list.rb +216 -0
- data/lib/groupdocs_editor_cloud/models/files_upload_result.rb +228 -0
- data/lib/groupdocs_editor_cloud/models/format.rb +224 -0
- data/lib/groupdocs_editor_cloud/models/formats_result.rb +216 -0
- data/lib/groupdocs_editor_cloud/models/info_result.rb +269 -0
- data/lib/groupdocs_editor_cloud/models/load_options.rb +224 -0
- data/lib/groupdocs_editor_cloud/models/load_result.rb +224 -0
- data/lib/groupdocs_editor_cloud/models/object_exist.rb +234 -0
- data/lib/groupdocs_editor_cloud/models/options.rb +224 -0
- data/lib/groupdocs_editor_cloud/models/pdf_save_options.rb +316 -0
- data/lib/groupdocs_editor_cloud/models/presentation_load_options.rb +254 -0
- data/lib/groupdocs_editor_cloud/models/presentation_save_options.rb +264 -0
- data/lib/groupdocs_editor_cloud/models/save_options.rb +254 -0
- data/lib/groupdocs_editor_cloud/models/spreadsheet_load_options.rb +254 -0
- data/lib/groupdocs_editor_cloud/models/spreadsheet_save_options.rb +326 -0
- data/lib/groupdocs_editor_cloud/models/storage_exist.rb +219 -0
- data/lib/groupdocs_editor_cloud/models/storage_file.rb +264 -0
- data/lib/groupdocs_editor_cloud/models/text_load_options.rb +347 -0
- data/lib/groupdocs_editor_cloud/models/text_save_options.rb +294 -0
- data/lib/groupdocs_editor_cloud/models/word_processing_load_options.rb +306 -0
- data/lib/groupdocs_editor_cloud/models/word_processing_save_options.rb +371 -0
- data/lib/groupdocs_editor_cloud/models/xml_load_options.rb +346 -0
- data/lib/groupdocs_editor_cloud/version.rb +29 -0
- metadata +153 -0
@@ -0,0 +1,371 @@
|
|
1
|
+
#
|
2
|
+
# --------------------------------------------------------------------------------------------------------------------
|
3
|
+
# <copyright company="Aspose Pty Ltd" file="word_processing_save_options.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 GroupDocsEditorCloud
|
31
|
+
# Allows to specify custom options for generating and saving WordProcessing-compliant documents
|
32
|
+
class WordProcessingSaveOptions
|
33
|
+
|
34
|
+
# File info
|
35
|
+
attr_accessor :file_info
|
36
|
+
|
37
|
+
# The full output path
|
38
|
+
attr_accessor :output_path
|
39
|
+
|
40
|
+
# The Html document path
|
41
|
+
attr_accessor :html_path
|
42
|
+
|
43
|
+
# Resources path
|
44
|
+
attr_accessor :resources_path
|
45
|
+
|
46
|
+
# Document format
|
47
|
+
attr_accessor :format
|
48
|
+
|
49
|
+
# Allows to specify document password
|
50
|
+
attr_accessor :password
|
51
|
+
|
52
|
+
# Allows to enable or disable pagination which will be used for saving the document. If the original document was opened and edited in pagination mode, this option also should be enabled. By default is disabled.
|
53
|
+
attr_accessor :enable_pagination
|
54
|
+
|
55
|
+
# Allows to set override default locale (language) for the WordProcessing document, which will be applied during its creation. When is not specified (default value), MS Word (or other program) will detect (or choose) the document locale according to its own settings or other factors.
|
56
|
+
attr_accessor :locale
|
57
|
+
|
58
|
+
# Allows to set override locale (language) for the WordProcessing document for the RTL (right-to-left) text, which will be applied during its creation. When is not specified (default value), MS Word (or other program) will detect (or choose) the document RTL locale according to its own settings or other factors.
|
59
|
+
attr_accessor :locale_bi
|
60
|
+
|
61
|
+
# Allows to override the locale (language) for the WordProcessing document for the East-Asian text, which will be applied during its creation. When is not specified (default value), MS Word (or other program) will detect (or choose) the document East-Asian locale according to its own settings or other factors.
|
62
|
+
attr_accessor :locale_far_east
|
63
|
+
|
64
|
+
# Write-protection type. Default value is NoProtection
|
65
|
+
attr_accessor :protection_type
|
66
|
+
|
67
|
+
# Write-protection password. Used when protection type is specified.
|
68
|
+
attr_accessor :protection_password
|
69
|
+
class EnumAttributeValidator
|
70
|
+
attr_reader :datatype
|
71
|
+
attr_reader :allowable_values
|
72
|
+
|
73
|
+
def initialize(datatype, allowable_values)
|
74
|
+
@allowable_values = allowable_values.map do |value|
|
75
|
+
case datatype.to_s
|
76
|
+
when /Integer/i
|
77
|
+
value.to_i
|
78
|
+
when /Float/i
|
79
|
+
value.to_f
|
80
|
+
else
|
81
|
+
value
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def valid?(value)
|
87
|
+
!value || allowable_values.include?(value)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
92
|
+
def self.attribute_map
|
93
|
+
{
|
94
|
+
:'file_info' => :'FileInfo',
|
95
|
+
:'output_path' => :'OutputPath',
|
96
|
+
:'html_path' => :'HtmlPath',
|
97
|
+
:'resources_path' => :'ResourcesPath',
|
98
|
+
:'format' => :'Format',
|
99
|
+
:'password' => :'Password',
|
100
|
+
:'enable_pagination' => :'EnablePagination',
|
101
|
+
:'locale' => :'Locale',
|
102
|
+
:'locale_bi' => :'LocaleBi',
|
103
|
+
:'locale_far_east' => :'LocaleFarEast',
|
104
|
+
:'protection_type' => :'ProtectionType',
|
105
|
+
:'protection_password' => :'ProtectionPassword'
|
106
|
+
}
|
107
|
+
end
|
108
|
+
|
109
|
+
# Attribute type mapping.
|
110
|
+
def self.swagger_types
|
111
|
+
{
|
112
|
+
:'file_info' => :'FileInfo',
|
113
|
+
:'output_path' => :'String',
|
114
|
+
:'html_path' => :'String',
|
115
|
+
:'resources_path' => :'String',
|
116
|
+
:'format' => :'String',
|
117
|
+
:'password' => :'String',
|
118
|
+
:'enable_pagination' => :'BOOLEAN',
|
119
|
+
:'locale' => :'String',
|
120
|
+
:'locale_bi' => :'String',
|
121
|
+
:'locale_far_east' => :'String',
|
122
|
+
:'protection_type' => :'String',
|
123
|
+
:'protection_password' => :'String'
|
124
|
+
}
|
125
|
+
end
|
126
|
+
|
127
|
+
# Initializes the object
|
128
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
129
|
+
def initialize(attributes = {})
|
130
|
+
return unless attributes.is_a?(Hash)
|
131
|
+
|
132
|
+
# convert string to symbol for hash key
|
133
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
134
|
+
|
135
|
+
if attributes.key?(:'FileInfo')
|
136
|
+
self.file_info = attributes[:'FileInfo']
|
137
|
+
end
|
138
|
+
|
139
|
+
if attributes.key?(:'OutputPath')
|
140
|
+
self.output_path = attributes[:'OutputPath']
|
141
|
+
end
|
142
|
+
|
143
|
+
if attributes.key?(:'HtmlPath')
|
144
|
+
self.html_path = attributes[:'HtmlPath']
|
145
|
+
end
|
146
|
+
|
147
|
+
if attributes.key?(:'ResourcesPath')
|
148
|
+
self.resources_path = attributes[:'ResourcesPath']
|
149
|
+
end
|
150
|
+
|
151
|
+
if attributes.key?(:'Format')
|
152
|
+
self.format = attributes[:'Format']
|
153
|
+
end
|
154
|
+
|
155
|
+
if attributes.key?(:'Password')
|
156
|
+
self.password = attributes[:'Password']
|
157
|
+
end
|
158
|
+
|
159
|
+
if attributes.key?(:'EnablePagination')
|
160
|
+
self.enable_pagination = attributes[:'EnablePagination']
|
161
|
+
end
|
162
|
+
|
163
|
+
if attributes.key?(:'Locale')
|
164
|
+
self.locale = attributes[:'Locale']
|
165
|
+
end
|
166
|
+
|
167
|
+
if attributes.key?(:'LocaleBi')
|
168
|
+
self.locale_bi = attributes[:'LocaleBi']
|
169
|
+
end
|
170
|
+
|
171
|
+
if attributes.key?(:'LocaleFarEast')
|
172
|
+
self.locale_far_east = attributes[:'LocaleFarEast']
|
173
|
+
end
|
174
|
+
|
175
|
+
if attributes.key?(:'ProtectionType')
|
176
|
+
self.protection_type = attributes[:'ProtectionType']
|
177
|
+
end
|
178
|
+
|
179
|
+
if attributes.key?(:'ProtectionPassword')
|
180
|
+
self.protection_password = attributes[:'ProtectionPassword']
|
181
|
+
end
|
182
|
+
|
183
|
+
end
|
184
|
+
|
185
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
186
|
+
# @return Array for valid properies with the reasons
|
187
|
+
def list_invalid_properties
|
188
|
+
invalid_properties = []
|
189
|
+
if @enable_pagination.nil?
|
190
|
+
invalid_properties.push("invalid value for 'enable_pagination', enable_pagination cannot be nil.")
|
191
|
+
end
|
192
|
+
|
193
|
+
if @protection_type.nil?
|
194
|
+
invalid_properties.push("invalid value for 'protection_type', protection_type cannot be nil.")
|
195
|
+
end
|
196
|
+
|
197
|
+
return invalid_properties
|
198
|
+
end
|
199
|
+
|
200
|
+
# Check to see if the all the properties in the model are valid
|
201
|
+
# @return true if the model is valid
|
202
|
+
def valid?
|
203
|
+
return false if @enable_pagination.nil?
|
204
|
+
return false if @protection_type.nil?
|
205
|
+
protection_type_validator = EnumAttributeValidator.new('String', ["NoProtection", "AllowOnlyRevisions", "AllowOnlyComments", "AllowOnlyFormFields", "ReadOnly"])
|
206
|
+
return false unless protection_type_validator.valid?(@protection_type)
|
207
|
+
return true
|
208
|
+
end
|
209
|
+
|
210
|
+
# Custom attribute writer method checking allowed values (enum).
|
211
|
+
# @param [Object] protection_type Object to be assigned
|
212
|
+
def protection_type=(protection_type)
|
213
|
+
validator = EnumAttributeValidator.new('String', ["NoProtection", "AllowOnlyRevisions", "AllowOnlyComments", "AllowOnlyFormFields", "ReadOnly"])
|
214
|
+
if protection_type.to_i == 0
|
215
|
+
unless validator.valid?(protection_type)
|
216
|
+
raise ArgumentError, "invalid value for 'protection_type', must be one of #{validator.allowable_values}."
|
217
|
+
end
|
218
|
+
@protection_type = protection_type
|
219
|
+
else
|
220
|
+
@protection_type = validator.allowable_values[protection_type.to_i]
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
# Checks equality by comparing each attribute.
|
225
|
+
# @param [Object] Object to be compared
|
226
|
+
def ==(other)
|
227
|
+
return true if self.equal?(other)
|
228
|
+
self.class == other.class &&
|
229
|
+
file_info == other.file_info &&
|
230
|
+
output_path == other.output_path &&
|
231
|
+
html_path == other.html_path &&
|
232
|
+
resources_path == other.resources_path &&
|
233
|
+
format == other.format &&
|
234
|
+
password == other.password &&
|
235
|
+
enable_pagination == other.enable_pagination &&
|
236
|
+
locale == other.locale &&
|
237
|
+
locale_bi == other.locale_bi &&
|
238
|
+
locale_far_east == other.locale_far_east &&
|
239
|
+
protection_type == other.protection_type &&
|
240
|
+
protection_password == other.protection_password
|
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
|
+
[file_info, output_path, html_path, resources_path, format, password, enable_pagination, locale, locale_bi, locale_far_east, protection_type, protection_password].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 = GroupDocsEditorCloud.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
|
@@ -0,0 +1,346 @@
|
|
1
|
+
#
|
2
|
+
# --------------------------------------------------------------------------------------------------------------------
|
3
|
+
# <copyright company="Aspose Pty Ltd" file="xml_load_options.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 GroupDocsEditorCloud
|
31
|
+
# Allows to specify custom options for loading XML (eXtensible Markup Language) documents
|
32
|
+
class XmlLoadOptions
|
33
|
+
|
34
|
+
# File info
|
35
|
+
attr_accessor :file_info
|
36
|
+
|
37
|
+
# The full output path
|
38
|
+
attr_accessor :output_path
|
39
|
+
|
40
|
+
# Character encoding of the text document, which will be applied for its opening. By default is null - internal document encoding will be applied.
|
41
|
+
attr_accessor :encoding
|
42
|
+
|
43
|
+
# Allows to enable or disable mechanism for fixing corrupted XML structure. By default is disabled (false).
|
44
|
+
attr_accessor :fix_incorrect_structure
|
45
|
+
|
46
|
+
# Allows to enable URI recognition algorithm
|
47
|
+
attr_accessor :recognize_uris
|
48
|
+
|
49
|
+
# Allows to enable recognition algorithm for email addresses in attribute values
|
50
|
+
attr_accessor :recognize_emails
|
51
|
+
|
52
|
+
# Allows to enable the truncation of trailing whitespaces in the inner-tag text. By default is disabled (false) - trailing whitespaces will be preserved.
|
53
|
+
attr_accessor :trim_trailing_whitespaces
|
54
|
+
|
55
|
+
# Allows to specify quote type (single or double quotes) for attribute values. Double quotes are default.
|
56
|
+
attr_accessor :attribute_values_quote_type
|
57
|
+
class EnumAttributeValidator
|
58
|
+
attr_reader :datatype
|
59
|
+
attr_reader :allowable_values
|
60
|
+
|
61
|
+
def initialize(datatype, allowable_values)
|
62
|
+
@allowable_values = allowable_values.map do |value|
|
63
|
+
case datatype.to_s
|
64
|
+
when /Integer/i
|
65
|
+
value.to_i
|
66
|
+
when /Float/i
|
67
|
+
value.to_f
|
68
|
+
else
|
69
|
+
value
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def valid?(value)
|
75
|
+
!value || allowable_values.include?(value)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
80
|
+
def self.attribute_map
|
81
|
+
{
|
82
|
+
:'file_info' => :'FileInfo',
|
83
|
+
:'output_path' => :'OutputPath',
|
84
|
+
:'encoding' => :'Encoding',
|
85
|
+
:'fix_incorrect_structure' => :'FixIncorrectStructure',
|
86
|
+
:'recognize_uris' => :'RecognizeUris',
|
87
|
+
:'recognize_emails' => :'RecognizeEmails',
|
88
|
+
:'trim_trailing_whitespaces' => :'TrimTrailingWhitespaces',
|
89
|
+
:'attribute_values_quote_type' => :'AttributeValuesQuoteType'
|
90
|
+
}
|
91
|
+
end
|
92
|
+
|
93
|
+
# Attribute type mapping.
|
94
|
+
def self.swagger_types
|
95
|
+
{
|
96
|
+
:'file_info' => :'FileInfo',
|
97
|
+
:'output_path' => :'String',
|
98
|
+
:'encoding' => :'String',
|
99
|
+
:'fix_incorrect_structure' => :'BOOLEAN',
|
100
|
+
:'recognize_uris' => :'BOOLEAN',
|
101
|
+
:'recognize_emails' => :'BOOLEAN',
|
102
|
+
:'trim_trailing_whitespaces' => :'BOOLEAN',
|
103
|
+
:'attribute_values_quote_type' => :'String'
|
104
|
+
}
|
105
|
+
end
|
106
|
+
|
107
|
+
# Initializes the object
|
108
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
109
|
+
def initialize(attributes = {})
|
110
|
+
return unless attributes.is_a?(Hash)
|
111
|
+
|
112
|
+
# convert string to symbol for hash key
|
113
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
114
|
+
|
115
|
+
if attributes.key?(:'FileInfo')
|
116
|
+
self.file_info = attributes[:'FileInfo']
|
117
|
+
end
|
118
|
+
|
119
|
+
if attributes.key?(:'OutputPath')
|
120
|
+
self.output_path = attributes[:'OutputPath']
|
121
|
+
end
|
122
|
+
|
123
|
+
if attributes.key?(:'Encoding')
|
124
|
+
self.encoding = attributes[:'Encoding']
|
125
|
+
end
|
126
|
+
|
127
|
+
if attributes.key?(:'FixIncorrectStructure')
|
128
|
+
self.fix_incorrect_structure = attributes[:'FixIncorrectStructure']
|
129
|
+
end
|
130
|
+
|
131
|
+
if attributes.key?(:'RecognizeUris')
|
132
|
+
self.recognize_uris = attributes[:'RecognizeUris']
|
133
|
+
end
|
134
|
+
|
135
|
+
if attributes.key?(:'RecognizeEmails')
|
136
|
+
self.recognize_emails = attributes[:'RecognizeEmails']
|
137
|
+
end
|
138
|
+
|
139
|
+
if attributes.key?(:'TrimTrailingWhitespaces')
|
140
|
+
self.trim_trailing_whitespaces = attributes[:'TrimTrailingWhitespaces']
|
141
|
+
end
|
142
|
+
|
143
|
+
if attributes.key?(:'AttributeValuesQuoteType')
|
144
|
+
self.attribute_values_quote_type = attributes[:'AttributeValuesQuoteType']
|
145
|
+
end
|
146
|
+
|
147
|
+
end
|
148
|
+
|
149
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
150
|
+
# @return Array for valid properies with the reasons
|
151
|
+
def list_invalid_properties
|
152
|
+
invalid_properties = []
|
153
|
+
if @fix_incorrect_structure.nil?
|
154
|
+
invalid_properties.push("invalid value for 'fix_incorrect_structure', fix_incorrect_structure cannot be nil.")
|
155
|
+
end
|
156
|
+
|
157
|
+
if @recognize_uris.nil?
|
158
|
+
invalid_properties.push("invalid value for 'recognize_uris', recognize_uris cannot be nil.")
|
159
|
+
end
|
160
|
+
|
161
|
+
if @recognize_emails.nil?
|
162
|
+
invalid_properties.push("invalid value for 'recognize_emails', recognize_emails cannot be nil.")
|
163
|
+
end
|
164
|
+
|
165
|
+
if @trim_trailing_whitespaces.nil?
|
166
|
+
invalid_properties.push("invalid value for 'trim_trailing_whitespaces', trim_trailing_whitespaces cannot be nil.")
|
167
|
+
end
|
168
|
+
|
169
|
+
if @attribute_values_quote_type.nil?
|
170
|
+
invalid_properties.push("invalid value for 'attribute_values_quote_type', attribute_values_quote_type cannot be nil.")
|
171
|
+
end
|
172
|
+
|
173
|
+
return invalid_properties
|
174
|
+
end
|
175
|
+
|
176
|
+
# Check to see if the all the properties in the model are valid
|
177
|
+
# @return true if the model is valid
|
178
|
+
def valid?
|
179
|
+
return false if @fix_incorrect_structure.nil?
|
180
|
+
return false if @recognize_uris.nil?
|
181
|
+
return false if @recognize_emails.nil?
|
182
|
+
return false if @trim_trailing_whitespaces.nil?
|
183
|
+
return false if @attribute_values_quote_type.nil?
|
184
|
+
attribute_values_quote_type_validator = EnumAttributeValidator.new('String', ["DoubleQuote", "SingleQuote"])
|
185
|
+
return false unless attribute_values_quote_type_validator.valid?(@attribute_values_quote_type)
|
186
|
+
return true
|
187
|
+
end
|
188
|
+
|
189
|
+
# Custom attribute writer method checking allowed values (enum).
|
190
|
+
# @param [Object] attribute_values_quote_type Object to be assigned
|
191
|
+
def attribute_values_quote_type=(attribute_values_quote_type)
|
192
|
+
validator = EnumAttributeValidator.new('String', ["DoubleQuote", "SingleQuote"])
|
193
|
+
if attribute_values_quote_type.to_i == 0
|
194
|
+
unless validator.valid?(attribute_values_quote_type)
|
195
|
+
raise ArgumentError, "invalid value for 'attribute_values_quote_type', must be one of #{validator.allowable_values}."
|
196
|
+
end
|
197
|
+
@attribute_values_quote_type = attribute_values_quote_type
|
198
|
+
else
|
199
|
+
@attribute_values_quote_type = validator.allowable_values[attribute_values_quote_type.to_i]
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
# Checks equality by comparing each attribute.
|
204
|
+
# @param [Object] Object to be compared
|
205
|
+
def ==(other)
|
206
|
+
return true if self.equal?(other)
|
207
|
+
self.class == other.class &&
|
208
|
+
file_info == other.file_info &&
|
209
|
+
output_path == other.output_path &&
|
210
|
+
encoding == other.encoding &&
|
211
|
+
fix_incorrect_structure == other.fix_incorrect_structure &&
|
212
|
+
recognize_uris == other.recognize_uris &&
|
213
|
+
recognize_emails == other.recognize_emails &&
|
214
|
+
trim_trailing_whitespaces == other.trim_trailing_whitespaces &&
|
215
|
+
attribute_values_quote_type == other.attribute_values_quote_type
|
216
|
+
end
|
217
|
+
|
218
|
+
# @see the `==` method
|
219
|
+
# @param [Object] Object to be compared
|
220
|
+
def eql?(other)
|
221
|
+
self == other
|
222
|
+
end
|
223
|
+
|
224
|
+
# Calculates hash code according to all attributes.
|
225
|
+
# @return [Fixnum] Hash code
|
226
|
+
def hash
|
227
|
+
[file_info, output_path, encoding, fix_incorrect_structure, recognize_uris, recognize_emails, trim_trailing_whitespaces, attribute_values_quote_type].hash
|
228
|
+
end
|
229
|
+
|
230
|
+
# Downcases first letter.
|
231
|
+
# @return downcased string
|
232
|
+
def uncap(str)
|
233
|
+
str[0, 1].downcase + str[1..-1]
|
234
|
+
end
|
235
|
+
|
236
|
+
# Builds the object from hash
|
237
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
238
|
+
# @return [Object] Returns the model itself
|
239
|
+
def build_from_hash(attributes)
|
240
|
+
return nil unless attributes.is_a?(Hash)
|
241
|
+
self.class.swagger_types.each_pair do |key, type|
|
242
|
+
pname = uncap(self.class.attribute_map[key]).intern
|
243
|
+
value = attributes[pname]
|
244
|
+
if type =~ /\AArray<(.*)>/i
|
245
|
+
# check to ensure the input is an array given that the the attribute
|
246
|
+
# is documented as an array but the input is not
|
247
|
+
if value.is_a?(Array)
|
248
|
+
self.send("#{key}=", value.map { |v| _deserialize($1, v) })
|
249
|
+
end
|
250
|
+
elsif !value.nil?
|
251
|
+
self.send("#{key}=", _deserialize(type, value))
|
252
|
+
end
|
253
|
+
# or else data not found in attributes(hash), not an issue as the data can be optional
|
254
|
+
end
|
255
|
+
|
256
|
+
self
|
257
|
+
end
|
258
|
+
|
259
|
+
# Deserializes the data based on type
|
260
|
+
# @param string type Data type
|
261
|
+
# @param string value Value to be deserialized
|
262
|
+
# @return [Object] Deserialized data
|
263
|
+
def _deserialize(type, value)
|
264
|
+
case type.to_sym
|
265
|
+
when :DateTime
|
266
|
+
Date.parse value
|
267
|
+
when :Date
|
268
|
+
Date.parse value
|
269
|
+
when :String
|
270
|
+
value.to_s
|
271
|
+
when :Integer
|
272
|
+
value.to_i
|
273
|
+
when :Float
|
274
|
+
value.to_f
|
275
|
+
when :BOOLEAN
|
276
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
277
|
+
true
|
278
|
+
else
|
279
|
+
false
|
280
|
+
end
|
281
|
+
when :Object
|
282
|
+
# generic object (usually a Hash), return directly
|
283
|
+
value
|
284
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
285
|
+
inner_type = Regexp.last_match[:inner_type]
|
286
|
+
value.map { |v| _deserialize(inner_type, v) }
|
287
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
288
|
+
k_type = Regexp.last_match[:k_type]
|
289
|
+
v_type = Regexp.last_match[:v_type]
|
290
|
+
{}.tap do |hash|
|
291
|
+
value.each do |k, v|
|
292
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
293
|
+
end
|
294
|
+
end
|
295
|
+
else
|
296
|
+
# model
|
297
|
+
temp_model = GroupDocsEditorCloud.const_get(type).new
|
298
|
+
temp_model.build_from_hash(value)
|
299
|
+
end
|
300
|
+
end
|
301
|
+
|
302
|
+
# Returns the string representation of the object
|
303
|
+
# @return [String] String presentation of the object
|
304
|
+
def to_s
|
305
|
+
to_hash.to_s
|
306
|
+
end
|
307
|
+
|
308
|
+
# to_body is an alias to to_hash (backward compatibility)
|
309
|
+
# @return [Hash] Returns the object in the form of hash
|
310
|
+
def to_body
|
311
|
+
to_hash
|
312
|
+
end
|
313
|
+
|
314
|
+
# Returns the object in the form of hash
|
315
|
+
# @return [Hash] Returns the object in the form of hash
|
316
|
+
def to_hash
|
317
|
+
hash = {}
|
318
|
+
self.class.attribute_map.each_pair do |attr, param|
|
319
|
+
value = self.send(attr)
|
320
|
+
next if value.nil?
|
321
|
+
hash[param] = _to_hash(value)
|
322
|
+
end
|
323
|
+
hash
|
324
|
+
end
|
325
|
+
|
326
|
+
# Outputs non-array value in the form of hash
|
327
|
+
# For object, use to_hash. Otherwise, just return the value
|
328
|
+
# @param [Object] value Any valid value
|
329
|
+
# @return [Hash] Returns the value in the form of hash
|
330
|
+
def _to_hash(value)
|
331
|
+
if value.is_a?(Array)
|
332
|
+
value.compact.map { |v| _to_hash(v) }
|
333
|
+
elsif value.is_a?(Hash)
|
334
|
+
{}.tap do |hash|
|
335
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
336
|
+
end
|
337
|
+
elsif value.respond_to? :to_hash
|
338
|
+
value.to_hash
|
339
|
+
else
|
340
|
+
value
|
341
|
+
end
|
342
|
+
end
|
343
|
+
|
344
|
+
end
|
345
|
+
|
346
|
+
end
|