aspose_cad_cloud 19.11

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.
Files changed (65) hide show
  1. checksums.yaml +7 -0
  2. data/lib/aspose_cad_cloud.rb +83 -0
  3. data/lib/aspose_cad_cloud/api/cad_api.rb +2138 -0
  4. data/lib/aspose_cad_cloud/api_client.rb +403 -0
  5. data/lib/aspose_cad_cloud/api_error.rb +54 -0
  6. data/lib/aspose_cad_cloud/configuration.rb +189 -0
  7. data/lib/aspose_cad_cloud/models/bmp_options_dto.rb +327 -0
  8. data/lib/aspose_cad_cloud/models/cad_rasterization_options_dto.rb +473 -0
  9. data/lib/aspose_cad_cloud/models/cad_response.rb +317 -0
  10. data/lib/aspose_cad_cloud/models/cff2_properties.rb +197 -0
  11. data/lib/aspose_cad_cloud/models/color.rb +312 -0
  12. data/lib/aspose_cad_cloud/models/dgn_properties.rb +197 -0
  13. data/lib/aspose_cad_cloud/models/drawing_options_base_dto.rb +281 -0
  14. data/lib/aspose_cad_cloud/models/dwf_properties.rb +197 -0
  15. data/lib/aspose_cad_cloud/models/dwg_properties.rb +197 -0
  16. data/lib/aspose_cad_cloud/models/dxf_properties.rb +197 -0
  17. data/lib/aspose_cad_cloud/models/gif_options_dto.rb +386 -0
  18. data/lib/aspose_cad_cloud/models/graphics_options.rb +311 -0
  19. data/lib/aspose_cad_cloud/models/ifc_properties.rb +197 -0
  20. data/lib/aspose_cad_cloud/models/igs_properties.rb +197 -0
  21. data/lib/aspose_cad_cloud/models/jpeg2000_options_dto.rb +322 -0
  22. data/lib/aspose_cad_cloud/models/jpeg_options_dto.rb +378 -0
  23. data/lib/aspose_cad_cloud/models/pdf_document_info.rb +237 -0
  24. data/lib/aspose_cad_cloud/models/pdf_document_options.rb +249 -0
  25. data/lib/aspose_cad_cloud/models/pdf_options_dto.rb +301 -0
  26. data/lib/aspose_cad_cloud/models/pen_options.rb +280 -0
  27. data/lib/aspose_cad_cloud/models/png_options_dto.rb +388 -0
  28. data/lib/aspose_cad_cloud/models/psd_options_dto.rb +388 -0
  29. data/lib/aspose_cad_cloud/models/rd_optimizer_settings.rb +302 -0
  30. data/lib/aspose_cad_cloud/models/requests/GetDrawingPropertiesRequest.rb +53 -0
  31. data/lib/aspose_cad_cloud/models/requests/GetDrawingResizeRequest.rb +69 -0
  32. data/lib/aspose_cad_cloud/models/requests/GetDrawingRotateFlipRequest.rb +65 -0
  33. data/lib/aspose_cad_cloud/models/requests/GetDrawingSaveAsRequest.rb +61 -0
  34. data/lib/aspose_cad_cloud/models/requests/PostDrawingBmpRequest.rb +61 -0
  35. data/lib/aspose_cad_cloud/models/requests/PostDrawingGifRequest.rb +61 -0
  36. data/lib/aspose_cad_cloud/models/requests/PostDrawingJpeg2000Request.rb +61 -0
  37. data/lib/aspose_cad_cloud/models/requests/PostDrawingJpegRequest.rb +61 -0
  38. data/lib/aspose_cad_cloud/models/requests/PostDrawingPdfRequest.rb +61 -0
  39. data/lib/aspose_cad_cloud/models/requests/PostDrawingPngRequest.rb +61 -0
  40. data/lib/aspose_cad_cloud/models/requests/PostDrawingPropertiesRequest.rb +45 -0
  41. data/lib/aspose_cad_cloud/models/requests/PostDrawingPsdRequest.rb +61 -0
  42. data/lib/aspose_cad_cloud/models/requests/PostDrawingResizeRequest.rb +65 -0
  43. data/lib/aspose_cad_cloud/models/requests/PostDrawingRotateFlipRequest.rb +61 -0
  44. data/lib/aspose_cad_cloud/models/requests/PostDrawingSaveAsRequest.rb +57 -0
  45. data/lib/aspose_cad_cloud/models/requests/PostDrawingSvgRequest.rb +61 -0
  46. data/lib/aspose_cad_cloud/models/requests/PostDrawingTiffRequest.rb +61 -0
  47. data/lib/aspose_cad_cloud/models/requests/PostDrawingWmfRequest.rb +61 -0
  48. data/lib/aspose_cad_cloud/models/requests/PutDrawingBmpRequest.rb +57 -0
  49. data/lib/aspose_cad_cloud/models/requests/PutDrawingGifRequest.rb +57 -0
  50. data/lib/aspose_cad_cloud/models/requests/PutDrawingJpeg2000Request.rb +57 -0
  51. data/lib/aspose_cad_cloud/models/requests/PutDrawingJpegRequest.rb +57 -0
  52. data/lib/aspose_cad_cloud/models/requests/PutDrawingPdfRequest.rb +57 -0
  53. data/lib/aspose_cad_cloud/models/requests/PutDrawingPngRequest.rb +57 -0
  54. data/lib/aspose_cad_cloud/models/requests/PutDrawingPsdRequest.rb +57 -0
  55. data/lib/aspose_cad_cloud/models/requests/PutDrawingSvgRequest.rb +57 -0
  56. data/lib/aspose_cad_cloud/models/requests/PutDrawingTiffRequest.rb +57 -0
  57. data/lib/aspose_cad_cloud/models/requests/PutDrawingWmfRequest.rb +57 -0
  58. data/lib/aspose_cad_cloud/models/resolution_setting.rb +227 -0
  59. data/lib/aspose_cad_cloud/models/stl_properties.rb +197 -0
  60. data/lib/aspose_cad_cloud/models/svg_options_dto.rb +327 -0
  61. data/lib/aspose_cad_cloud/models/tiff_options_dto.rb +417 -0
  62. data/lib/aspose_cad_cloud/models/vector_rasterization_options_dto.rb +363 -0
  63. data/lib/aspose_cad_cloud/models/wmf_options_dto.rb +296 -0
  64. data/lib/aspose_cad_cloud/version.rb +29 -0
  65. metadata +178 -0
@@ -0,0 +1,417 @@
1
+
2
+ require 'date'
3
+
4
+ module AsposeCadCloud
5
+ #
6
+ # --------------------------------------------------------------------------------------------------------------------
7
+ # <copyright company="Aspose" file="TiffOptionsDTO.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 TIFF format
33
+ class TiffOptionsDTO
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
+ # Bytes order (little/big-endian notation)
47
+ attr_accessor :byte_order
48
+
49
+ # Compression level
50
+ attr_accessor :compression
51
+
52
+ # Expected TIFF sub-format
53
+ attr_accessor :expected_format
54
+
55
+ # Bits per pixel
56
+ attr_accessor :bits_per_sample
57
+
58
+ # Photometric options
59
+ attr_accessor :photometric
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
+ :'byte_order' => :'ByteOrder',
91
+ :'compression' => :'Compression',
92
+ :'expected_format' => :'ExpectedFormat',
93
+ :'bits_per_sample' => :'BitsPerSample',
94
+ :'photometric' => :'Photometric'
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
+ :'byte_order' => :'String',
106
+ :'compression' => :'String',
107
+ :'expected_format' => :'String',
108
+ :'bits_per_sample' => :'Array<Integer>',
109
+ :'photometric' => :'String'
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?(:'ByteOrder')
140
+ self.byte_order = attributes[:'ByteOrder']
141
+ end
142
+
143
+ if attributes.key?(:'Compression')
144
+ self.compression = attributes[:'Compression']
145
+ end
146
+
147
+ if attributes.key?(:'ExpectedFormat')
148
+ self.expected_format = attributes[:'ExpectedFormat']
149
+ end
150
+
151
+ if attributes.key?(:'BitsPerSample')
152
+ if (value = attributes[:'BitsPerSample']).is_a?(Array)
153
+ self.bits_per_sample = value
154
+ end
155
+ end
156
+
157
+ if attributes.key?(:'Photometric')
158
+ self.photometric = attributes[:'Photometric']
159
+ end
160
+
161
+ end
162
+
163
+ # Show invalid properties with the reasons. Usually used together with valid?
164
+ # @return Array for valid properies with the reasons
165
+ def list_invalid_properties
166
+ invalid_properties = []
167
+ if @rotation.nil?
168
+ invalid_properties.push("invalid value for 'rotation', rotation cannot be nil.")
169
+ end
170
+
171
+ if @byte_order.nil?
172
+ invalid_properties.push("invalid value for 'byte_order', byte_order cannot be nil.")
173
+ end
174
+
175
+ if @compression.nil?
176
+ invalid_properties.push("invalid value for 'compression', compression cannot be nil.")
177
+ end
178
+
179
+ if @expected_format.nil?
180
+ invalid_properties.push("invalid value for 'expected_format', expected_format cannot be nil.")
181
+ end
182
+
183
+ if @photometric.nil?
184
+ invalid_properties.push("invalid value for 'photometric', photometric cannot be nil.")
185
+ end
186
+
187
+ return invalid_properties
188
+ end
189
+
190
+ # Check to see if the all the properties in the model are valid
191
+ # @return true if the model is valid
192
+ def valid?
193
+ return false if @rotation.nil?
194
+ rotation_validator = EnumAttributeValidator.new('String', ["RotateNoneFlipNone", "Rotate90FlipNone", "Rotate180FlipNone", "Rotate270FlipNone", "RotateNoneFlipX", "Rotate90FlipX", "Rotate180FlipX", "Rotate270FlipX", "RotateNoneFlipY", "Rotate90FlipY", "Rotate180FlipY", "Rotate270FlipY", "RotateNoneFlipXY", "Rotate90FlipXY", "Rotate180FlipXY", "Rotate270FlipXY"])
195
+ return false unless rotation_validator.valid?(@rotation)
196
+ return false if @byte_order.nil?
197
+ byte_order_validator = EnumAttributeValidator.new('String', ["LittleEndian", "BigEndian"])
198
+ return false unless byte_order_validator.valid?(@byte_order)
199
+ return false if @compression.nil?
200
+ compression_validator = EnumAttributeValidator.new('String', ["None", "CcittRle", "CcittFax3", "CcittFax4", "Lzw", "Ojpeg", "Jpeg", "AdobeDeflate", "Next", "CcittRleW", "Packbits", "Thunderscan", "It8Ctpad", "It8Lw", "It8Mp", "It8Bl", "PixarFilm", "PixarLog", "Deflate", "Dcs", "Jbig", "Sgilog", "Sgilog24", "Jp2000"])
201
+ return false unless compression_validator.valid?(@compression)
202
+ return false if @expected_format.nil?
203
+ expected_format_validator = EnumAttributeValidator.new('String', ["Default", "TiffLzwBw", "TiffLzwRgb", "TiffLzwRgba", "TiffLzwCmyk", "TiffCcittFax3", "TiffCcittFax4", "TiffDeflateBw", "TiffDeflateRgb", "TiffDeflateRgba", "TiffCcitRle", "TiffJpegRgb", "TiffJpegYCbCr", "TiffNoCompressionBw", "TiffNoCompressionRgb", "TiffNoCompressionRgba"])
204
+ return false unless expected_format_validator.valid?(@expected_format)
205
+ return false if @photometric.nil?
206
+ photometric_validator = EnumAttributeValidator.new('String', ["MinIsWhite", "MinIsBlack", "Rgb", "Palette", "Mask", "Separated", "Ycbcr", "Cielab", "Icclab", "Itulab", "Logl", "Logluv"])
207
+ return false unless photometric_validator.valid?(@photometric)
208
+ return true
209
+ end
210
+
211
+ # Custom attribute writer method checking allowed values (enum).
212
+ # @param [Object] rotation Object to be assigned
213
+ def rotation=(rotation)
214
+ validator = EnumAttributeValidator.new('String', ["RotateNoneFlipNone", "Rotate90FlipNone", "Rotate180FlipNone", "Rotate270FlipNone", "RotateNoneFlipX", "Rotate90FlipX", "Rotate180FlipX", "Rotate270FlipX", "RotateNoneFlipY", "Rotate90FlipY", "Rotate180FlipY", "Rotate270FlipY", "RotateNoneFlipXY", "Rotate90FlipXY", "Rotate180FlipXY", "Rotate270FlipXY"])
215
+ if rotation.to_i == 0
216
+ unless validator.valid?(rotation)
217
+ raise ArgumentError, "invalid value for 'rotation', must be one of #{validator.allowable_values}."
218
+ end
219
+ @rotation = rotation
220
+ else
221
+ @rotation = validator.allowable_values[rotation.to_i]
222
+ end
223
+ end
224
+
225
+ # Custom attribute writer method checking allowed values (enum).
226
+ # @param [Object] byte_order Object to be assigned
227
+ def byte_order=(byte_order)
228
+ validator = EnumAttributeValidator.new('String', ["LittleEndian", "BigEndian"])
229
+ if byte_order.to_i == 0
230
+ unless validator.valid?(byte_order)
231
+ raise ArgumentError, "invalid value for 'byte_order', must be one of #{validator.allowable_values}."
232
+ end
233
+ @byte_order = byte_order
234
+ else
235
+ @byte_order = validator.allowable_values[byte_order.to_i]
236
+ end
237
+ end
238
+
239
+ # Custom attribute writer method checking allowed values (enum).
240
+ # @param [Object] compression Object to be assigned
241
+ def compression=(compression)
242
+ validator = EnumAttributeValidator.new('String', ["None", "CcittRle", "CcittFax3", "CcittFax4", "Lzw", "Ojpeg", "Jpeg", "AdobeDeflate", "Next", "CcittRleW", "Packbits", "Thunderscan", "It8Ctpad", "It8Lw", "It8Mp", "It8Bl", "PixarFilm", "PixarLog", "Deflate", "Dcs", "Jbig", "Sgilog", "Sgilog24", "Jp2000"])
243
+ if compression.to_i == 0
244
+ unless validator.valid?(compression)
245
+ raise ArgumentError, "invalid value for 'compression', must be one of #{validator.allowable_values}."
246
+ end
247
+ @compression = compression
248
+ else
249
+ @compression = validator.allowable_values[compression.to_i]
250
+ end
251
+ end
252
+
253
+ # Custom attribute writer method checking allowed values (enum).
254
+ # @param [Object] expected_format Object to be assigned
255
+ def expected_format=(expected_format)
256
+ validator = EnumAttributeValidator.new('String', ["Default", "TiffLzwBw", "TiffLzwRgb", "TiffLzwRgba", "TiffLzwCmyk", "TiffCcittFax3", "TiffCcittFax4", "TiffDeflateBw", "TiffDeflateRgb", "TiffDeflateRgba", "TiffCcitRle", "TiffJpegRgb", "TiffJpegYCbCr", "TiffNoCompressionBw", "TiffNoCompressionRgb", "TiffNoCompressionRgba"])
257
+ if expected_format.to_i == 0
258
+ unless validator.valid?(expected_format)
259
+ raise ArgumentError, "invalid value for 'expected_format', must be one of #{validator.allowable_values}."
260
+ end
261
+ @expected_format = expected_format
262
+ else
263
+ @expected_format = validator.allowable_values[expected_format.to_i]
264
+ end
265
+ end
266
+
267
+ # Custom attribute writer method checking allowed values (enum).
268
+ # @param [Object] photometric Object to be assigned
269
+ def photometric=(photometric)
270
+ validator = EnumAttributeValidator.new('String', ["MinIsWhite", "MinIsBlack", "Rgb", "Palette", "Mask", "Separated", "Ycbcr", "Cielab", "Icclab", "Itulab", "Logl", "Logluv"])
271
+ if photometric.to_i == 0
272
+ unless validator.valid?(photometric)
273
+ raise ArgumentError, "invalid value for 'photometric', must be one of #{validator.allowable_values}."
274
+ end
275
+ @photometric = photometric
276
+ else
277
+ @photometric = validator.allowable_values[photometric.to_i]
278
+ end
279
+ end
280
+
281
+ # Checks equality by comparing each attribute.
282
+ # @param [Object] Object to be compared
283
+ def ==(other)
284
+ return true if self.equal?(other)
285
+ self.class == other.class &&
286
+ rotation == other.rotation &&
287
+ layers == other.layers &&
288
+ resolution_settings == other.resolution_settings &&
289
+ vector_rasterization_options == other.vector_rasterization_options &&
290
+ byte_order == other.byte_order &&
291
+ compression == other.compression &&
292
+ expected_format == other.expected_format &&
293
+ bits_per_sample == other.bits_per_sample &&
294
+ photometric == other.photometric
295
+ end
296
+
297
+ # @see the `==` method
298
+ # @param [Object] Object to be compared
299
+ def eql?(other)
300
+ self == other
301
+ end
302
+
303
+ # Calculates hash code according to all attributes.
304
+ # @return [Fixnum] Hash code
305
+ def hash
306
+ [rotation, layers, resolution_settings, vector_rasterization_options, byte_order, compression, expected_format, bits_per_sample, photometric].hash
307
+ end
308
+
309
+ # Builds the object from hash
310
+ # @param [Hash] attributes Model attributes in the form of hash
311
+ # @return [Object] Returns the model itself
312
+ def build_from_hash(attributes)
313
+ return nil unless attributes.is_a?(Hash)
314
+ self.class.swagger_types.each_pair do |key, type|
315
+ if type =~ /\AArray<(.*)>/i
316
+ # check to ensure the input is an array given that the the attribute
317
+ # is documented as an array but the input is not
318
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
319
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
320
+ end
321
+ elsif !attributes[self.class.attribute_map[key]].nil?
322
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
323
+ end
324
+ # or else data not found in attributes(hash), not an issue as the data can be optional
325
+ end
326
+
327
+ self
328
+ end
329
+
330
+ # Deserializes the data based on type
331
+ # @param string type Data type
332
+ # @param string value Value to be deserialized
333
+ # @return [Object] Deserialized data
334
+ def _deserialize(type, value)
335
+ case type.to_sym
336
+ when :DateTime
337
+ Time.at(/\d/.match(value)[0].to_f).to_datetime
338
+ when :Date
339
+ Time.at(/\d/.match(value)[0].to_f).to_date
340
+ when :String
341
+ value.to_s
342
+ when :Integer
343
+ value.to_i
344
+ when :Float
345
+ value.to_f
346
+ when :BOOLEAN
347
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
348
+ true
349
+ else
350
+ false
351
+ end
352
+ when :Object
353
+ # generic object (usually a Hash), return directly
354
+ value
355
+ when /\AArray<(?<inner_type>.+)>\z/
356
+ inner_type = Regexp.last_match[:inner_type]
357
+ value.map { |v| _deserialize(inner_type, v) }
358
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
359
+ k_type = Regexp.last_match[:k_type]
360
+ v_type = Regexp.last_match[:v_type]
361
+ {}.tap do |hash|
362
+ value.each do |k, v|
363
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
364
+ end
365
+ end
366
+ else
367
+ # model
368
+ temp_model = AsposeCadCloud.const_get(type).new
369
+ temp_model.build_from_hash(value)
370
+ end
371
+ end
372
+
373
+ # Returns the string representation of the object
374
+ # @return [String] String presentation of the object
375
+ def to_s
376
+ to_hash.to_s
377
+ end
378
+
379
+ # to_body is an alias to to_hash (backward compatibility)
380
+ # @return [Hash] Returns the object in the form of hash
381
+ def to_body
382
+ to_hash
383
+ end
384
+
385
+ # Returns the object in the form of hash
386
+ # @return [Hash] Returns the object in the form of hash
387
+ def to_hash
388
+ hash = {}
389
+ self.class.attribute_map.each_pair do |attr, param|
390
+ value = self.send(attr)
391
+ next if value.nil?
392
+ hash[param] = _to_hash(value)
393
+ end
394
+ hash
395
+ end
396
+
397
+ # Outputs non-array value in the form of hash
398
+ # For object, use to_hash. Otherwise, just return the value
399
+ # @param [Object] value Any valid value
400
+ # @return [Hash] Returns the value in the form of hash
401
+ def _to_hash(value)
402
+ if value.is_a?(Array)
403
+ value.compact.map { |v| _to_hash(v) }
404
+ elsif value.is_a?(Hash)
405
+ {}.tap do |hash|
406
+ value.each { |k, v| hash[k] = _to_hash(v) }
407
+ end
408
+ elsif value.respond_to? :to_hash
409
+ value.to_hash
410
+ else
411
+ value
412
+ end
413
+ end
414
+
415
+ end
416
+
417
+ end
@@ -0,0 +1,363 @@
1
+
2
+ require 'date'
3
+
4
+ module AsposeCadCloud
5
+ #
6
+ # --------------------------------------------------------------------------------------------------------------------
7
+ # <copyright company="Aspose" file="VectorRasterizationOptionsDTO.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
+ # Base raster export options class
33
+ class VectorRasterizationOptionsDTO
34
+ # Gets or sets the border X.
35
+ attr_accessor :border_x
36
+
37
+ # Gets or sets the border Y.
38
+ attr_accessor :border_y
39
+
40
+ # Gets or sets the page height.
41
+ attr_accessor :page_height
42
+
43
+ # Gets or sets the page width.
44
+ attr_accessor :page_width
45
+
46
+ # Gets or sets a background color.
47
+ attr_accessor :background_color
48
+
49
+ # Gets or sets a foreground color.
50
+ attr_accessor :draw_color
51
+
52
+ attr_accessor :unit_type
53
+
54
+ # Gets or sets a value indicating whether content of a drawing is represented as image inside Pdf. Applicable only for CAD to Pdf export. Default is false.
55
+ attr_accessor :content_as_bitmap
56
+
57
+ # Gets or sets options to render bitmap inside pdf (if ContentAsBitmap is set to true).
58
+ attr_accessor :graphics_options
59
+
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
+ :'border_x' => :'BorderX',
86
+ :'border_y' => :'BorderY',
87
+ :'page_height' => :'PageHeight',
88
+ :'page_width' => :'PageWidth',
89
+ :'background_color' => :'BackgroundColor',
90
+ :'draw_color' => :'DrawColor',
91
+ :'unit_type' => :'UnitType',
92
+ :'content_as_bitmap' => :'ContentAsBitmap',
93
+ :'graphics_options' => :'GraphicsOptions'
94
+ }
95
+ end
96
+
97
+ # Attribute type mapping.
98
+ def self.swagger_types
99
+ {
100
+ :'border_x' => :'Float',
101
+ :'border_y' => :'Float',
102
+ :'page_height' => :'Float',
103
+ :'page_width' => :'Float',
104
+ :'background_color' => :'Color',
105
+ :'draw_color' => :'Color',
106
+ :'unit_type' => :'String',
107
+ :'content_as_bitmap' => :'BOOLEAN',
108
+ :'graphics_options' => :'GraphicsOptions'
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?(:'BorderX')
121
+ self.border_x = attributes[:'BorderX']
122
+ end
123
+
124
+ if attributes.key?(:'BorderY')
125
+ self.border_y = attributes[:'BorderY']
126
+ end
127
+
128
+ if attributes.key?(:'PageHeight')
129
+ self.page_height = attributes[:'PageHeight']
130
+ end
131
+
132
+ if attributes.key?(:'PageWidth')
133
+ self.page_width = attributes[:'PageWidth']
134
+ end
135
+
136
+ if attributes.key?(:'BackgroundColor')
137
+ self.background_color = attributes[:'BackgroundColor']
138
+ end
139
+
140
+ if attributes.key?(:'DrawColor')
141
+ self.draw_color = attributes[:'DrawColor']
142
+ end
143
+
144
+ if attributes.key?(:'UnitType')
145
+ self.unit_type = attributes[:'UnitType']
146
+ end
147
+
148
+ if attributes.key?(:'ContentAsBitmap')
149
+ self.content_as_bitmap = attributes[:'ContentAsBitmap']
150
+ end
151
+
152
+ if attributes.key?(:'GraphicsOptions')
153
+ self.graphics_options = attributes[:'GraphicsOptions']
154
+ end
155
+
156
+ end
157
+
158
+ # Show invalid properties with the reasons. Usually used together with valid?
159
+ # @return Array for valid properies with the reasons
160
+ def list_invalid_properties
161
+ invalid_properties = []
162
+ if @border_x.nil?
163
+ invalid_properties.push("invalid value for 'border_x', border_x cannot be nil.")
164
+ end
165
+
166
+ if @border_y.nil?
167
+ invalid_properties.push("invalid value for 'border_y', border_y cannot be nil.")
168
+ end
169
+
170
+ if @page_height.nil?
171
+ invalid_properties.push("invalid value for 'page_height', page_height cannot be nil.")
172
+ end
173
+
174
+ if @page_width.nil?
175
+ invalid_properties.push("invalid value for 'page_width', page_width cannot be nil.")
176
+ end
177
+
178
+ if @background_color.nil?
179
+ invalid_properties.push("invalid value for 'background_color', background_color cannot be nil.")
180
+ end
181
+
182
+ if @draw_color.nil?
183
+ invalid_properties.push("invalid value for 'draw_color', draw_color cannot be nil.")
184
+ end
185
+
186
+ if @unit_type.nil?
187
+ invalid_properties.push("invalid value for 'unit_type', unit_type cannot be nil.")
188
+ end
189
+
190
+ if @content_as_bitmap.nil?
191
+ invalid_properties.push("invalid value for 'content_as_bitmap', content_as_bitmap cannot be nil.")
192
+ end
193
+
194
+ return invalid_properties
195
+ end
196
+
197
+ # Check to see if the all the properties in the model are valid
198
+ # @return true if the model is valid
199
+ def valid?
200
+ return false if @border_x.nil?
201
+ return false if @border_y.nil?
202
+ return false if @page_height.nil?
203
+ return false if @page_width.nil?
204
+ return false if @background_color.nil?
205
+ return false if @draw_color.nil?
206
+ return false if @unit_type.nil?
207
+ unit_type_validator = EnumAttributeValidator.new('String', ["Kilometer", "Meter", "Centimenter", "Millimeter", "Micrometer", "Nanometer", "Angstrom", "Decimeter", "Decameter", "Hectometer", "Gigameter", "AstronomicalUnit", "LightYear", "Parsec", "Mile", "Yard", "Foot", "Inch", "Mil", "MicroInch", "Custom", "Unitless"])
208
+ return false unless unit_type_validator.valid?(@unit_type)
209
+ return false if @content_as_bitmap.nil?
210
+ return true
211
+ end
212
+
213
+ # Custom attribute writer method checking allowed values (enum).
214
+ # @param [Object] unit_type Object to be assigned
215
+ def unit_type=(unit_type)
216
+ validator = EnumAttributeValidator.new('String', ["Kilometer", "Meter", "Centimenter", "Millimeter", "Micrometer", "Nanometer", "Angstrom", "Decimeter", "Decameter", "Hectometer", "Gigameter", "AstronomicalUnit", "LightYear", "Parsec", "Mile", "Yard", "Foot", "Inch", "Mil", "MicroInch", "Custom", "Unitless"])
217
+ if unit_type.to_i == 0
218
+ unless validator.valid?(unit_type)
219
+ raise ArgumentError, "invalid value for 'unit_type', must be one of #{validator.allowable_values}."
220
+ end
221
+ @unit_type = unit_type
222
+ else
223
+ @unit_type = validator.allowable_values[unit_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
+ border_x == other.border_x &&
233
+ border_y == other.border_y &&
234
+ page_height == other.page_height &&
235
+ page_width == other.page_width &&
236
+ background_color == other.background_color &&
237
+ draw_color == other.draw_color &&
238
+ unit_type == other.unit_type &&
239
+ content_as_bitmap == other.content_as_bitmap &&
240
+ graphics_options == other.graphics_options
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
+ [border_x, border_y, page_height, page_width, background_color, draw_color, unit_type, content_as_bitmap, graphics_options].hash
253
+ end
254
+
255
+ # Builds the object from hash
256
+ # @param [Hash] attributes Model attributes in the form of hash
257
+ # @return [Object] Returns the model itself
258
+ def build_from_hash(attributes)
259
+ return nil unless attributes.is_a?(Hash)
260
+ self.class.swagger_types.each_pair do |key, type|
261
+ if type =~ /\AArray<(.*)>/i
262
+ # check to ensure the input is an array given that the the attribute
263
+ # is documented as an array but the input is not
264
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
265
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
266
+ end
267
+ elsif !attributes[self.class.attribute_map[key]].nil?
268
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
269
+ end
270
+ # or else data not found in attributes(hash), not an issue as the data can be optional
271
+ end
272
+
273
+ self
274
+ end
275
+
276
+ # Deserializes the data based on type
277
+ # @param string type Data type
278
+ # @param string value Value to be deserialized
279
+ # @return [Object] Deserialized data
280
+ def _deserialize(type, value)
281
+ case type.to_sym
282
+ when :DateTime
283
+ Time.at(/\d/.match(value)[0].to_f).to_datetime
284
+ when :Date
285
+ Time.at(/\d/.match(value)[0].to_f).to_date
286
+ when :String
287
+ value.to_s
288
+ when :Integer
289
+ value.to_i
290
+ when :Float
291
+ value.to_f
292
+ when :BOOLEAN
293
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
294
+ true
295
+ else
296
+ false
297
+ end
298
+ when :Object
299
+ # generic object (usually a Hash), return directly
300
+ value
301
+ when /\AArray<(?<inner_type>.+)>\z/
302
+ inner_type = Regexp.last_match[:inner_type]
303
+ value.map { |v| _deserialize(inner_type, v) }
304
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
305
+ k_type = Regexp.last_match[:k_type]
306
+ v_type = Regexp.last_match[:v_type]
307
+ {}.tap do |hash|
308
+ value.each do |k, v|
309
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
310
+ end
311
+ end
312
+ else
313
+ # model
314
+ temp_model = AsposeCadCloud.const_get(type).new
315
+ temp_model.build_from_hash(value)
316
+ end
317
+ end
318
+
319
+ # Returns the string representation of the object
320
+ # @return [String] String presentation of the object
321
+ def to_s
322
+ to_hash.to_s
323
+ end
324
+
325
+ # to_body is an alias to to_hash (backward compatibility)
326
+ # @return [Hash] Returns the object in the form of hash
327
+ def to_body
328
+ to_hash
329
+ end
330
+
331
+ # Returns the object in the form of hash
332
+ # @return [Hash] Returns the object in the form of hash
333
+ def to_hash
334
+ hash = {}
335
+ self.class.attribute_map.each_pair do |attr, param|
336
+ value = self.send(attr)
337
+ next if value.nil?
338
+ hash[param] = _to_hash(value)
339
+ end
340
+ hash
341
+ end
342
+
343
+ # Outputs non-array value in the form of hash
344
+ # For object, use to_hash. Otherwise, just return the value
345
+ # @param [Object] value Any valid value
346
+ # @return [Hash] Returns the value in the form of hash
347
+ def _to_hash(value)
348
+ if value.is_a?(Array)
349
+ value.compact.map { |v| _to_hash(v) }
350
+ elsif value.is_a?(Hash)
351
+ {}.tap do |hash|
352
+ value.each { |k, v| hash[k] = _to_hash(v) }
353
+ end
354
+ elsif value.respond_to? :to_hash
355
+ value.to_hash
356
+ else
357
+ value
358
+ end
359
+ end
360
+
361
+ end
362
+
363
+ end