aspose_cad_cloud 19.11

Sign up to get free protection for your applications and to get access to all the features.
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,280 @@
1
+
2
+ require 'date'
3
+
4
+ module AsposeCadCloud
5
+ #
6
+ # --------------------------------------------------------------------------------------------------------------------
7
+ # <copyright company="Aspose" file="PenOptions.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
+ # Drawing pen options
33
+ class PenOptions
34
+ # Gets or sets the start cap.
35
+ attr_accessor :start_cap
36
+
37
+ # Gets or sets the end cap.
38
+ attr_accessor :end_cap
39
+
40
+ class EnumAttributeValidator
41
+ attr_reader :datatype
42
+ attr_reader :allowable_values
43
+
44
+ def initialize(datatype, allowable_values)
45
+ @allowable_values = allowable_values.map do |value|
46
+ case datatype.to_s
47
+ when /Integer/i
48
+ value.to_i
49
+ when /Float/i
50
+ value.to_f
51
+ else
52
+ value
53
+ end
54
+ end
55
+ end
56
+
57
+ def valid?(value)
58
+ !value || allowable_values.include?(value)
59
+ end
60
+ end
61
+
62
+ # Attribute mapping from ruby-style variable name to JSON key.
63
+ def self.attribute_map
64
+ {
65
+ :'start_cap' => :'StartCap',
66
+ :'end_cap' => :'EndCap'
67
+ }
68
+ end
69
+
70
+ # Attribute type mapping.
71
+ def self.swagger_types
72
+ {
73
+ :'start_cap' => :'String',
74
+ :'end_cap' => :'String'
75
+ }
76
+ end
77
+
78
+ # Initializes the object
79
+ # @param [Hash] attributes Model attributes in the form of hash
80
+ def initialize(attributes = {})
81
+ return unless attributes.is_a?(Hash)
82
+
83
+ # convert string to symbol for hash key
84
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
85
+
86
+ if attributes.key?(:'StartCap')
87
+ self.start_cap = attributes[:'StartCap']
88
+ end
89
+
90
+ if attributes.key?(:'EndCap')
91
+ self.end_cap = attributes[:'EndCap']
92
+ end
93
+
94
+ end
95
+
96
+ # Show invalid properties with the reasons. Usually used together with valid?
97
+ # @return Array for valid properies with the reasons
98
+ def list_invalid_properties
99
+ invalid_properties = []
100
+ if @start_cap.nil?
101
+ invalid_properties.push("invalid value for 'start_cap', start_cap cannot be nil.")
102
+ end
103
+
104
+ if @end_cap.nil?
105
+ invalid_properties.push("invalid value for 'end_cap', end_cap cannot be nil.")
106
+ end
107
+
108
+ return invalid_properties
109
+ end
110
+
111
+ # Check to see if the all the properties in the model are valid
112
+ # @return true if the model is valid
113
+ def valid?
114
+ return false if @start_cap.nil?
115
+ start_cap_validator = EnumAttributeValidator.new('String', ["Flat", "Square", "Round", "Triangle", "NoAnchor", "SquareAnchor", "RoundAnchor", "DiamondAnchor", "ArrowAnchor", "AnchorMask", "Custom"])
116
+ return false unless start_cap_validator.valid?(@start_cap)
117
+ return false if @end_cap.nil?
118
+ end_cap_validator = EnumAttributeValidator.new('String', ["Flat", "Square", "Round", "Triangle", "NoAnchor", "SquareAnchor", "RoundAnchor", "DiamondAnchor", "ArrowAnchor", "AnchorMask", "Custom"])
119
+ return false unless end_cap_validator.valid?(@end_cap)
120
+ return true
121
+ end
122
+
123
+ # Custom attribute writer method checking allowed values (enum).
124
+ # @param [Object] start_cap Object to be assigned
125
+ def start_cap=(start_cap)
126
+ validator = EnumAttributeValidator.new('String', ["Flat", "Square", "Round", "Triangle", "NoAnchor", "SquareAnchor", "RoundAnchor", "DiamondAnchor", "ArrowAnchor", "AnchorMask", "Custom"])
127
+ if start_cap.to_i == 0
128
+ unless validator.valid?(start_cap)
129
+ raise ArgumentError, "invalid value for 'start_cap', must be one of #{validator.allowable_values}."
130
+ end
131
+ @start_cap = start_cap
132
+ else
133
+ @start_cap = validator.allowable_values[start_cap.to_i]
134
+ end
135
+ end
136
+
137
+ # Custom attribute writer method checking allowed values (enum).
138
+ # @param [Object] end_cap Object to be assigned
139
+ def end_cap=(end_cap)
140
+ validator = EnumAttributeValidator.new('String', ["Flat", "Square", "Round", "Triangle", "NoAnchor", "SquareAnchor", "RoundAnchor", "DiamondAnchor", "ArrowAnchor", "AnchorMask", "Custom"])
141
+ if end_cap.to_i == 0
142
+ unless validator.valid?(end_cap)
143
+ raise ArgumentError, "invalid value for 'end_cap', must be one of #{validator.allowable_values}."
144
+ end
145
+ @end_cap = end_cap
146
+ else
147
+ @end_cap = validator.allowable_values[end_cap.to_i]
148
+ end
149
+ end
150
+
151
+ # Checks equality by comparing each attribute.
152
+ # @param [Object] Object to be compared
153
+ def ==(other)
154
+ return true if self.equal?(other)
155
+ self.class == other.class &&
156
+ start_cap == other.start_cap &&
157
+ end_cap == other.end_cap
158
+ end
159
+
160
+ # @see the `==` method
161
+ # @param [Object] Object to be compared
162
+ def eql?(other)
163
+ self == other
164
+ end
165
+
166
+ # Calculates hash code according to all attributes.
167
+ # @return [Fixnum] Hash code
168
+ def hash
169
+ [start_cap, end_cap].hash
170
+ end
171
+
172
+ # Builds the object from hash
173
+ # @param [Hash] attributes Model attributes in the form of hash
174
+ # @return [Object] Returns the model itself
175
+ def build_from_hash(attributes)
176
+ return nil unless attributes.is_a?(Hash)
177
+ self.class.swagger_types.each_pair do |key, type|
178
+ if type =~ /\AArray<(.*)>/i
179
+ # check to ensure the input is an array given that the the attribute
180
+ # is documented as an array but the input is not
181
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
182
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
183
+ end
184
+ elsif !attributes[self.class.attribute_map[key]].nil?
185
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
186
+ end
187
+ # or else data not found in attributes(hash), not an issue as the data can be optional
188
+ end
189
+
190
+ self
191
+ end
192
+
193
+ # Deserializes the data based on type
194
+ # @param string type Data type
195
+ # @param string value Value to be deserialized
196
+ # @return [Object] Deserialized data
197
+ def _deserialize(type, value)
198
+ case type.to_sym
199
+ when :DateTime
200
+ Time.at(/\d/.match(value)[0].to_f).to_datetime
201
+ when :Date
202
+ Time.at(/\d/.match(value)[0].to_f).to_date
203
+ when :String
204
+ value.to_s
205
+ when :Integer
206
+ value.to_i
207
+ when :Float
208
+ value.to_f
209
+ when :BOOLEAN
210
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
211
+ true
212
+ else
213
+ false
214
+ end
215
+ when :Object
216
+ # generic object (usually a Hash), return directly
217
+ value
218
+ when /\AArray<(?<inner_type>.+)>\z/
219
+ inner_type = Regexp.last_match[:inner_type]
220
+ value.map { |v| _deserialize(inner_type, v) }
221
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
222
+ k_type = Regexp.last_match[:k_type]
223
+ v_type = Regexp.last_match[:v_type]
224
+ {}.tap do |hash|
225
+ value.each do |k, v|
226
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
227
+ end
228
+ end
229
+ else
230
+ # model
231
+ temp_model = AsposeCadCloud.const_get(type).new
232
+ temp_model.build_from_hash(value)
233
+ end
234
+ end
235
+
236
+ # Returns the string representation of the object
237
+ # @return [String] String presentation of the object
238
+ def to_s
239
+ to_hash.to_s
240
+ end
241
+
242
+ # to_body is an alias to to_hash (backward compatibility)
243
+ # @return [Hash] Returns the object in the form of hash
244
+ def to_body
245
+ to_hash
246
+ end
247
+
248
+ # Returns the object in the form of hash
249
+ # @return [Hash] Returns the object in the form of hash
250
+ def to_hash
251
+ hash = {}
252
+ self.class.attribute_map.each_pair do |attr, param|
253
+ value = self.send(attr)
254
+ next if value.nil?
255
+ hash[param] = _to_hash(value)
256
+ end
257
+ hash
258
+ end
259
+
260
+ # Outputs non-array value in the form of hash
261
+ # For object, use to_hash. Otherwise, just return the value
262
+ # @param [Object] value Any valid value
263
+ # @return [Hash] Returns the value in the form of hash
264
+ def _to_hash(value)
265
+ if value.is_a?(Array)
266
+ value.compact.map { |v| _to_hash(v) }
267
+ elsif value.is_a?(Hash)
268
+ {}.tap do |hash|
269
+ value.each { |k, v| hash[k] = _to_hash(v) }
270
+ end
271
+ elsif value.respond_to? :to_hash
272
+ value.to_hash
273
+ else
274
+ value
275
+ end
276
+ end
277
+
278
+ end
279
+
280
+ end
@@ -0,0 +1,388 @@
1
+
2
+ require 'date'
3
+
4
+ module AsposeCadCloud
5
+ #
6
+ # --------------------------------------------------------------------------------------------------------------------
7
+ # <copyright company="Aspose" file="PngOptionsDTO.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 PNG format
33
+ class PngOptionsDTO
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
+ # Color type
47
+ attr_accessor :color_type
48
+
49
+ # Determines whether 'progressive' method is used
50
+ attr_accessor :progressive
51
+
52
+ # Filter type
53
+ attr_accessor :filter_type
54
+
55
+ # Compression level
56
+ attr_accessor :compression_level
57
+
58
+ # Bits depth
59
+ attr_accessor :bit_depth
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
+ :'color_type' => :'ColorType',
91
+ :'progressive' => :'Progressive',
92
+ :'filter_type' => :'FilterType',
93
+ :'compression_level' => :'CompressionLevel',
94
+ :'bit_depth' => :'BitDepth'
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
+ :'color_type' => :'String',
106
+ :'progressive' => :'BOOLEAN',
107
+ :'filter_type' => :'String',
108
+ :'compression_level' => :'Integer',
109
+ :'bit_depth' => :'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?(:'ColorType')
140
+ self.color_type = attributes[:'ColorType']
141
+ end
142
+
143
+ if attributes.key?(:'Progressive')
144
+ self.progressive = attributes[:'Progressive']
145
+ end
146
+
147
+ if attributes.key?(:'FilterType')
148
+ self.filter_type = attributes[:'FilterType']
149
+ end
150
+
151
+ if attributes.key?(:'CompressionLevel')
152
+ self.compression_level = attributes[:'CompressionLevel']
153
+ end
154
+
155
+ if attributes.key?(:'BitDepth')
156
+ self.bit_depth = attributes[:'BitDepth']
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 @color_type.nil?
170
+ invalid_properties.push("invalid value for 'color_type', color_type cannot be nil.")
171
+ end
172
+
173
+ if @progressive.nil?
174
+ invalid_properties.push("invalid value for 'progressive', progressive cannot be nil.")
175
+ end
176
+
177
+ if @filter_type.nil?
178
+ invalid_properties.push("invalid value for 'filter_type', filter_type cannot be nil.")
179
+ end
180
+
181
+ if @compression_level.nil?
182
+ invalid_properties.push("invalid value for 'compression_level', compression_level cannot be nil.")
183
+ end
184
+
185
+ if @bit_depth.nil?
186
+ invalid_properties.push("invalid value for 'bit_depth', bit_depth 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 @color_type.nil?
199
+ color_type_validator = EnumAttributeValidator.new('String', ["Grayscale", "Truecolor", "IndexedColor", "GrayscaleWithAlpha", "TruecolorWithAlpha"])
200
+ return false unless color_type_validator.valid?(@color_type)
201
+ return false if @progressive.nil?
202
+ return false if @filter_type.nil?
203
+ filter_type_validator = EnumAttributeValidator.new('String', ["None", "Sub", "Up", "Avg", "Paeth", "Adaptive"])
204
+ return false unless filter_type_validator.valid?(@filter_type)
205
+ return false if @compression_level.nil?
206
+ return false if @bit_depth.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] color_type Object to be assigned
226
+ def color_type=(color_type)
227
+ validator = EnumAttributeValidator.new('String', ["Grayscale", "Truecolor", "IndexedColor", "GrayscaleWithAlpha", "TruecolorWithAlpha"])
228
+ if color_type.to_i == 0
229
+ unless validator.valid?(color_type)
230
+ raise ArgumentError, "invalid value for 'color_type', must be one of #{validator.allowable_values}."
231
+ end
232
+ @color_type = color_type
233
+ else
234
+ @color_type = validator.allowable_values[color_type.to_i]
235
+ end
236
+ end
237
+
238
+ # Custom attribute writer method checking allowed values (enum).
239
+ # @param [Object] filter_type Object to be assigned
240
+ def filter_type=(filter_type)
241
+ validator = EnumAttributeValidator.new('String', ["None", "Sub", "Up", "Avg", "Paeth", "Adaptive"])
242
+ if filter_type.to_i == 0
243
+ unless validator.valid?(filter_type)
244
+ raise ArgumentError, "invalid value for 'filter_type', must be one of #{validator.allowable_values}."
245
+ end
246
+ @filter_type = filter_type
247
+ else
248
+ @filter_type = validator.allowable_values[filter_type.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
+ color_type == other.color_type &&
262
+ progressive == other.progressive &&
263
+ filter_type == other.filter_type &&
264
+ compression_level == other.compression_level &&
265
+ bit_depth == other.bit_depth
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, color_type, progressive, filter_type, compression_level, bit_depth].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