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,189 @@
1
+ # ------------------------------------------------------------------------------------
2
+ # <copyright company="Aspose" file="configuration.rb">
3
+ # Copyright (c) 2018 Aspose.CAD Cloud
4
+ # </copyright>
5
+ # <summary>
6
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ # of this software and associated documentation files (the "Software"), to deal
8
+ # in the Software without restriction, including without limitation the rights
9
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ # copies of the Software, and to permit persons to whom the Software is
11
+ # furnished to do so, subject to the following conditions:
12
+ #
13
+ # The above copyright notice and this permission notice shall be included in all
14
+ # copies or substantial portions of the Software.
15
+ #
16
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ # SOFTWARE.
23
+ # </summary>
24
+ # ------------------------------------------------------------------------------------
25
+
26
+ require 'uri'
27
+
28
+ module AsposeCadCloud
29
+ #
30
+ # Class for storing API configuration info
31
+ #
32
+ class Configuration
33
+
34
+ # Defines v1 api version
35
+ V1_API_VERSION = '/v1.0'.freeze
36
+
37
+ # Defines v2 api version
38
+ V2_API_VERSION = '/v2.0'.freeze
39
+
40
+ # Defines v3 api version
41
+ V3_API_VERSION = '/v3.0'.freeze
42
+
43
+ # Defines v1.1 api version
44
+ V1_1_API_VERSION = '/v1.1'.freeze
45
+
46
+ # Defines url scheme
47
+ attr_accessor :scheme
48
+
49
+ # Defines url host
50
+ attr_accessor :host
51
+
52
+ # Defines url api version
53
+ attr_accessor :api_version
54
+
55
+ # Defines API keys used with API Key authentications.
56
+ #
57
+ # @return [Hash] key: parameter name, value: parameter value (API key)
58
+ #
59
+ # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
60
+ # config.api_key['api_key'] = 'xxx'
61
+ attr_accessor :api_key
62
+
63
+ # Defines API key prefixes used with API Key authentications.
64
+ #
65
+ # @return [Hash] key: parameter name, value: API key prefix
66
+ #
67
+ # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
68
+ # config.api_key_prefix['api_key'] = 'Token'
69
+ attr_accessor :api_key_prefix
70
+
71
+ # Defines the username used with HTTP basic authentication.
72
+ #
73
+ # @return [String]
74
+ attr_accessor :username
75
+
76
+ # Defines the password used with HTTP basic authentication.
77
+ #
78
+ # @return [String]
79
+ attr_accessor :password
80
+
81
+ # Defines the access token (Bearer) used with OAuth2.
82
+ attr_accessor :access_token
83
+
84
+ # Defines the refresh token (Bearer) used with OAuth2.
85
+ attr_accessor :refresh_token
86
+
87
+ # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
88
+ # details will be logged with `logger.debug` (see the `logger` attribute).
89
+ # Default to false.
90
+ #
91
+ # @return [true, false]
92
+ attr_accessor :debugging
93
+
94
+ # Defines the logger used for debugging.
95
+ # Default to `Rails.logger` (when in Rails) or logging to STDOUT.
96
+ #
97
+ # @return [#debug]
98
+ attr_accessor :logger
99
+
100
+ # Defines the temporary folder to store downloaded files
101
+ # (for API endpoints that have file response).
102
+ # Default to use `Tempfile`.
103
+ #
104
+ # @return [String]
105
+ attr_accessor :temp_folder_path
106
+
107
+ # Set this to false to skip client side validation in the operation.
108
+ # Default to true.
109
+ # @return [true, false]
110
+ attr_accessor :client_side_validation
111
+
112
+
113
+ def initialize
114
+ @scheme = 'https'
115
+ @host = "api.aspose.cloud"
116
+ @api_version = V3_API_VERSION
117
+ @api_key = {}
118
+ @api_key_prefix = {}
119
+ @client_side_validation = true
120
+ @debugging = false
121
+ @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
122
+
123
+ yield(self) if block_given?
124
+ end
125
+
126
+ # The default Configuration object.
127
+ def self.default
128
+ @@default ||= Configuration.new
129
+ end
130
+
131
+ # yield self
132
+ def configure
133
+ yield(self) if block_given?
134
+ end
135
+
136
+ # sets the scheme
137
+ def scheme=(scheme)
138
+ # remove :// from scheme
139
+ @scheme = scheme.sub(/:\/\//, '')
140
+ end
141
+
142
+ # sets the host
143
+ def host=(host)
144
+ # remove http(s):// and anything after a slash
145
+ @host = host.sub(/https?:\/\//, '').split('/').first
146
+ end
147
+
148
+ # sets the api_version
149
+ def api_version=(api_version)
150
+ # Add leading and trailing slashes to api_version
151
+ @api_version = "/#{api_version}".gsub(/\/+/, '/')
152
+ @api_version = "" if @api_version == "/"
153
+ end
154
+
155
+ # returns base url
156
+ def base_url
157
+ url = "#{scheme}://#{[host, api_version].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
158
+ URI.encode(url)
159
+ end
160
+
161
+ # Gets API key (with prefix if set).
162
+ # @param [String] param_name the parameter name of API key auth
163
+ def api_key_with_prefix(param_name)
164
+ if @api_key_prefix[param_name]
165
+ "#{@api_key_prefix[param_name]} #{@api_key[param_name]}"
166
+ else
167
+ @api_key[param_name]
168
+ end
169
+ end
170
+
171
+ # Gets Basic Auth token string
172
+ def basic_auth_token
173
+ 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
174
+ end
175
+
176
+ # Returns Auth Settings hash for api client.
177
+ def auth_settings
178
+ {
179
+ 'JWT' =>
180
+ {
181
+ type: 'oauth2',
182
+ in: 'header',
183
+ key: 'Authorization',
184
+ value: "Bearer #{access_token}"
185
+ },
186
+ }
187
+ end
188
+ end
189
+ end
@@ -0,0 +1,327 @@
1
+
2
+ require 'date'
3
+
4
+ module AsposeCadCloud
5
+ #
6
+ # --------------------------------------------------------------------------------------------------------------------
7
+ # <copyright company="Aspose" file="BmpOptionsDTO.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 BMP format
33
+ class BmpOptionsDTO
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
+ # Bits per pixel
47
+ attr_accessor :bits_per_pixel
48
+
49
+ # Compression type
50
+ attr_accessor :compression
51
+
52
+ class EnumAttributeValidator
53
+ attr_reader :datatype
54
+ attr_reader :allowable_values
55
+
56
+ def initialize(datatype, allowable_values)
57
+ @allowable_values = allowable_values.map do |value|
58
+ case datatype.to_s
59
+ when /Integer/i
60
+ value.to_i
61
+ when /Float/i
62
+ value.to_f
63
+ else
64
+ value
65
+ end
66
+ end
67
+ end
68
+
69
+ def valid?(value)
70
+ !value || allowable_values.include?(value)
71
+ end
72
+ end
73
+
74
+ # Attribute mapping from ruby-style variable name to JSON key.
75
+ def self.attribute_map
76
+ {
77
+ :'rotation' => :'Rotation',
78
+ :'layers' => :'Layers',
79
+ :'resolution_settings' => :'ResolutionSettings',
80
+ :'vector_rasterization_options' => :'VectorRasterizationOptions',
81
+ :'bits_per_pixel' => :'BitsPerPixel',
82
+ :'compression' => :'Compression'
83
+ }
84
+ end
85
+
86
+ # Attribute type mapping.
87
+ def self.swagger_types
88
+ {
89
+ :'rotation' => :'String',
90
+ :'layers' => :'Array<String>',
91
+ :'resolution_settings' => :'ResolutionSetting',
92
+ :'vector_rasterization_options' => :'CadRasterizationOptionsDTO',
93
+ :'bits_per_pixel' => :'Integer',
94
+ :'compression' => :'String'
95
+ }
96
+ end
97
+
98
+ # Initializes the object
99
+ # @param [Hash] attributes Model attributes in the form of hash
100
+ def initialize(attributes = {})
101
+ return unless attributes.is_a?(Hash)
102
+
103
+ # convert string to symbol for hash key
104
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
105
+
106
+ if attributes.key?(:'Rotation')
107
+ self.rotation = attributes[:'Rotation']
108
+ end
109
+
110
+ if attributes.key?(:'Layers')
111
+ if (value = attributes[:'Layers']).is_a?(Array)
112
+ self.layers = value
113
+ end
114
+ end
115
+
116
+ if attributes.key?(:'ResolutionSettings')
117
+ self.resolution_settings = attributes[:'ResolutionSettings']
118
+ end
119
+
120
+ if attributes.key?(:'VectorRasterizationOptions')
121
+ self.vector_rasterization_options = attributes[:'VectorRasterizationOptions']
122
+ end
123
+
124
+ if attributes.key?(:'BitsPerPixel')
125
+ self.bits_per_pixel = attributes[:'BitsPerPixel']
126
+ end
127
+
128
+ if attributes.key?(:'Compression')
129
+ self.compression = attributes[:'Compression']
130
+ end
131
+
132
+ end
133
+
134
+ # Show invalid properties with the reasons. Usually used together with valid?
135
+ # @return Array for valid properies with the reasons
136
+ def list_invalid_properties
137
+ invalid_properties = []
138
+ if @rotation.nil?
139
+ invalid_properties.push("invalid value for 'rotation', rotation cannot be nil.")
140
+ end
141
+
142
+ if @bits_per_pixel.nil?
143
+ invalid_properties.push("invalid value for 'bits_per_pixel', bits_per_pixel cannot be nil.")
144
+ end
145
+
146
+ if @compression.nil?
147
+ invalid_properties.push("invalid value for 'compression', compression cannot be nil.")
148
+ end
149
+
150
+ return invalid_properties
151
+ end
152
+
153
+ # Check to see if the all the properties in the model are valid
154
+ # @return true if the model is valid
155
+ def valid?
156
+ return false if @rotation.nil?
157
+ rotation_validator = EnumAttributeValidator.new('String', ["RotateNoneFlipNone", "Rotate90FlipNone", "Rotate180FlipNone", "Rotate270FlipNone", "RotateNoneFlipX", "Rotate90FlipX", "Rotate180FlipX", "Rotate270FlipX", "RotateNoneFlipY", "Rotate90FlipY", "Rotate180FlipY", "Rotate270FlipY", "RotateNoneFlipXY", "Rotate90FlipXY", "Rotate180FlipXY", "Rotate270FlipXY"])
158
+ return false unless rotation_validator.valid?(@rotation)
159
+ return false if @bits_per_pixel.nil?
160
+ return false if @compression.nil?
161
+ compression_validator = EnumAttributeValidator.new('String', ["Rgb", "Rle8", "Rle4", "Bitfields", "Jpeg", "Png", "AlphaBitfields"])
162
+ return false unless compression_validator.valid?(@compression)
163
+ return true
164
+ end
165
+
166
+ # Custom attribute writer method checking allowed values (enum).
167
+ # @param [Object] rotation Object to be assigned
168
+ def rotation=(rotation)
169
+ validator = EnumAttributeValidator.new('String', ["RotateNoneFlipNone", "Rotate90FlipNone", "Rotate180FlipNone", "Rotate270FlipNone", "RotateNoneFlipX", "Rotate90FlipX", "Rotate180FlipX", "Rotate270FlipX", "RotateNoneFlipY", "Rotate90FlipY", "Rotate180FlipY", "Rotate270FlipY", "RotateNoneFlipXY", "Rotate90FlipXY", "Rotate180FlipXY", "Rotate270FlipXY"])
170
+ if rotation.to_i == 0
171
+ unless validator.valid?(rotation)
172
+ raise ArgumentError, "invalid value for 'rotation', must be one of #{validator.allowable_values}."
173
+ end
174
+ @rotation = rotation
175
+ else
176
+ @rotation = validator.allowable_values[rotation.to_i]
177
+ end
178
+ end
179
+
180
+ # Custom attribute writer method checking allowed values (enum).
181
+ # @param [Object] compression Object to be assigned
182
+ def compression=(compression)
183
+ validator = EnumAttributeValidator.new('String', ["Rgb", "Rle8", "Rle4", "Bitfields", "Jpeg", "Png", "AlphaBitfields"])
184
+ if compression.to_i == 0
185
+ unless validator.valid?(compression)
186
+ raise ArgumentError, "invalid value for 'compression', must be one of #{validator.allowable_values}."
187
+ end
188
+ @compression = compression
189
+ else
190
+ @compression = validator.allowable_values[compression.to_i]
191
+ end
192
+ end
193
+
194
+ # Checks equality by comparing each attribute.
195
+ # @param [Object] Object to be compared
196
+ def ==(other)
197
+ return true if self.equal?(other)
198
+ self.class == other.class &&
199
+ rotation == other.rotation &&
200
+ layers == other.layers &&
201
+ resolution_settings == other.resolution_settings &&
202
+ vector_rasterization_options == other.vector_rasterization_options &&
203
+ bits_per_pixel == other.bits_per_pixel &&
204
+ compression == other.compression
205
+ end
206
+
207
+ # @see the `==` method
208
+ # @param [Object] Object to be compared
209
+ def eql?(other)
210
+ self == other
211
+ end
212
+
213
+ # Calculates hash code according to all attributes.
214
+ # @return [Fixnum] Hash code
215
+ def hash
216
+ [rotation, layers, resolution_settings, vector_rasterization_options, bits_per_pixel, compression].hash
217
+ end
218
+
219
+ # Builds the object from hash
220
+ # @param [Hash] attributes Model attributes in the form of hash
221
+ # @return [Object] Returns the model itself
222
+ def build_from_hash(attributes)
223
+ return nil unless attributes.is_a?(Hash)
224
+ self.class.swagger_types.each_pair do |key, type|
225
+ if type =~ /\AArray<(.*)>/i
226
+ # check to ensure the input is an array given that the the attribute
227
+ # is documented as an array but the input is not
228
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
229
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
230
+ end
231
+ elsif !attributes[self.class.attribute_map[key]].nil?
232
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
233
+ end
234
+ # or else data not found in attributes(hash), not an issue as the data can be optional
235
+ end
236
+
237
+ self
238
+ end
239
+
240
+ # Deserializes the data based on type
241
+ # @param string type Data type
242
+ # @param string value Value to be deserialized
243
+ # @return [Object] Deserialized data
244
+ def _deserialize(type, value)
245
+ case type.to_sym
246
+ when :DateTime
247
+ Time.at(/\d/.match(value)[0].to_f).to_datetime
248
+ when :Date
249
+ Time.at(/\d/.match(value)[0].to_f).to_date
250
+ when :String
251
+ value.to_s
252
+ when :Integer
253
+ value.to_i
254
+ when :Float
255
+ value.to_f
256
+ when :BOOLEAN
257
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
258
+ true
259
+ else
260
+ false
261
+ end
262
+ when :Object
263
+ # generic object (usually a Hash), return directly
264
+ value
265
+ when /\AArray<(?<inner_type>.+)>\z/
266
+ inner_type = Regexp.last_match[:inner_type]
267
+ value.map { |v| _deserialize(inner_type, v) }
268
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
269
+ k_type = Regexp.last_match[:k_type]
270
+ v_type = Regexp.last_match[:v_type]
271
+ {}.tap do |hash|
272
+ value.each do |k, v|
273
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
274
+ end
275
+ end
276
+ else
277
+ # model
278
+ temp_model = AsposeCadCloud.const_get(type).new
279
+ temp_model.build_from_hash(value)
280
+ end
281
+ end
282
+
283
+ # Returns the string representation of the object
284
+ # @return [String] String presentation of the object
285
+ def to_s
286
+ to_hash.to_s
287
+ end
288
+
289
+ # to_body is an alias to to_hash (backward compatibility)
290
+ # @return [Hash] Returns the object in the form of hash
291
+ def to_body
292
+ to_hash
293
+ end
294
+
295
+ # Returns the object in the form of hash
296
+ # @return [Hash] Returns the object in the form of hash
297
+ def to_hash
298
+ hash = {}
299
+ self.class.attribute_map.each_pair do |attr, param|
300
+ value = self.send(attr)
301
+ next if value.nil?
302
+ hash[param] = _to_hash(value)
303
+ end
304
+ hash
305
+ end
306
+
307
+ # Outputs non-array value in the form of hash
308
+ # For object, use to_hash. Otherwise, just return the value
309
+ # @param [Object] value Any valid value
310
+ # @return [Hash] Returns the value in the form of hash
311
+ def _to_hash(value)
312
+ if value.is_a?(Array)
313
+ value.compact.map { |v| _to_hash(v) }
314
+ elsif value.is_a?(Hash)
315
+ {}.tap do |hash|
316
+ value.each { |k, v| hash[k] = _to_hash(v) }
317
+ end
318
+ elsif value.respond_to? :to_hash
319
+ value.to_hash
320
+ else
321
+ value
322
+ end
323
+ end
324
+
325
+ end
326
+
327
+ end