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