aspose_cad_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/aspose_cad_cloud.rb +83 -0
- data/lib/aspose_cad_cloud/api/cad_api.rb +2138 -0
- data/lib/aspose_cad_cloud/api_client.rb +403 -0
- data/lib/aspose_cad_cloud/api_error.rb +54 -0
- data/lib/aspose_cad_cloud/configuration.rb +189 -0
- data/lib/aspose_cad_cloud/models/bmp_options_dto.rb +327 -0
- data/lib/aspose_cad_cloud/models/cad_rasterization_options_dto.rb +473 -0
- data/lib/aspose_cad_cloud/models/cad_response.rb +317 -0
- data/lib/aspose_cad_cloud/models/cff2_properties.rb +197 -0
- data/lib/aspose_cad_cloud/models/color.rb +312 -0
- data/lib/aspose_cad_cloud/models/dgn_properties.rb +197 -0
- data/lib/aspose_cad_cloud/models/drawing_options_base_dto.rb +281 -0
- data/lib/aspose_cad_cloud/models/dwf_properties.rb +197 -0
- data/lib/aspose_cad_cloud/models/dwg_properties.rb +197 -0
- data/lib/aspose_cad_cloud/models/dxf_properties.rb +197 -0
- data/lib/aspose_cad_cloud/models/gif_options_dto.rb +386 -0
- data/lib/aspose_cad_cloud/models/graphics_options.rb +311 -0
- data/lib/aspose_cad_cloud/models/ifc_properties.rb +197 -0
- data/lib/aspose_cad_cloud/models/igs_properties.rb +197 -0
- data/lib/aspose_cad_cloud/models/jpeg2000_options_dto.rb +322 -0
- data/lib/aspose_cad_cloud/models/jpeg_options_dto.rb +378 -0
- data/lib/aspose_cad_cloud/models/pdf_document_info.rb +237 -0
- data/lib/aspose_cad_cloud/models/pdf_document_options.rb +249 -0
- data/lib/aspose_cad_cloud/models/pdf_options_dto.rb +301 -0
- data/lib/aspose_cad_cloud/models/pen_options.rb +280 -0
- data/lib/aspose_cad_cloud/models/png_options_dto.rb +388 -0
- data/lib/aspose_cad_cloud/models/psd_options_dto.rb +388 -0
- data/lib/aspose_cad_cloud/models/rd_optimizer_settings.rb +302 -0
- data/lib/aspose_cad_cloud/models/requests/GetDrawingPropertiesRequest.rb +53 -0
- data/lib/aspose_cad_cloud/models/requests/GetDrawingResizeRequest.rb +69 -0
- data/lib/aspose_cad_cloud/models/requests/GetDrawingRotateFlipRequest.rb +65 -0
- data/lib/aspose_cad_cloud/models/requests/GetDrawingSaveAsRequest.rb +61 -0
- data/lib/aspose_cad_cloud/models/requests/PostDrawingBmpRequest.rb +61 -0
- data/lib/aspose_cad_cloud/models/requests/PostDrawingGifRequest.rb +61 -0
- data/lib/aspose_cad_cloud/models/requests/PostDrawingJpeg2000Request.rb +61 -0
- data/lib/aspose_cad_cloud/models/requests/PostDrawingJpegRequest.rb +61 -0
- data/lib/aspose_cad_cloud/models/requests/PostDrawingPdfRequest.rb +61 -0
- data/lib/aspose_cad_cloud/models/requests/PostDrawingPngRequest.rb +61 -0
- data/lib/aspose_cad_cloud/models/requests/PostDrawingPropertiesRequest.rb +45 -0
- data/lib/aspose_cad_cloud/models/requests/PostDrawingPsdRequest.rb +61 -0
- data/lib/aspose_cad_cloud/models/requests/PostDrawingResizeRequest.rb +65 -0
- data/lib/aspose_cad_cloud/models/requests/PostDrawingRotateFlipRequest.rb +61 -0
- data/lib/aspose_cad_cloud/models/requests/PostDrawingSaveAsRequest.rb +57 -0
- data/lib/aspose_cad_cloud/models/requests/PostDrawingSvgRequest.rb +61 -0
- data/lib/aspose_cad_cloud/models/requests/PostDrawingTiffRequest.rb +61 -0
- data/lib/aspose_cad_cloud/models/requests/PostDrawingWmfRequest.rb +61 -0
- data/lib/aspose_cad_cloud/models/requests/PutDrawingBmpRequest.rb +57 -0
- data/lib/aspose_cad_cloud/models/requests/PutDrawingGifRequest.rb +57 -0
- data/lib/aspose_cad_cloud/models/requests/PutDrawingJpeg2000Request.rb +57 -0
- data/lib/aspose_cad_cloud/models/requests/PutDrawingJpegRequest.rb +57 -0
- data/lib/aspose_cad_cloud/models/requests/PutDrawingPdfRequest.rb +57 -0
- data/lib/aspose_cad_cloud/models/requests/PutDrawingPngRequest.rb +57 -0
- data/lib/aspose_cad_cloud/models/requests/PutDrawingPsdRequest.rb +57 -0
- data/lib/aspose_cad_cloud/models/requests/PutDrawingSvgRequest.rb +57 -0
- data/lib/aspose_cad_cloud/models/requests/PutDrawingTiffRequest.rb +57 -0
- data/lib/aspose_cad_cloud/models/requests/PutDrawingWmfRequest.rb +57 -0
- data/lib/aspose_cad_cloud/models/resolution_setting.rb +227 -0
- data/lib/aspose_cad_cloud/models/stl_properties.rb +197 -0
- data/lib/aspose_cad_cloud/models/svg_options_dto.rb +327 -0
- data/lib/aspose_cad_cloud/models/tiff_options_dto.rb +417 -0
- data/lib/aspose_cad_cloud/models/vector_rasterization_options_dto.rb +363 -0
- data/lib/aspose_cad_cloud/models/wmf_options_dto.rb +296 -0
- data/lib/aspose_cad_cloud/version.rb +29 -0
- metadata +178 -0
@@ -0,0 +1,378 @@
|
|
1
|
+
|
2
|
+
require 'date'
|
3
|
+
|
4
|
+
module AsposeCadCloud
|
5
|
+
#
|
6
|
+
# --------------------------------------------------------------------------------------------------------------------
|
7
|
+
# <copyright company="Aspose" file="JpegOptionsDTO.rb">
|
8
|
+
# Copyright (c) 2017 Aspose.CAD Cloud
|
9
|
+
# </copyright>
|
10
|
+
# <summary>
|
11
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
12
|
+
# of this software and associated documentation files (the "Software"), to deal
|
13
|
+
# in the Software without restriction, including without limitation the rights
|
14
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
15
|
+
# copies of the Software, and to permit persons to whom the Software is
|
16
|
+
# furnished to do so, subject to the following conditions:
|
17
|
+
#
|
18
|
+
# The above copyright notice and this permission notice shall be included in all
|
19
|
+
# copies or substantial portions of the Software.
|
20
|
+
#
|
21
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
22
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
23
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
24
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
25
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
26
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
27
|
+
# SOFTWARE.
|
28
|
+
# </summary>
|
29
|
+
# --------------------------------------------------------------------------------------------------------------------
|
30
|
+
#
|
31
|
+
|
32
|
+
# Export options for JPEG format
|
33
|
+
class JpegOptionsDTO
|
34
|
+
# Resulting rotation operation
|
35
|
+
attr_accessor :rotation
|
36
|
+
|
37
|
+
# Layers to export
|
38
|
+
attr_accessor :layers
|
39
|
+
|
40
|
+
# DPI resolution settings
|
41
|
+
attr_accessor :resolution_settings
|
42
|
+
|
43
|
+
# Raster options
|
44
|
+
attr_accessor :vector_rasterization_options
|
45
|
+
|
46
|
+
# Comment to Resulting file
|
47
|
+
attr_accessor :comment
|
48
|
+
|
49
|
+
# Compression type
|
50
|
+
attr_accessor :compression_type
|
51
|
+
|
52
|
+
# Color type
|
53
|
+
attr_accessor :color_type
|
54
|
+
|
55
|
+
# Quality level
|
56
|
+
attr_accessor :quality
|
57
|
+
|
58
|
+
# Optimizer settings
|
59
|
+
attr_accessor :rd_opt_settings
|
60
|
+
|
61
|
+
class EnumAttributeValidator
|
62
|
+
attr_reader :datatype
|
63
|
+
attr_reader :allowable_values
|
64
|
+
|
65
|
+
def initialize(datatype, allowable_values)
|
66
|
+
@allowable_values = allowable_values.map do |value|
|
67
|
+
case datatype.to_s
|
68
|
+
when /Integer/i
|
69
|
+
value.to_i
|
70
|
+
when /Float/i
|
71
|
+
value.to_f
|
72
|
+
else
|
73
|
+
value
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def valid?(value)
|
79
|
+
!value || allowable_values.include?(value)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
84
|
+
def self.attribute_map
|
85
|
+
{
|
86
|
+
:'rotation' => :'Rotation',
|
87
|
+
:'layers' => :'Layers',
|
88
|
+
:'resolution_settings' => :'ResolutionSettings',
|
89
|
+
:'vector_rasterization_options' => :'VectorRasterizationOptions',
|
90
|
+
:'comment' => :'Comment',
|
91
|
+
:'compression_type' => :'CompressionType',
|
92
|
+
:'color_type' => :'ColorType',
|
93
|
+
:'quality' => :'Quality',
|
94
|
+
:'rd_opt_settings' => :'RdOptSettings'
|
95
|
+
}
|
96
|
+
end
|
97
|
+
|
98
|
+
# Attribute type mapping.
|
99
|
+
def self.swagger_types
|
100
|
+
{
|
101
|
+
:'rotation' => :'String',
|
102
|
+
:'layers' => :'Array<String>',
|
103
|
+
:'resolution_settings' => :'ResolutionSetting',
|
104
|
+
:'vector_rasterization_options' => :'CadRasterizationOptionsDTO',
|
105
|
+
:'comment' => :'String',
|
106
|
+
:'compression_type' => :'String',
|
107
|
+
:'color_type' => :'String',
|
108
|
+
:'quality' => :'Integer',
|
109
|
+
:'rd_opt_settings' => :'RdOptimizerSettings'
|
110
|
+
}
|
111
|
+
end
|
112
|
+
|
113
|
+
# Initializes the object
|
114
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
115
|
+
def initialize(attributes = {})
|
116
|
+
return unless attributes.is_a?(Hash)
|
117
|
+
|
118
|
+
# convert string to symbol for hash key
|
119
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
120
|
+
|
121
|
+
if attributes.key?(:'Rotation')
|
122
|
+
self.rotation = attributes[:'Rotation']
|
123
|
+
end
|
124
|
+
|
125
|
+
if attributes.key?(:'Layers')
|
126
|
+
if (value = attributes[:'Layers']).is_a?(Array)
|
127
|
+
self.layers = value
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
if attributes.key?(:'ResolutionSettings')
|
132
|
+
self.resolution_settings = attributes[:'ResolutionSettings']
|
133
|
+
end
|
134
|
+
|
135
|
+
if attributes.key?(:'VectorRasterizationOptions')
|
136
|
+
self.vector_rasterization_options = attributes[:'VectorRasterizationOptions']
|
137
|
+
end
|
138
|
+
|
139
|
+
if attributes.key?(:'Comment')
|
140
|
+
self.comment = attributes[:'Comment']
|
141
|
+
end
|
142
|
+
|
143
|
+
if attributes.key?(:'CompressionType')
|
144
|
+
self.compression_type = attributes[:'CompressionType']
|
145
|
+
end
|
146
|
+
|
147
|
+
if attributes.key?(:'ColorType')
|
148
|
+
self.color_type = attributes[:'ColorType']
|
149
|
+
end
|
150
|
+
|
151
|
+
if attributes.key?(:'Quality')
|
152
|
+
self.quality = attributes[:'Quality']
|
153
|
+
end
|
154
|
+
|
155
|
+
if attributes.key?(:'RdOptSettings')
|
156
|
+
self.rd_opt_settings = attributes[:'RdOptSettings']
|
157
|
+
end
|
158
|
+
|
159
|
+
end
|
160
|
+
|
161
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
162
|
+
# @return Array for valid properies with the reasons
|
163
|
+
def list_invalid_properties
|
164
|
+
invalid_properties = []
|
165
|
+
if @rotation.nil?
|
166
|
+
invalid_properties.push("invalid value for 'rotation', rotation cannot be nil.")
|
167
|
+
end
|
168
|
+
|
169
|
+
if @compression_type.nil?
|
170
|
+
invalid_properties.push("invalid value for 'compression_type', compression_type cannot be nil.")
|
171
|
+
end
|
172
|
+
|
173
|
+
if @color_type.nil?
|
174
|
+
invalid_properties.push("invalid value for 'color_type', color_type cannot be nil.")
|
175
|
+
end
|
176
|
+
|
177
|
+
if @quality.nil?
|
178
|
+
invalid_properties.push("invalid value for 'quality', quality cannot be nil.")
|
179
|
+
end
|
180
|
+
|
181
|
+
return invalid_properties
|
182
|
+
end
|
183
|
+
|
184
|
+
# Check to see if the all the properties in the model are valid
|
185
|
+
# @return true if the model is valid
|
186
|
+
def valid?
|
187
|
+
return false if @rotation.nil?
|
188
|
+
rotation_validator = EnumAttributeValidator.new('String', ["RotateNoneFlipNone", "Rotate90FlipNone", "Rotate180FlipNone", "Rotate270FlipNone", "RotateNoneFlipX", "Rotate90FlipX", "Rotate180FlipX", "Rotate270FlipX", "RotateNoneFlipY", "Rotate90FlipY", "Rotate180FlipY", "Rotate270FlipY", "RotateNoneFlipXY", "Rotate90FlipXY", "Rotate180FlipXY", "Rotate270FlipXY"])
|
189
|
+
return false unless rotation_validator.valid?(@rotation)
|
190
|
+
return false if @compression_type.nil?
|
191
|
+
compression_type_validator = EnumAttributeValidator.new('String', ["Baseline", "Progressive", "Lossless", "JpegLs"])
|
192
|
+
return false unless compression_type_validator.valid?(@compression_type)
|
193
|
+
return false if @color_type.nil?
|
194
|
+
color_type_validator = EnumAttributeValidator.new('String', ["Grayscale", "YCbCr", "Cmyk", "Ycck", "Rgb"])
|
195
|
+
return false unless color_type_validator.valid?(@color_type)
|
196
|
+
return false if @quality.nil?
|
197
|
+
return true
|
198
|
+
end
|
199
|
+
|
200
|
+
# Custom attribute writer method checking allowed values (enum).
|
201
|
+
# @param [Object] rotation Object to be assigned
|
202
|
+
def rotation=(rotation)
|
203
|
+
validator = EnumAttributeValidator.new('String', ["RotateNoneFlipNone", "Rotate90FlipNone", "Rotate180FlipNone", "Rotate270FlipNone", "RotateNoneFlipX", "Rotate90FlipX", "Rotate180FlipX", "Rotate270FlipX", "RotateNoneFlipY", "Rotate90FlipY", "Rotate180FlipY", "Rotate270FlipY", "RotateNoneFlipXY", "Rotate90FlipXY", "Rotate180FlipXY", "Rotate270FlipXY"])
|
204
|
+
if rotation.to_i == 0
|
205
|
+
unless validator.valid?(rotation)
|
206
|
+
raise ArgumentError, "invalid value for 'rotation', must be one of #{validator.allowable_values}."
|
207
|
+
end
|
208
|
+
@rotation = rotation
|
209
|
+
else
|
210
|
+
@rotation = validator.allowable_values[rotation.to_i]
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
# Custom attribute writer method checking allowed values (enum).
|
215
|
+
# @param [Object] compression_type Object to be assigned
|
216
|
+
def compression_type=(compression_type)
|
217
|
+
validator = EnumAttributeValidator.new('String', ["Baseline", "Progressive", "Lossless", "JpegLs"])
|
218
|
+
if compression_type.to_i == 0
|
219
|
+
unless validator.valid?(compression_type)
|
220
|
+
raise ArgumentError, "invalid value for 'compression_type', must be one of #{validator.allowable_values}."
|
221
|
+
end
|
222
|
+
@compression_type = compression_type
|
223
|
+
else
|
224
|
+
@compression_type = validator.allowable_values[compression_type.to_i]
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
# Custom attribute writer method checking allowed values (enum).
|
229
|
+
# @param [Object] color_type Object to be assigned
|
230
|
+
def color_type=(color_type)
|
231
|
+
validator = EnumAttributeValidator.new('String', ["Grayscale", "YCbCr", "Cmyk", "Ycck", "Rgb"])
|
232
|
+
if color_type.to_i == 0
|
233
|
+
unless validator.valid?(color_type)
|
234
|
+
raise ArgumentError, "invalid value for 'color_type', must be one of #{validator.allowable_values}."
|
235
|
+
end
|
236
|
+
@color_type = color_type
|
237
|
+
else
|
238
|
+
@color_type = validator.allowable_values[color_type.to_i]
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
# Checks equality by comparing each attribute.
|
243
|
+
# @param [Object] Object to be compared
|
244
|
+
def ==(other)
|
245
|
+
return true if self.equal?(other)
|
246
|
+
self.class == other.class &&
|
247
|
+
rotation == other.rotation &&
|
248
|
+
layers == other.layers &&
|
249
|
+
resolution_settings == other.resolution_settings &&
|
250
|
+
vector_rasterization_options == other.vector_rasterization_options &&
|
251
|
+
comment == other.comment &&
|
252
|
+
compression_type == other.compression_type &&
|
253
|
+
color_type == other.color_type &&
|
254
|
+
quality == other.quality &&
|
255
|
+
rd_opt_settings == other.rd_opt_settings
|
256
|
+
end
|
257
|
+
|
258
|
+
# @see the `==` method
|
259
|
+
# @param [Object] Object to be compared
|
260
|
+
def eql?(other)
|
261
|
+
self == other
|
262
|
+
end
|
263
|
+
|
264
|
+
# Calculates hash code according to all attributes.
|
265
|
+
# @return [Fixnum] Hash code
|
266
|
+
def hash
|
267
|
+
[rotation, layers, resolution_settings, vector_rasterization_options, comment, compression_type, color_type, quality, rd_opt_settings].hash
|
268
|
+
end
|
269
|
+
|
270
|
+
# Builds the object from hash
|
271
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
272
|
+
# @return [Object] Returns the model itself
|
273
|
+
def build_from_hash(attributes)
|
274
|
+
return nil unless attributes.is_a?(Hash)
|
275
|
+
self.class.swagger_types.each_pair do |key, type|
|
276
|
+
if type =~ /\AArray<(.*)>/i
|
277
|
+
# check to ensure the input is an array given that the the attribute
|
278
|
+
# is documented as an array but the input is not
|
279
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
280
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
281
|
+
end
|
282
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
283
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
284
|
+
end
|
285
|
+
# or else data not found in attributes(hash), not an issue as the data can be optional
|
286
|
+
end
|
287
|
+
|
288
|
+
self
|
289
|
+
end
|
290
|
+
|
291
|
+
# Deserializes the data based on type
|
292
|
+
# @param string type Data type
|
293
|
+
# @param string value Value to be deserialized
|
294
|
+
# @return [Object] Deserialized data
|
295
|
+
def _deserialize(type, value)
|
296
|
+
case type.to_sym
|
297
|
+
when :DateTime
|
298
|
+
Time.at(/\d/.match(value)[0].to_f).to_datetime
|
299
|
+
when :Date
|
300
|
+
Time.at(/\d/.match(value)[0].to_f).to_date
|
301
|
+
when :String
|
302
|
+
value.to_s
|
303
|
+
when :Integer
|
304
|
+
value.to_i
|
305
|
+
when :Float
|
306
|
+
value.to_f
|
307
|
+
when :BOOLEAN
|
308
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
309
|
+
true
|
310
|
+
else
|
311
|
+
false
|
312
|
+
end
|
313
|
+
when :Object
|
314
|
+
# generic object (usually a Hash), return directly
|
315
|
+
value
|
316
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
317
|
+
inner_type = Regexp.last_match[:inner_type]
|
318
|
+
value.map { |v| _deserialize(inner_type, v) }
|
319
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
320
|
+
k_type = Regexp.last_match[:k_type]
|
321
|
+
v_type = Regexp.last_match[:v_type]
|
322
|
+
{}.tap do |hash|
|
323
|
+
value.each do |k, v|
|
324
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
325
|
+
end
|
326
|
+
end
|
327
|
+
else
|
328
|
+
# model
|
329
|
+
temp_model = AsposeCadCloud.const_get(type).new
|
330
|
+
temp_model.build_from_hash(value)
|
331
|
+
end
|
332
|
+
end
|
333
|
+
|
334
|
+
# Returns the string representation of the object
|
335
|
+
# @return [String] String presentation of the object
|
336
|
+
def to_s
|
337
|
+
to_hash.to_s
|
338
|
+
end
|
339
|
+
|
340
|
+
# to_body is an alias to to_hash (backward compatibility)
|
341
|
+
# @return [Hash] Returns the object in the form of hash
|
342
|
+
def to_body
|
343
|
+
to_hash
|
344
|
+
end
|
345
|
+
|
346
|
+
# Returns the object in the form of hash
|
347
|
+
# @return [Hash] Returns the object in the form of hash
|
348
|
+
def to_hash
|
349
|
+
hash = {}
|
350
|
+
self.class.attribute_map.each_pair do |attr, param|
|
351
|
+
value = self.send(attr)
|
352
|
+
next if value.nil?
|
353
|
+
hash[param] = _to_hash(value)
|
354
|
+
end
|
355
|
+
hash
|
356
|
+
end
|
357
|
+
|
358
|
+
# Outputs non-array value in the form of hash
|
359
|
+
# For object, use to_hash. Otherwise, just return the value
|
360
|
+
# @param [Object] value Any valid value
|
361
|
+
# @return [Hash] Returns the value in the form of hash
|
362
|
+
def _to_hash(value)
|
363
|
+
if value.is_a?(Array)
|
364
|
+
value.compact.map { |v| _to_hash(v) }
|
365
|
+
elsif value.is_a?(Hash)
|
366
|
+
{}.tap do |hash|
|
367
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
368
|
+
end
|
369
|
+
elsif value.respond_to? :to_hash
|
370
|
+
value.to_hash
|
371
|
+
else
|
372
|
+
value
|
373
|
+
end
|
374
|
+
end
|
375
|
+
|
376
|
+
end
|
377
|
+
|
378
|
+
end
|
@@ -0,0 +1,237 @@
|
|
1
|
+
|
2
|
+
require 'date'
|
3
|
+
|
4
|
+
module AsposeCadCloud
|
5
|
+
#
|
6
|
+
# --------------------------------------------------------------------------------------------------------------------
|
7
|
+
# <copyright company="Aspose" file="PdfDocumentInfo.rb">
|
8
|
+
# Copyright (c) 2017 Aspose.CAD Cloud
|
9
|
+
# </copyright>
|
10
|
+
# <summary>
|
11
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
12
|
+
# of this software and associated documentation files (the "Software"), to deal
|
13
|
+
# in the Software without restriction, including without limitation the rights
|
14
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
15
|
+
# copies of the Software, and to permit persons to whom the Software is
|
16
|
+
# furnished to do so, subject to the following conditions:
|
17
|
+
#
|
18
|
+
# The above copyright notice and this permission notice shall be included in all
|
19
|
+
# copies or substantial portions of the Software.
|
20
|
+
#
|
21
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
22
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
23
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
24
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
25
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
26
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
27
|
+
# SOFTWARE.
|
28
|
+
# </summary>
|
29
|
+
# --------------------------------------------------------------------------------------------------------------------
|
30
|
+
#
|
31
|
+
|
32
|
+
# This class represents set of metadata for document description.
|
33
|
+
class PdfDocumentInfo
|
34
|
+
# Gets or sets keywords of the document.
|
35
|
+
attr_accessor :keywords
|
36
|
+
|
37
|
+
# Gets or sets title of the document.
|
38
|
+
attr_accessor :title
|
39
|
+
|
40
|
+
# Gets or sets author of the document.
|
41
|
+
attr_accessor :author
|
42
|
+
|
43
|
+
# Gets or sets subject of the document.
|
44
|
+
attr_accessor :subject
|
45
|
+
|
46
|
+
|
47
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
48
|
+
def self.attribute_map
|
49
|
+
{
|
50
|
+
:'keywords' => :'Keywords',
|
51
|
+
:'title' => :'Title',
|
52
|
+
:'author' => :'Author',
|
53
|
+
:'subject' => :'Subject'
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
57
|
+
# Attribute type mapping.
|
58
|
+
def self.swagger_types
|
59
|
+
{
|
60
|
+
:'keywords' => :'String',
|
61
|
+
:'title' => :'String',
|
62
|
+
:'author' => :'String',
|
63
|
+
:'subject' => :'String'
|
64
|
+
}
|
65
|
+
end
|
66
|
+
|
67
|
+
# Initializes the object
|
68
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
69
|
+
def initialize(attributes = {})
|
70
|
+
return unless attributes.is_a?(Hash)
|
71
|
+
|
72
|
+
# convert string to symbol for hash key
|
73
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
74
|
+
|
75
|
+
if attributes.key?(:'Keywords')
|
76
|
+
self.keywords = attributes[:'Keywords']
|
77
|
+
end
|
78
|
+
|
79
|
+
if attributes.key?(:'Title')
|
80
|
+
self.title = attributes[:'Title']
|
81
|
+
end
|
82
|
+
|
83
|
+
if attributes.key?(:'Author')
|
84
|
+
self.author = attributes[:'Author']
|
85
|
+
end
|
86
|
+
|
87
|
+
if attributes.key?(:'Subject')
|
88
|
+
self.subject = attributes[:'Subject']
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
92
|
+
|
93
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
94
|
+
# @return Array for valid properies with the reasons
|
95
|
+
def list_invalid_properties
|
96
|
+
invalid_properties = []
|
97
|
+
return invalid_properties
|
98
|
+
end
|
99
|
+
|
100
|
+
# Check to see if the all the properties in the model are valid
|
101
|
+
# @return true if the model is valid
|
102
|
+
def valid?
|
103
|
+
return true
|
104
|
+
end
|
105
|
+
|
106
|
+
# Checks equality by comparing each attribute.
|
107
|
+
# @param [Object] Object to be compared
|
108
|
+
def ==(other)
|
109
|
+
return true if self.equal?(other)
|
110
|
+
self.class == other.class &&
|
111
|
+
keywords == other.keywords &&
|
112
|
+
title == other.title &&
|
113
|
+
author == other.author &&
|
114
|
+
subject == other.subject
|
115
|
+
end
|
116
|
+
|
117
|
+
# @see the `==` method
|
118
|
+
# @param [Object] Object to be compared
|
119
|
+
def eql?(other)
|
120
|
+
self == other
|
121
|
+
end
|
122
|
+
|
123
|
+
# Calculates hash code according to all attributes.
|
124
|
+
# @return [Fixnum] Hash code
|
125
|
+
def hash
|
126
|
+
[keywords, title, author, subject].hash
|
127
|
+
end
|
128
|
+
|
129
|
+
# Builds the object from hash
|
130
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
131
|
+
# @return [Object] Returns the model itself
|
132
|
+
def build_from_hash(attributes)
|
133
|
+
return nil unless attributes.is_a?(Hash)
|
134
|
+
self.class.swagger_types.each_pair do |key, type|
|
135
|
+
if type =~ /\AArray<(.*)>/i
|
136
|
+
# check to ensure the input is an array given that the the attribute
|
137
|
+
# is documented as an array but the input is not
|
138
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
139
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
140
|
+
end
|
141
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
142
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
143
|
+
end
|
144
|
+
# or else data not found in attributes(hash), not an issue as the data can be optional
|
145
|
+
end
|
146
|
+
|
147
|
+
self
|
148
|
+
end
|
149
|
+
|
150
|
+
# Deserializes the data based on type
|
151
|
+
# @param string type Data type
|
152
|
+
# @param string value Value to be deserialized
|
153
|
+
# @return [Object] Deserialized data
|
154
|
+
def _deserialize(type, value)
|
155
|
+
case type.to_sym
|
156
|
+
when :DateTime
|
157
|
+
Time.at(/\d/.match(value)[0].to_f).to_datetime
|
158
|
+
when :Date
|
159
|
+
Time.at(/\d/.match(value)[0].to_f).to_date
|
160
|
+
when :String
|
161
|
+
value.to_s
|
162
|
+
when :Integer
|
163
|
+
value.to_i
|
164
|
+
when :Float
|
165
|
+
value.to_f
|
166
|
+
when :BOOLEAN
|
167
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
168
|
+
true
|
169
|
+
else
|
170
|
+
false
|
171
|
+
end
|
172
|
+
when :Object
|
173
|
+
# generic object (usually a Hash), return directly
|
174
|
+
value
|
175
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
176
|
+
inner_type = Regexp.last_match[:inner_type]
|
177
|
+
value.map { |v| _deserialize(inner_type, v) }
|
178
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
179
|
+
k_type = Regexp.last_match[:k_type]
|
180
|
+
v_type = Regexp.last_match[:v_type]
|
181
|
+
{}.tap do |hash|
|
182
|
+
value.each do |k, v|
|
183
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
else
|
187
|
+
# model
|
188
|
+
temp_model = AsposeCadCloud.const_get(type).new
|
189
|
+
temp_model.build_from_hash(value)
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
# Returns the string representation of the object
|
194
|
+
# @return [String] String presentation of the object
|
195
|
+
def to_s
|
196
|
+
to_hash.to_s
|
197
|
+
end
|
198
|
+
|
199
|
+
# to_body is an alias to to_hash (backward compatibility)
|
200
|
+
# @return [Hash] Returns the object in the form of hash
|
201
|
+
def to_body
|
202
|
+
to_hash
|
203
|
+
end
|
204
|
+
|
205
|
+
# Returns the object in the form of hash
|
206
|
+
# @return [Hash] Returns the object in the form of hash
|
207
|
+
def to_hash
|
208
|
+
hash = {}
|
209
|
+
self.class.attribute_map.each_pair do |attr, param|
|
210
|
+
value = self.send(attr)
|
211
|
+
next if value.nil?
|
212
|
+
hash[param] = _to_hash(value)
|
213
|
+
end
|
214
|
+
hash
|
215
|
+
end
|
216
|
+
|
217
|
+
# Outputs non-array value in the form of hash
|
218
|
+
# For object, use to_hash. Otherwise, just return the value
|
219
|
+
# @param [Object] value Any valid value
|
220
|
+
# @return [Hash] Returns the value in the form of hash
|
221
|
+
def _to_hash(value)
|
222
|
+
if value.is_a?(Array)
|
223
|
+
value.compact.map { |v| _to_hash(v) }
|
224
|
+
elsif value.is_a?(Hash)
|
225
|
+
{}.tap do |hash|
|
226
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
227
|
+
end
|
228
|
+
elsif value.respond_to? :to_hash
|
229
|
+
value.to_hash
|
230
|
+
else
|
231
|
+
value
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
end
|
236
|
+
|
237
|
+
end
|