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,473 @@
1
+
2
+ require 'date'
3
+
4
+ module AsposeCadCloud
5
+ #
6
+ # --------------------------------------------------------------------------------------------------------------------
7
+ # <copyright company="Aspose" file="CadRasterizationOptionsDTO.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
+ # Raster export options
33
+ class CadRasterizationOptionsDTO
34
+ # Gets or sets the border X.
35
+ attr_accessor :border_x
36
+
37
+ # Gets or sets the border Y.
38
+ attr_accessor :border_y
39
+
40
+ # Gets or sets the page height.
41
+ attr_accessor :page_height
42
+
43
+ # Gets or sets the page width.
44
+ attr_accessor :page_width
45
+
46
+ # Gets or sets a background color.
47
+ attr_accessor :background_color
48
+
49
+ # Gets or sets a foreground color.
50
+ attr_accessor :draw_color
51
+
52
+ attr_accessor :unit_type
53
+
54
+ # Gets or sets a value indicating whether content of a drawing is represented as image inside Pdf. Applicable only for CAD to Pdf export. Default is false.
55
+ attr_accessor :content_as_bitmap
56
+
57
+ # Gets or sets options to render bitmap inside pdf (if ContentAsBitmap is set to true).
58
+ attr_accessor :graphics_options
59
+
60
+ # Zoom factor
61
+ attr_accessor :zoom
62
+
63
+ # Pen options
64
+ attr_accessor :pen_options
65
+
66
+ # Determines whether layout has to be scaled automatically
67
+ attr_accessor :automatic_layouts_scaling
68
+
69
+ # Layers to export
70
+ attr_accessor :layers
71
+
72
+ # Layouts to export
73
+ attr_accessor :layouts
74
+
75
+ # Drawing mode
76
+ attr_accessor :draw_type
77
+
78
+ # Determines whether scaling has to be turned off
79
+ attr_accessor :no_scaling
80
+
81
+ class EnumAttributeValidator
82
+ attr_reader :datatype
83
+ attr_reader :allowable_values
84
+
85
+ def initialize(datatype, allowable_values)
86
+ @allowable_values = allowable_values.map do |value|
87
+ case datatype.to_s
88
+ when /Integer/i
89
+ value.to_i
90
+ when /Float/i
91
+ value.to_f
92
+ else
93
+ value
94
+ end
95
+ end
96
+ end
97
+
98
+ def valid?(value)
99
+ !value || allowable_values.include?(value)
100
+ end
101
+ end
102
+
103
+ # Attribute mapping from ruby-style variable name to JSON key.
104
+ def self.attribute_map
105
+ {
106
+ :'border_x' => :'BorderX',
107
+ :'border_y' => :'BorderY',
108
+ :'page_height' => :'PageHeight',
109
+ :'page_width' => :'PageWidth',
110
+ :'background_color' => :'BackgroundColor',
111
+ :'draw_color' => :'DrawColor',
112
+ :'unit_type' => :'UnitType',
113
+ :'content_as_bitmap' => :'ContentAsBitmap',
114
+ :'graphics_options' => :'GraphicsOptions',
115
+ :'zoom' => :'Zoom',
116
+ :'pen_options' => :'PenOptions',
117
+ :'automatic_layouts_scaling' => :'AutomaticLayoutsScaling',
118
+ :'layers' => :'Layers',
119
+ :'layouts' => :'Layouts',
120
+ :'draw_type' => :'DrawType',
121
+ :'no_scaling' => :'NoScaling'
122
+ }
123
+ end
124
+
125
+ # Attribute type mapping.
126
+ def self.swagger_types
127
+ {
128
+ :'border_x' => :'Float',
129
+ :'border_y' => :'Float',
130
+ :'page_height' => :'Float',
131
+ :'page_width' => :'Float',
132
+ :'background_color' => :'Color',
133
+ :'draw_color' => :'Color',
134
+ :'unit_type' => :'String',
135
+ :'content_as_bitmap' => :'BOOLEAN',
136
+ :'graphics_options' => :'GraphicsOptions',
137
+ :'zoom' => :'Float',
138
+ :'pen_options' => :'PenOptions',
139
+ :'automatic_layouts_scaling' => :'BOOLEAN',
140
+ :'layers' => :'Array<String>',
141
+ :'layouts' => :'Array<String>',
142
+ :'draw_type' => :'String',
143
+ :'no_scaling' => :'BOOLEAN'
144
+ }
145
+ end
146
+
147
+ # Initializes the object
148
+ # @param [Hash] attributes Model attributes in the form of hash
149
+ def initialize(attributes = {})
150
+ return unless attributes.is_a?(Hash)
151
+
152
+ # convert string to symbol for hash key
153
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
154
+
155
+ if attributes.key?(:'BorderX')
156
+ self.border_x = attributes[:'BorderX']
157
+ end
158
+
159
+ if attributes.key?(:'BorderY')
160
+ self.border_y = attributes[:'BorderY']
161
+ end
162
+
163
+ if attributes.key?(:'PageHeight')
164
+ self.page_height = attributes[:'PageHeight']
165
+ end
166
+
167
+ if attributes.key?(:'PageWidth')
168
+ self.page_width = attributes[:'PageWidth']
169
+ end
170
+
171
+ if attributes.key?(:'BackgroundColor')
172
+ self.background_color = attributes[:'BackgroundColor']
173
+ end
174
+
175
+ if attributes.key?(:'DrawColor')
176
+ self.draw_color = attributes[:'DrawColor']
177
+ end
178
+
179
+ if attributes.key?(:'UnitType')
180
+ self.unit_type = attributes[:'UnitType']
181
+ end
182
+
183
+ if attributes.key?(:'ContentAsBitmap')
184
+ self.content_as_bitmap = attributes[:'ContentAsBitmap']
185
+ end
186
+
187
+ if attributes.key?(:'GraphicsOptions')
188
+ self.graphics_options = attributes[:'GraphicsOptions']
189
+ end
190
+
191
+ if attributes.key?(:'Zoom')
192
+ self.zoom = attributes[:'Zoom']
193
+ end
194
+
195
+ if attributes.key?(:'PenOptions')
196
+ self.pen_options = attributes[:'PenOptions']
197
+ end
198
+
199
+ if attributes.key?(:'AutomaticLayoutsScaling')
200
+ self.automatic_layouts_scaling = attributes[:'AutomaticLayoutsScaling']
201
+ end
202
+
203
+ if attributes.key?(:'Layers')
204
+ if (value = attributes[:'Layers']).is_a?(Array)
205
+ self.layers = value
206
+ end
207
+ end
208
+
209
+ if attributes.key?(:'Layouts')
210
+ if (value = attributes[:'Layouts']).is_a?(Array)
211
+ self.layouts = value
212
+ end
213
+ end
214
+
215
+ if attributes.key?(:'DrawType')
216
+ self.draw_type = attributes[:'DrawType']
217
+ end
218
+
219
+ if attributes.key?(:'NoScaling')
220
+ self.no_scaling = attributes[:'NoScaling']
221
+ end
222
+
223
+ end
224
+
225
+ # Show invalid properties with the reasons. Usually used together with valid?
226
+ # @return Array for valid properies with the reasons
227
+ def list_invalid_properties
228
+ invalid_properties = []
229
+ if @border_x.nil?
230
+ invalid_properties.push("invalid value for 'border_x', border_x cannot be nil.")
231
+ end
232
+
233
+ if @border_y.nil?
234
+ invalid_properties.push("invalid value for 'border_y', border_y cannot be nil.")
235
+ end
236
+
237
+ if @page_height.nil?
238
+ invalid_properties.push("invalid value for 'page_height', page_height cannot be nil.")
239
+ end
240
+
241
+ if @page_width.nil?
242
+ invalid_properties.push("invalid value for 'page_width', page_width cannot be nil.")
243
+ end
244
+
245
+ if @background_color.nil?
246
+ invalid_properties.push("invalid value for 'background_color', background_color cannot be nil.")
247
+ end
248
+
249
+ if @draw_color.nil?
250
+ invalid_properties.push("invalid value for 'draw_color', draw_color cannot be nil.")
251
+ end
252
+
253
+ if @unit_type.nil?
254
+ invalid_properties.push("invalid value for 'unit_type', unit_type cannot be nil.")
255
+ end
256
+
257
+ if @content_as_bitmap.nil?
258
+ invalid_properties.push("invalid value for 'content_as_bitmap', content_as_bitmap cannot be nil.")
259
+ end
260
+
261
+ if @zoom.nil?
262
+ invalid_properties.push("invalid value for 'zoom', zoom cannot be nil.")
263
+ end
264
+
265
+ if @automatic_layouts_scaling.nil?
266
+ invalid_properties.push("invalid value for 'automatic_layouts_scaling', automatic_layouts_scaling cannot be nil.")
267
+ end
268
+
269
+ if @draw_type.nil?
270
+ invalid_properties.push("invalid value for 'draw_type', draw_type cannot be nil.")
271
+ end
272
+
273
+ if @no_scaling.nil?
274
+ invalid_properties.push("invalid value for 'no_scaling', no_scaling cannot be nil.")
275
+ end
276
+
277
+ return invalid_properties
278
+ end
279
+
280
+ # Check to see if the all the properties in the model are valid
281
+ # @return true if the model is valid
282
+ def valid?
283
+ return false if @border_x.nil?
284
+ return false if @border_y.nil?
285
+ return false if @page_height.nil?
286
+ return false if @page_width.nil?
287
+ return false if @background_color.nil?
288
+ return false if @draw_color.nil?
289
+ return false if @unit_type.nil?
290
+ unit_type_validator = EnumAttributeValidator.new('String', ["Kilometer", "Meter", "Centimenter", "Millimeter", "Micrometer", "Nanometer", "Angstrom", "Decimeter", "Decameter", "Hectometer", "Gigameter", "AstronomicalUnit", "LightYear", "Parsec", "Mile", "Yard", "Foot", "Inch", "Mil", "MicroInch", "Custom", "Unitless"])
291
+ return false unless unit_type_validator.valid?(@unit_type)
292
+ return false if @content_as_bitmap.nil?
293
+ return false if @zoom.nil?
294
+ return false if @automatic_layouts_scaling.nil?
295
+ return false if @draw_type.nil?
296
+ draw_type_validator = EnumAttributeValidator.new('String', ["UseDrawColor", "UseObjectColor"])
297
+ return false unless draw_type_validator.valid?(@draw_type)
298
+ return false if @no_scaling.nil?
299
+ return true
300
+ end
301
+
302
+ # Custom attribute writer method checking allowed values (enum).
303
+ # @param [Object] unit_type Object to be assigned
304
+ def unit_type=(unit_type)
305
+ validator = EnumAttributeValidator.new('String', ["Kilometer", "Meter", "Centimenter", "Millimeter", "Micrometer", "Nanometer", "Angstrom", "Decimeter", "Decameter", "Hectometer", "Gigameter", "AstronomicalUnit", "LightYear", "Parsec", "Mile", "Yard", "Foot", "Inch", "Mil", "MicroInch", "Custom", "Unitless"])
306
+ if unit_type.to_i == 0
307
+ unless validator.valid?(unit_type)
308
+ raise ArgumentError, "invalid value for 'unit_type', must be one of #{validator.allowable_values}."
309
+ end
310
+ @unit_type = unit_type
311
+ else
312
+ @unit_type = validator.allowable_values[unit_type.to_i]
313
+ end
314
+ end
315
+
316
+ # Custom attribute writer method checking allowed values (enum).
317
+ # @param [Object] draw_type Object to be assigned
318
+ def draw_type=(draw_type)
319
+ validator = EnumAttributeValidator.new('String', ["UseDrawColor", "UseObjectColor"])
320
+ if draw_type.to_i == 0
321
+ unless validator.valid?(draw_type)
322
+ raise ArgumentError, "invalid value for 'draw_type', must be one of #{validator.allowable_values}."
323
+ end
324
+ @draw_type = draw_type
325
+ else
326
+ @draw_type = validator.allowable_values[draw_type.to_i]
327
+ end
328
+ end
329
+
330
+ # Checks equality by comparing each attribute.
331
+ # @param [Object] Object to be compared
332
+ def ==(other)
333
+ return true if self.equal?(other)
334
+ self.class == other.class &&
335
+ border_x == other.border_x &&
336
+ border_y == other.border_y &&
337
+ page_height == other.page_height &&
338
+ page_width == other.page_width &&
339
+ background_color == other.background_color &&
340
+ draw_color == other.draw_color &&
341
+ unit_type == other.unit_type &&
342
+ content_as_bitmap == other.content_as_bitmap &&
343
+ graphics_options == other.graphics_options &&
344
+ zoom == other.zoom &&
345
+ pen_options == other.pen_options &&
346
+ automatic_layouts_scaling == other.automatic_layouts_scaling &&
347
+ layers == other.layers &&
348
+ layouts == other.layouts &&
349
+ draw_type == other.draw_type &&
350
+ no_scaling == other.no_scaling
351
+ end
352
+
353
+ # @see the `==` method
354
+ # @param [Object] Object to be compared
355
+ def eql?(other)
356
+ self == other
357
+ end
358
+
359
+ # Calculates hash code according to all attributes.
360
+ # @return [Fixnum] Hash code
361
+ def hash
362
+ [border_x, border_y, page_height, page_width, background_color, draw_color, unit_type, content_as_bitmap, graphics_options, zoom, pen_options, automatic_layouts_scaling, layers, layouts, draw_type, no_scaling].hash
363
+ end
364
+
365
+ # Builds the object from hash
366
+ # @param [Hash] attributes Model attributes in the form of hash
367
+ # @return [Object] Returns the model itself
368
+ def build_from_hash(attributes)
369
+ return nil unless attributes.is_a?(Hash)
370
+ self.class.swagger_types.each_pair do |key, type|
371
+ if type =~ /\AArray<(.*)>/i
372
+ # check to ensure the input is an array given that the the attribute
373
+ # is documented as an array but the input is not
374
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
375
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
376
+ end
377
+ elsif !attributes[self.class.attribute_map[key]].nil?
378
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
379
+ end
380
+ # or else data not found in attributes(hash), not an issue as the data can be optional
381
+ end
382
+
383
+ self
384
+ end
385
+
386
+ # Deserializes the data based on type
387
+ # @param string type Data type
388
+ # @param string value Value to be deserialized
389
+ # @return [Object] Deserialized data
390
+ def _deserialize(type, value)
391
+ case type.to_sym
392
+ when :DateTime
393
+ Time.at(/\d/.match(value)[0].to_f).to_datetime
394
+ when :Date
395
+ Time.at(/\d/.match(value)[0].to_f).to_date
396
+ when :String
397
+ value.to_s
398
+ when :Integer
399
+ value.to_i
400
+ when :Float
401
+ value.to_f
402
+ when :BOOLEAN
403
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
404
+ true
405
+ else
406
+ false
407
+ end
408
+ when :Object
409
+ # generic object (usually a Hash), return directly
410
+ value
411
+ when /\AArray<(?<inner_type>.+)>\z/
412
+ inner_type = Regexp.last_match[:inner_type]
413
+ value.map { |v| _deserialize(inner_type, v) }
414
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
415
+ k_type = Regexp.last_match[:k_type]
416
+ v_type = Regexp.last_match[:v_type]
417
+ {}.tap do |hash|
418
+ value.each do |k, v|
419
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
420
+ end
421
+ end
422
+ else
423
+ # model
424
+ temp_model = AsposeCadCloud.const_get(type).new
425
+ temp_model.build_from_hash(value)
426
+ end
427
+ end
428
+
429
+ # Returns the string representation of the object
430
+ # @return [String] String presentation of the object
431
+ def to_s
432
+ to_hash.to_s
433
+ end
434
+
435
+ # to_body is an alias to to_hash (backward compatibility)
436
+ # @return [Hash] Returns the object in the form of hash
437
+ def to_body
438
+ to_hash
439
+ end
440
+
441
+ # Returns the object in the form of hash
442
+ # @return [Hash] Returns the object in the form of hash
443
+ def to_hash
444
+ hash = {}
445
+ self.class.attribute_map.each_pair do |attr, param|
446
+ value = self.send(attr)
447
+ next if value.nil?
448
+ hash[param] = _to_hash(value)
449
+ end
450
+ hash
451
+ end
452
+
453
+ # Outputs non-array value in the form of hash
454
+ # For object, use to_hash. Otherwise, just return the value
455
+ # @param [Object] value Any valid value
456
+ # @return [Hash] Returns the value in the form of hash
457
+ def _to_hash(value)
458
+ if value.is_a?(Array)
459
+ value.compact.map { |v| _to_hash(v) }
460
+ elsif value.is_a?(Hash)
461
+ {}.tap do |hash|
462
+ value.each { |k, v| hash[k] = _to_hash(v) }
463
+ end
464
+ elsif value.respond_to? :to_hash
465
+ value.to_hash
466
+ else
467
+ value
468
+ end
469
+ end
470
+
471
+ end
472
+
473
+ end