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,388 @@
1
+
2
+ require 'date'
3
+
4
+ module AsposeCadCloud
5
+ #
6
+ # --------------------------------------------------------------------------------------------------------------------
7
+ # <copyright company="Aspose" file="PsdOptionsDTO.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 PSD format
33
+ class PsdOptionsDTO
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
+ # PSD format version
47
+ attr_accessor :version
48
+
49
+ # Compression method
50
+ attr_accessor :compression_method
51
+
52
+ # Color mode
53
+ attr_accessor :color_mode
54
+
55
+ # Bits count per channel
56
+ attr_accessor :channel_bits_count
57
+
58
+ # Channels count
59
+ attr_accessor :channels_count
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
+ :'version' => :'Version',
91
+ :'compression_method' => :'CompressionMethod',
92
+ :'color_mode' => :'ColorMode',
93
+ :'channel_bits_count' => :'ChannelBitsCount',
94
+ :'channels_count' => :'ChannelsCount'
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
+ :'version' => :'Integer',
106
+ :'compression_method' => :'String',
107
+ :'color_mode' => :'String',
108
+ :'channel_bits_count' => :'Integer',
109
+ :'channels_count' => :'Integer'
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?(:'Version')
140
+ self.version = attributes[:'Version']
141
+ end
142
+
143
+ if attributes.key?(:'CompressionMethod')
144
+ self.compression_method = attributes[:'CompressionMethod']
145
+ end
146
+
147
+ if attributes.key?(:'ColorMode')
148
+ self.color_mode = attributes[:'ColorMode']
149
+ end
150
+
151
+ if attributes.key?(:'ChannelBitsCount')
152
+ self.channel_bits_count = attributes[:'ChannelBitsCount']
153
+ end
154
+
155
+ if attributes.key?(:'ChannelsCount')
156
+ self.channels_count = attributes[:'ChannelsCount']
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 @version.nil?
170
+ invalid_properties.push("invalid value for 'version', version cannot be nil.")
171
+ end
172
+
173
+ if @compression_method.nil?
174
+ invalid_properties.push("invalid value for 'compression_method', compression_method cannot be nil.")
175
+ end
176
+
177
+ if @color_mode.nil?
178
+ invalid_properties.push("invalid value for 'color_mode', color_mode cannot be nil.")
179
+ end
180
+
181
+ if @channel_bits_count.nil?
182
+ invalid_properties.push("invalid value for 'channel_bits_count', channel_bits_count cannot be nil.")
183
+ end
184
+
185
+ if @channels_count.nil?
186
+ invalid_properties.push("invalid value for 'channels_count', channels_count cannot be nil.")
187
+ end
188
+
189
+ return invalid_properties
190
+ end
191
+
192
+ # Check to see if the all the properties in the model are valid
193
+ # @return true if the model is valid
194
+ def valid?
195
+ return false if @rotation.nil?
196
+ rotation_validator = EnumAttributeValidator.new('String', ["RotateNoneFlipNone", "Rotate90FlipNone", "Rotate180FlipNone", "Rotate270FlipNone", "RotateNoneFlipX", "Rotate90FlipX", "Rotate180FlipX", "Rotate270FlipX", "RotateNoneFlipY", "Rotate90FlipY", "Rotate180FlipY", "Rotate270FlipY", "RotateNoneFlipXY", "Rotate90FlipXY", "Rotate180FlipXY", "Rotate270FlipXY"])
197
+ return false unless rotation_validator.valid?(@rotation)
198
+ return false if @version.nil?
199
+ return false if @compression_method.nil?
200
+ compression_method_validator = EnumAttributeValidator.new('String', ["Raw", "RLE", "ZipWithoutPrediction", "ZipWithPrediction"])
201
+ return false unless compression_method_validator.valid?(@compression_method)
202
+ return false if @color_mode.nil?
203
+ color_mode_validator = EnumAttributeValidator.new('String', ["Bitmap", "Grayscale", "Indexed", "Rgb", "Cmyk", "Multichannel", "Duotone", "Lab"])
204
+ return false unless color_mode_validator.valid?(@color_mode)
205
+ return false if @channel_bits_count.nil?
206
+ return false if @channels_count.nil?
207
+ return true
208
+ end
209
+
210
+ # Custom attribute writer method checking allowed values (enum).
211
+ # @param [Object] rotation Object to be assigned
212
+ def rotation=(rotation)
213
+ validator = EnumAttributeValidator.new('String', ["RotateNoneFlipNone", "Rotate90FlipNone", "Rotate180FlipNone", "Rotate270FlipNone", "RotateNoneFlipX", "Rotate90FlipX", "Rotate180FlipX", "Rotate270FlipX", "RotateNoneFlipY", "Rotate90FlipY", "Rotate180FlipY", "Rotate270FlipY", "RotateNoneFlipXY", "Rotate90FlipXY", "Rotate180FlipXY", "Rotate270FlipXY"])
214
+ if rotation.to_i == 0
215
+ unless validator.valid?(rotation)
216
+ raise ArgumentError, "invalid value for 'rotation', must be one of #{validator.allowable_values}."
217
+ end
218
+ @rotation = rotation
219
+ else
220
+ @rotation = validator.allowable_values[rotation.to_i]
221
+ end
222
+ end
223
+
224
+ # Custom attribute writer method checking allowed values (enum).
225
+ # @param [Object] compression_method Object to be assigned
226
+ def compression_method=(compression_method)
227
+ validator = EnumAttributeValidator.new('String', ["Raw", "RLE", "ZipWithoutPrediction", "ZipWithPrediction"])
228
+ if compression_method.to_i == 0
229
+ unless validator.valid?(compression_method)
230
+ raise ArgumentError, "invalid value for 'compression_method', must be one of #{validator.allowable_values}."
231
+ end
232
+ @compression_method = compression_method
233
+ else
234
+ @compression_method = validator.allowable_values[compression_method.to_i]
235
+ end
236
+ end
237
+
238
+ # Custom attribute writer method checking allowed values (enum).
239
+ # @param [Object] color_mode Object to be assigned
240
+ def color_mode=(color_mode)
241
+ validator = EnumAttributeValidator.new('String', ["Bitmap", "Grayscale", "Indexed", "Rgb", "Cmyk", "Multichannel", "Duotone", "Lab"])
242
+ if color_mode.to_i == 0
243
+ unless validator.valid?(color_mode)
244
+ raise ArgumentError, "invalid value for 'color_mode', must be one of #{validator.allowable_values}."
245
+ end
246
+ @color_mode = color_mode
247
+ else
248
+ @color_mode = validator.allowable_values[color_mode.to_i]
249
+ end
250
+ end
251
+
252
+ # Checks equality by comparing each attribute.
253
+ # @param [Object] Object to be compared
254
+ def ==(other)
255
+ return true if self.equal?(other)
256
+ self.class == other.class &&
257
+ rotation == other.rotation &&
258
+ layers == other.layers &&
259
+ resolution_settings == other.resolution_settings &&
260
+ vector_rasterization_options == other.vector_rasterization_options &&
261
+ version == other.version &&
262
+ compression_method == other.compression_method &&
263
+ color_mode == other.color_mode &&
264
+ channel_bits_count == other.channel_bits_count &&
265
+ channels_count == other.channels_count
266
+ end
267
+
268
+ # @see the `==` method
269
+ # @param [Object] Object to be compared
270
+ def eql?(other)
271
+ self == other
272
+ end
273
+
274
+ # Calculates hash code according to all attributes.
275
+ # @return [Fixnum] Hash code
276
+ def hash
277
+ [rotation, layers, resolution_settings, vector_rasterization_options, version, compression_method, color_mode, channel_bits_count, channels_count].hash
278
+ end
279
+
280
+ # Builds the object from hash
281
+ # @param [Hash] attributes Model attributes in the form of hash
282
+ # @return [Object] Returns the model itself
283
+ def build_from_hash(attributes)
284
+ return nil unless attributes.is_a?(Hash)
285
+ self.class.swagger_types.each_pair do |key, type|
286
+ if type =~ /\AArray<(.*)>/i
287
+ # check to ensure the input is an array given that the the attribute
288
+ # is documented as an array but the input is not
289
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
290
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
291
+ end
292
+ elsif !attributes[self.class.attribute_map[key]].nil?
293
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
294
+ end
295
+ # or else data not found in attributes(hash), not an issue as the data can be optional
296
+ end
297
+
298
+ self
299
+ end
300
+
301
+ # Deserializes the data based on type
302
+ # @param string type Data type
303
+ # @param string value Value to be deserialized
304
+ # @return [Object] Deserialized data
305
+ def _deserialize(type, value)
306
+ case type.to_sym
307
+ when :DateTime
308
+ Time.at(/\d/.match(value)[0].to_f).to_datetime
309
+ when :Date
310
+ Time.at(/\d/.match(value)[0].to_f).to_date
311
+ when :String
312
+ value.to_s
313
+ when :Integer
314
+ value.to_i
315
+ when :Float
316
+ value.to_f
317
+ when :BOOLEAN
318
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
319
+ true
320
+ else
321
+ false
322
+ end
323
+ when :Object
324
+ # generic object (usually a Hash), return directly
325
+ value
326
+ when /\AArray<(?<inner_type>.+)>\z/
327
+ inner_type = Regexp.last_match[:inner_type]
328
+ value.map { |v| _deserialize(inner_type, v) }
329
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
330
+ k_type = Regexp.last_match[:k_type]
331
+ v_type = Regexp.last_match[:v_type]
332
+ {}.tap do |hash|
333
+ value.each do |k, v|
334
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
335
+ end
336
+ end
337
+ else
338
+ # model
339
+ temp_model = AsposeCadCloud.const_get(type).new
340
+ temp_model.build_from_hash(value)
341
+ end
342
+ end
343
+
344
+ # Returns the string representation of the object
345
+ # @return [String] String presentation of the object
346
+ def to_s
347
+ to_hash.to_s
348
+ end
349
+
350
+ # to_body is an alias to to_hash (backward compatibility)
351
+ # @return [Hash] Returns the object in the form of hash
352
+ def to_body
353
+ to_hash
354
+ end
355
+
356
+ # Returns the object in the form of hash
357
+ # @return [Hash] Returns the object in the form of hash
358
+ def to_hash
359
+ hash = {}
360
+ self.class.attribute_map.each_pair do |attr, param|
361
+ value = self.send(attr)
362
+ next if value.nil?
363
+ hash[param] = _to_hash(value)
364
+ end
365
+ hash
366
+ end
367
+
368
+ # Outputs non-array value in the form of hash
369
+ # For object, use to_hash. Otherwise, just return the value
370
+ # @param [Object] value Any valid value
371
+ # @return [Hash] Returns the value in the form of hash
372
+ def _to_hash(value)
373
+ if value.is_a?(Array)
374
+ value.compact.map { |v| _to_hash(v) }
375
+ elsif value.is_a?(Hash)
376
+ {}.tap do |hash|
377
+ value.each { |k, v| hash[k] = _to_hash(v) }
378
+ end
379
+ elsif value.respond_to? :to_hash
380
+ value.to_hash
381
+ else
382
+ value
383
+ end
384
+ end
385
+
386
+ end
387
+
388
+ end
@@ -0,0 +1,302 @@
1
+
2
+ require 'date'
3
+
4
+ module AsposeCadCloud
5
+ #
6
+ # --------------------------------------------------------------------------------------------------------------------
7
+ # <copyright company="Aspose" file="RdOptimizerSettings.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
+ # RD optimizer settings class
33
+ class RdOptimizerSettings
34
+ # Gets or sets the BPP (bits per pixel) scale factor.
35
+ attr_accessor :bpp_scale
36
+
37
+ # Gets or sets the maximum R value for consideration in in bits per pixel
38
+ attr_accessor :bpp_max
39
+
40
+ # Gets or sets the maximum quantization value.
41
+ attr_accessor :max_q
42
+
43
+ # Gets the minimum allowed quantization value.
44
+ attr_accessor :min_q
45
+
46
+ # Gets the maximum pixel value.
47
+ attr_accessor :max_pixel_value
48
+
49
+ # Gets the PSNR maximum expected value.
50
+ attr_accessor :psnr_max
51
+
52
+ # Gets the maximum R value for consideration.
53
+ attr_accessor :discretized_bpp_max
54
+
55
+
56
+ # Attribute mapping from ruby-style variable name to JSON key.
57
+ def self.attribute_map
58
+ {
59
+ :'bpp_scale' => :'BppScale',
60
+ :'bpp_max' => :'BppMax',
61
+ :'max_q' => :'MaxQ',
62
+ :'min_q' => :'MinQ',
63
+ :'max_pixel_value' => :'MaxPixelValue',
64
+ :'psnr_max' => :'PsnrMax',
65
+ :'discretized_bpp_max' => :'DiscretizedBppMax'
66
+ }
67
+ end
68
+
69
+ # Attribute type mapping.
70
+ def self.swagger_types
71
+ {
72
+ :'bpp_scale' => :'Integer',
73
+ :'bpp_max' => :'Float',
74
+ :'max_q' => :'Integer',
75
+ :'min_q' => :'Integer',
76
+ :'max_pixel_value' => :'Integer',
77
+ :'psnr_max' => :'Integer',
78
+ :'discretized_bpp_max' => :'Integer'
79
+ }
80
+ end
81
+
82
+ # Initializes the object
83
+ # @param [Hash] attributes Model attributes in the form of hash
84
+ def initialize(attributes = {})
85
+ return unless attributes.is_a?(Hash)
86
+
87
+ # convert string to symbol for hash key
88
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
89
+
90
+ if attributes.key?(:'BppScale')
91
+ self.bpp_scale = attributes[:'BppScale']
92
+ end
93
+
94
+ if attributes.key?(:'BppMax')
95
+ self.bpp_max = attributes[:'BppMax']
96
+ end
97
+
98
+ if attributes.key?(:'MaxQ')
99
+ self.max_q = attributes[:'MaxQ']
100
+ end
101
+
102
+ if attributes.key?(:'MinQ')
103
+ self.min_q = attributes[:'MinQ']
104
+ end
105
+
106
+ if attributes.key?(:'MaxPixelValue')
107
+ self.max_pixel_value = attributes[:'MaxPixelValue']
108
+ end
109
+
110
+ if attributes.key?(:'PsnrMax')
111
+ self.psnr_max = attributes[:'PsnrMax']
112
+ end
113
+
114
+ if attributes.key?(:'DiscretizedBppMax')
115
+ self.discretized_bpp_max = attributes[:'DiscretizedBppMax']
116
+ end
117
+
118
+ end
119
+
120
+ # Show invalid properties with the reasons. Usually used together with valid?
121
+ # @return Array for valid properies with the reasons
122
+ def list_invalid_properties
123
+ invalid_properties = []
124
+ if @bpp_scale.nil?
125
+ invalid_properties.push("invalid value for 'bpp_scale', bpp_scale cannot be nil.")
126
+ end
127
+
128
+ if @bpp_max.nil?
129
+ invalid_properties.push("invalid value for 'bpp_max', bpp_max cannot be nil.")
130
+ end
131
+
132
+ if @max_q.nil?
133
+ invalid_properties.push("invalid value for 'max_q', max_q cannot be nil.")
134
+ end
135
+
136
+ if @min_q.nil?
137
+ invalid_properties.push("invalid value for 'min_q', min_q cannot be nil.")
138
+ end
139
+
140
+ if @max_pixel_value.nil?
141
+ invalid_properties.push("invalid value for 'max_pixel_value', max_pixel_value cannot be nil.")
142
+ end
143
+
144
+ if @psnr_max.nil?
145
+ invalid_properties.push("invalid value for 'psnr_max', psnr_max cannot be nil.")
146
+ end
147
+
148
+ if @discretized_bpp_max.nil?
149
+ invalid_properties.push("invalid value for 'discretized_bpp_max', discretized_bpp_max cannot be nil.")
150
+ end
151
+
152
+ return invalid_properties
153
+ end
154
+
155
+ # Check to see if the all the properties in the model are valid
156
+ # @return true if the model is valid
157
+ def valid?
158
+ return false if @bpp_scale.nil?
159
+ return false if @bpp_max.nil?
160
+ return false if @max_q.nil?
161
+ return false if @min_q.nil?
162
+ return false if @max_pixel_value.nil?
163
+ return false if @psnr_max.nil?
164
+ return false if @discretized_bpp_max.nil?
165
+ return true
166
+ end
167
+
168
+ # Checks equality by comparing each attribute.
169
+ # @param [Object] Object to be compared
170
+ def ==(other)
171
+ return true if self.equal?(other)
172
+ self.class == other.class &&
173
+ bpp_scale == other.bpp_scale &&
174
+ bpp_max == other.bpp_max &&
175
+ max_q == other.max_q &&
176
+ min_q == other.min_q &&
177
+ max_pixel_value == other.max_pixel_value &&
178
+ psnr_max == other.psnr_max &&
179
+ discretized_bpp_max == other.discretized_bpp_max
180
+ end
181
+
182
+ # @see the `==` method
183
+ # @param [Object] Object to be compared
184
+ def eql?(other)
185
+ self == other
186
+ end
187
+
188
+ # Calculates hash code according to all attributes.
189
+ # @return [Fixnum] Hash code
190
+ def hash
191
+ [bpp_scale, bpp_max, max_q, min_q, max_pixel_value, psnr_max, discretized_bpp_max].hash
192
+ end
193
+
194
+ # Builds the object from hash
195
+ # @param [Hash] attributes Model attributes in the form of hash
196
+ # @return [Object] Returns the model itself
197
+ def build_from_hash(attributes)
198
+ return nil unless attributes.is_a?(Hash)
199
+ self.class.swagger_types.each_pair do |key, type|
200
+ if type =~ /\AArray<(.*)>/i
201
+ # check to ensure the input is an array given that the the attribute
202
+ # is documented as an array but the input is not
203
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
204
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
205
+ end
206
+ elsif !attributes[self.class.attribute_map[key]].nil?
207
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
208
+ end
209
+ # or else data not found in attributes(hash), not an issue as the data can be optional
210
+ end
211
+
212
+ self
213
+ end
214
+
215
+ # Deserializes the data based on type
216
+ # @param string type Data type
217
+ # @param string value Value to be deserialized
218
+ # @return [Object] Deserialized data
219
+ def _deserialize(type, value)
220
+ case type.to_sym
221
+ when :DateTime
222
+ Time.at(/\d/.match(value)[0].to_f).to_datetime
223
+ when :Date
224
+ Time.at(/\d/.match(value)[0].to_f).to_date
225
+ when :String
226
+ value.to_s
227
+ when :Integer
228
+ value.to_i
229
+ when :Float
230
+ value.to_f
231
+ when :BOOLEAN
232
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
233
+ true
234
+ else
235
+ false
236
+ end
237
+ when :Object
238
+ # generic object (usually a Hash), return directly
239
+ value
240
+ when /\AArray<(?<inner_type>.+)>\z/
241
+ inner_type = Regexp.last_match[:inner_type]
242
+ value.map { |v| _deserialize(inner_type, v) }
243
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
244
+ k_type = Regexp.last_match[:k_type]
245
+ v_type = Regexp.last_match[:v_type]
246
+ {}.tap do |hash|
247
+ value.each do |k, v|
248
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
249
+ end
250
+ end
251
+ else
252
+ # model
253
+ temp_model = AsposeCadCloud.const_get(type).new
254
+ temp_model.build_from_hash(value)
255
+ end
256
+ end
257
+
258
+ # Returns the string representation of the object
259
+ # @return [String] String presentation of the object
260
+ def to_s
261
+ to_hash.to_s
262
+ end
263
+
264
+ # to_body is an alias to to_hash (backward compatibility)
265
+ # @return [Hash] Returns the object in the form of hash
266
+ def to_body
267
+ to_hash
268
+ end
269
+
270
+ # Returns the object in the form of hash
271
+ # @return [Hash] Returns the object in the form of hash
272
+ def to_hash
273
+ hash = {}
274
+ self.class.attribute_map.each_pair do |attr, param|
275
+ value = self.send(attr)
276
+ next if value.nil?
277
+ hash[param] = _to_hash(value)
278
+ end
279
+ hash
280
+ end
281
+
282
+ # Outputs non-array value in the form of hash
283
+ # For object, use to_hash. Otherwise, just return the value
284
+ # @param [Object] value Any valid value
285
+ # @return [Hash] Returns the value in the form of hash
286
+ def _to_hash(value)
287
+ if value.is_a?(Array)
288
+ value.compact.map { |v| _to_hash(v) }
289
+ elsif value.is_a?(Hash)
290
+ {}.tap do |hash|
291
+ value.each { |k, v| hash[k] = _to_hash(v) }
292
+ end
293
+ elsif value.respond_to? :to_hash
294
+ value.to_hash
295
+ else
296
+ value
297
+ end
298
+ end
299
+
300
+ end
301
+
302
+ end