aspose_cells_cloud 22.10 → 22.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -5
- data/lib/aspose_cells_cloud/api/cells_api.rb +1074 -101
- data/lib/aspose_cells_cloud/models/axis.rb +516 -0
- data/lib/aspose_cells_cloud/models/axis_response.rb +221 -0
- data/lib/aspose_cells_cloud/models/tick_labels.rb +298 -0
- data/lib/aspose_cells_cloud/version.rb +1 -1
- data/lib/aspose_cells_cloud.rb +3 -0
- data/spec/api/cells_chart_axis_api_spec.rb +248 -0
- data/spec/api/cells_convert_spec.rb +15 -1
- metadata +6 -2
@@ -0,0 +1,516 @@
|
|
1
|
+
=begin
|
2
|
+
--------------------------------------------------------------------------------------------------------------------
|
3
|
+
Copyright (c) 2022 Aspose.Cells Cloud
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
6
|
+
in the Software without restriction, including without limitation the rights
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
9
|
+
furnished to do so, subject to the following conditions:
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
12
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
13
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
14
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
15
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
16
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
17
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
18
|
+
SOFTWARE.
|
19
|
+
--------------------------------------------------------------------------------------------------------------------
|
20
|
+
|
21
|
+
=end
|
22
|
+
|
23
|
+
require 'date'
|
24
|
+
|
25
|
+
module AsposeCellsCloud
|
26
|
+
|
27
|
+
class Axis
|
28
|
+
attr_accessor :area
|
29
|
+
|
30
|
+
#
|
31
|
+
attr_accessor :axis_between_categories
|
32
|
+
|
33
|
+
#
|
34
|
+
attr_accessor :axis_line
|
35
|
+
|
36
|
+
#
|
37
|
+
attr_accessor :base_unit_scale
|
38
|
+
|
39
|
+
#
|
40
|
+
attr_accessor :category_type
|
41
|
+
|
42
|
+
#
|
43
|
+
attr_accessor :cross_at
|
44
|
+
|
45
|
+
#
|
46
|
+
attr_accessor :cross_type
|
47
|
+
|
48
|
+
#
|
49
|
+
attr_accessor :display_unit
|
50
|
+
|
51
|
+
#
|
52
|
+
attr_accessor :has_multi_level_labels
|
53
|
+
|
54
|
+
#
|
55
|
+
attr_accessor :is_automatic_max_value
|
56
|
+
|
57
|
+
#
|
58
|
+
attr_accessor :is_automatic_minor_unit
|
59
|
+
|
60
|
+
#
|
61
|
+
attr_accessor :is_automatic_min_value
|
62
|
+
|
63
|
+
#
|
64
|
+
attr_accessor :is_display_unit_label_shown
|
65
|
+
|
66
|
+
#
|
67
|
+
attr_accessor :is_automatic_major_unit
|
68
|
+
|
69
|
+
#
|
70
|
+
attr_accessor :is_logarithmic
|
71
|
+
|
72
|
+
#
|
73
|
+
attr_accessor :is_plot_order_reversed
|
74
|
+
|
75
|
+
#
|
76
|
+
attr_accessor :is_visible
|
77
|
+
|
78
|
+
#
|
79
|
+
attr_accessor :log_base
|
80
|
+
|
81
|
+
#
|
82
|
+
attr_accessor :major_grid_lines
|
83
|
+
|
84
|
+
#
|
85
|
+
attr_accessor :major_tick_mark
|
86
|
+
|
87
|
+
#
|
88
|
+
attr_accessor :major_unit
|
89
|
+
|
90
|
+
#
|
91
|
+
attr_accessor :major_unit_scale
|
92
|
+
|
93
|
+
#
|
94
|
+
attr_accessor :max_value
|
95
|
+
|
96
|
+
#
|
97
|
+
attr_accessor :minor_grid_lines
|
98
|
+
|
99
|
+
#
|
100
|
+
attr_accessor :minor_tick_mark
|
101
|
+
|
102
|
+
#
|
103
|
+
attr_accessor :minor_unit
|
104
|
+
|
105
|
+
#
|
106
|
+
attr_accessor :minor_unit_scale
|
107
|
+
|
108
|
+
#
|
109
|
+
attr_accessor :min_value
|
110
|
+
|
111
|
+
#
|
112
|
+
attr_accessor :tick_label_position
|
113
|
+
|
114
|
+
#
|
115
|
+
attr_accessor :tick_labels
|
116
|
+
|
117
|
+
attr_accessor :tick_label_spacing
|
118
|
+
|
119
|
+
attr_accessor :tick_mark_spacing
|
120
|
+
|
121
|
+
#
|
122
|
+
attr_accessor :title
|
123
|
+
|
124
|
+
|
125
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
126
|
+
def self.attribute_map
|
127
|
+
{
|
128
|
+
:'area' => :'Area',
|
129
|
+
:'axis_between_categories' => :'AxisBetweenCategories',
|
130
|
+
:'axis_line' => :'AxisLine',
|
131
|
+
:'base_unit_scale' => :'BaseUnitScale',
|
132
|
+
:'category_type' => :'CategoryType',
|
133
|
+
:'cross_at' => :'CrossAt',
|
134
|
+
:'cross_type' => :'CrossType',
|
135
|
+
:'display_unit' => :'DisplayUnit',
|
136
|
+
:'has_multi_level_labels' => :'HasMultiLevelLabels',
|
137
|
+
:'is_automatic_max_value' => :'IsAutomaticMaxValue',
|
138
|
+
:'is_automatic_minor_unit' => :'IsAutomaticMinorUnit',
|
139
|
+
:'is_automatic_min_value' => :'IsAutomaticMinValue',
|
140
|
+
:'is_display_unit_label_shown' => :'IsDisplayUnitLabelShown',
|
141
|
+
:'is_automatic_major_unit' => :'IsAutomaticMajorUnit',
|
142
|
+
:'is_logarithmic' => :'IsLogarithmic',
|
143
|
+
:'is_plot_order_reversed' => :'IsPlotOrderReversed',
|
144
|
+
:'is_visible' => :'IsVisible',
|
145
|
+
:'log_base' => :'LogBase',
|
146
|
+
:'major_grid_lines' => :'MajorGridLines',
|
147
|
+
:'major_tick_mark' => :'MajorTickMark',
|
148
|
+
:'major_unit' => :'MajorUnit',
|
149
|
+
:'major_unit_scale' => :'MajorUnitScale',
|
150
|
+
:'max_value' => :'MaxValue',
|
151
|
+
:'minor_grid_lines' => :'MinorGridLines',
|
152
|
+
:'minor_tick_mark' => :'MinorTickMark',
|
153
|
+
:'minor_unit' => :'MinorUnit',
|
154
|
+
:'minor_unit_scale' => :'MinorUnitScale',
|
155
|
+
:'min_value' => :'MinValue',
|
156
|
+
:'tick_label_position' => :'TickLabelPosition',
|
157
|
+
:'tick_labels' => :'TickLabels',
|
158
|
+
:'tick_label_spacing' => :'TickLabelSpacing',
|
159
|
+
:'tick_mark_spacing' => :'TickMarkSpacing',
|
160
|
+
:'title' => :'Title'
|
161
|
+
}
|
162
|
+
end
|
163
|
+
|
164
|
+
# Attribute type mapping.
|
165
|
+
def self.swagger_types
|
166
|
+
{
|
167
|
+
:'area' => :'Area',
|
168
|
+
:'axis_between_categories' => :'BOOLEAN',
|
169
|
+
:'axis_line' => :'Area',
|
170
|
+
:'base_unit_scale' => :'String',
|
171
|
+
:'category_type' => :'String',
|
172
|
+
:'cross_at' => :'Float',
|
173
|
+
:'cross_type' => :'String',
|
174
|
+
:'display_unit' => :'String',
|
175
|
+
:'has_multi_level_labels' => :'BOOLEAN',
|
176
|
+
:'is_automatic_max_value' => :'BOOLEAN',
|
177
|
+
:'is_automatic_minor_unit' => :'BOOLEAN',
|
178
|
+
:'is_automatic_min_value' => :'BOOLEAN',
|
179
|
+
:'is_display_unit_label_shown' => :'BOOLEAN',
|
180
|
+
:'is_automatic_major_unit' => :'BOOLEAN',
|
181
|
+
:'is_logarithmic' => :'BOOLEAN',
|
182
|
+
:'is_plot_order_reversed' => :'BOOLEAN',
|
183
|
+
:'is_visible' => :'BOOLEAN',
|
184
|
+
:'log_base' => :'Float',
|
185
|
+
:'major_grid_lines' => :'Line',
|
186
|
+
:'major_tick_mark' => :'String',
|
187
|
+
:'major_unit' => :'Float',
|
188
|
+
:'major_unit_scale' => :'String',
|
189
|
+
:'max_value' => :'Float',
|
190
|
+
:'minor_grid_lines' => :'Line',
|
191
|
+
:'minor_tick_mark' => :'String',
|
192
|
+
:'minor_unit' => :'Float',
|
193
|
+
:'minor_unit_scale' => :'String',
|
194
|
+
:'min_value' => :'Float',
|
195
|
+
:'tick_label_position' => :'String',
|
196
|
+
:'tick_labels' => :'TickLabels',
|
197
|
+
:'tick_label_spacing' => :'Integer',
|
198
|
+
:'tick_mark_spacing' => :'Integer',
|
199
|
+
:'title' => :'Title'
|
200
|
+
}
|
201
|
+
end
|
202
|
+
|
203
|
+
# Initializes the object
|
204
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
205
|
+
def initialize(attributes = {})
|
206
|
+
return unless attributes.is_a?(Hash)
|
207
|
+
|
208
|
+
# convert string to symbol for hash key
|
209
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
210
|
+
|
211
|
+
if attributes.has_key?(:'Area')
|
212
|
+
self.area = attributes[:'Area']
|
213
|
+
end
|
214
|
+
|
215
|
+
if attributes.has_key?(:'AxisBetweenCategories')
|
216
|
+
self.axis_between_categories = attributes[:'AxisBetweenCategories']
|
217
|
+
end
|
218
|
+
|
219
|
+
if attributes.has_key?(:'AxisLine')
|
220
|
+
self.axis_line = attributes[:'AxisLine']
|
221
|
+
end
|
222
|
+
|
223
|
+
if attributes.has_key?(:'BaseUnitScale')
|
224
|
+
self.base_unit_scale = attributes[:'BaseUnitScale']
|
225
|
+
end
|
226
|
+
|
227
|
+
if attributes.has_key?(:'CategoryType')
|
228
|
+
self.category_type = attributes[:'CategoryType']
|
229
|
+
end
|
230
|
+
|
231
|
+
if attributes.has_key?(:'CrossAt')
|
232
|
+
self.cross_at = attributes[:'CrossAt']
|
233
|
+
end
|
234
|
+
|
235
|
+
if attributes.has_key?(:'CrossType')
|
236
|
+
self.cross_type = attributes[:'CrossType']
|
237
|
+
end
|
238
|
+
|
239
|
+
if attributes.has_key?(:'DisplayUnit')
|
240
|
+
self.display_unit = attributes[:'DisplayUnit']
|
241
|
+
end
|
242
|
+
|
243
|
+
if attributes.has_key?(:'HasMultiLevelLabels')
|
244
|
+
self.has_multi_level_labels = attributes[:'HasMultiLevelLabels']
|
245
|
+
end
|
246
|
+
|
247
|
+
if attributes.has_key?(:'IsAutomaticMaxValue')
|
248
|
+
self.is_automatic_max_value = attributes[:'IsAutomaticMaxValue']
|
249
|
+
end
|
250
|
+
|
251
|
+
if attributes.has_key?(:'IsAutomaticMinorUnit')
|
252
|
+
self.is_automatic_minor_unit = attributes[:'IsAutomaticMinorUnit']
|
253
|
+
end
|
254
|
+
|
255
|
+
if attributes.has_key?(:'IsAutomaticMinValue')
|
256
|
+
self.is_automatic_min_value = attributes[:'IsAutomaticMinValue']
|
257
|
+
end
|
258
|
+
|
259
|
+
if attributes.has_key?(:'IsDisplayUnitLabelShown')
|
260
|
+
self.is_display_unit_label_shown = attributes[:'IsDisplayUnitLabelShown']
|
261
|
+
end
|
262
|
+
|
263
|
+
if attributes.has_key?(:'IsAutomaticMajorUnit')
|
264
|
+
self.is_automatic_major_unit = attributes[:'IsAutomaticMajorUnit']
|
265
|
+
end
|
266
|
+
|
267
|
+
if attributes.has_key?(:'IsLogarithmic')
|
268
|
+
self.is_logarithmic = attributes[:'IsLogarithmic']
|
269
|
+
end
|
270
|
+
|
271
|
+
if attributes.has_key?(:'IsPlotOrderReversed')
|
272
|
+
self.is_plot_order_reversed = attributes[:'IsPlotOrderReversed']
|
273
|
+
end
|
274
|
+
|
275
|
+
if attributes.has_key?(:'IsVisible')
|
276
|
+
self.is_visible = attributes[:'IsVisible']
|
277
|
+
end
|
278
|
+
|
279
|
+
if attributes.has_key?(:'LogBase')
|
280
|
+
self.log_base = attributes[:'LogBase']
|
281
|
+
end
|
282
|
+
|
283
|
+
if attributes.has_key?(:'MajorGridLines')
|
284
|
+
self.major_grid_lines = attributes[:'MajorGridLines']
|
285
|
+
end
|
286
|
+
|
287
|
+
if attributes.has_key?(:'MajorTickMark')
|
288
|
+
self.major_tick_mark = attributes[:'MajorTickMark']
|
289
|
+
end
|
290
|
+
|
291
|
+
if attributes.has_key?(:'MajorUnit')
|
292
|
+
self.major_unit = attributes[:'MajorUnit']
|
293
|
+
end
|
294
|
+
|
295
|
+
if attributes.has_key?(:'MajorUnitScale')
|
296
|
+
self.major_unit_scale = attributes[:'MajorUnitScale']
|
297
|
+
end
|
298
|
+
|
299
|
+
if attributes.has_key?(:'MaxValue')
|
300
|
+
self.max_value = attributes[:'MaxValue']
|
301
|
+
end
|
302
|
+
|
303
|
+
if attributes.has_key?(:'MinorGridLines')
|
304
|
+
self.minor_grid_lines = attributes[:'MinorGridLines']
|
305
|
+
end
|
306
|
+
|
307
|
+
if attributes.has_key?(:'MinorTickMark')
|
308
|
+
self.minor_tick_mark = attributes[:'MinorTickMark']
|
309
|
+
end
|
310
|
+
|
311
|
+
if attributes.has_key?(:'MinorUnit')
|
312
|
+
self.minor_unit = attributes[:'MinorUnit']
|
313
|
+
end
|
314
|
+
|
315
|
+
if attributes.has_key?(:'MinorUnitScale')
|
316
|
+
self.minor_unit_scale = attributes[:'MinorUnitScale']
|
317
|
+
end
|
318
|
+
|
319
|
+
if attributes.has_key?(:'MinValue')
|
320
|
+
self.min_value = attributes[:'MinValue']
|
321
|
+
end
|
322
|
+
|
323
|
+
if attributes.has_key?(:'TickLabelPosition')
|
324
|
+
self.tick_label_position = attributes[:'TickLabelPosition']
|
325
|
+
end
|
326
|
+
|
327
|
+
if attributes.has_key?(:'TickLabels')
|
328
|
+
self.tick_labels = attributes[:'TickLabels']
|
329
|
+
end
|
330
|
+
|
331
|
+
if attributes.has_key?(:'TickLabelSpacing')
|
332
|
+
self.tick_label_spacing = attributes[:'TickLabelSpacing']
|
333
|
+
end
|
334
|
+
|
335
|
+
if attributes.has_key?(:'TickMarkSpacing')
|
336
|
+
self.tick_mark_spacing = attributes[:'TickMarkSpacing']
|
337
|
+
end
|
338
|
+
|
339
|
+
if attributes.has_key?(:'Title')
|
340
|
+
self.title = attributes[:'Title']
|
341
|
+
end
|
342
|
+
|
343
|
+
end
|
344
|
+
|
345
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
346
|
+
# @return Array for valid properies with the reasons
|
347
|
+
def list_invalid_properties
|
348
|
+
invalid_properties = Array.new
|
349
|
+
return invalid_properties
|
350
|
+
end
|
351
|
+
|
352
|
+
# Check to see if the all the properties in the model are valid
|
353
|
+
# @return true if the model is valid
|
354
|
+
def valid?
|
355
|
+
return true
|
356
|
+
end
|
357
|
+
|
358
|
+
# Checks equality by comparing each attribute.
|
359
|
+
# @param [Object] Object to be compared
|
360
|
+
def ==(o)
|
361
|
+
return true if self.equal?(o)
|
362
|
+
self.class == o.class &&
|
363
|
+
area == o.area &&
|
364
|
+
axis_between_categories == o.axis_between_categories &&
|
365
|
+
axis_line == o.axis_line &&
|
366
|
+
base_unit_scale == o.base_unit_scale &&
|
367
|
+
category_type == o.category_type &&
|
368
|
+
cross_at == o.cross_at &&
|
369
|
+
cross_type == o.cross_type &&
|
370
|
+
display_unit == o.display_unit &&
|
371
|
+
has_multi_level_labels == o.has_multi_level_labels &&
|
372
|
+
is_automatic_max_value == o.is_automatic_max_value &&
|
373
|
+
is_automatic_minor_unit == o.is_automatic_minor_unit &&
|
374
|
+
is_automatic_min_value == o.is_automatic_min_value &&
|
375
|
+
is_display_unit_label_shown == o.is_display_unit_label_shown &&
|
376
|
+
is_automatic_major_unit == o.is_automatic_major_unit &&
|
377
|
+
is_logarithmic == o.is_logarithmic &&
|
378
|
+
is_plot_order_reversed == o.is_plot_order_reversed &&
|
379
|
+
is_visible == o.is_visible &&
|
380
|
+
log_base == o.log_base &&
|
381
|
+
major_grid_lines == o.major_grid_lines &&
|
382
|
+
major_tick_mark == o.major_tick_mark &&
|
383
|
+
major_unit == o.major_unit &&
|
384
|
+
major_unit_scale == o.major_unit_scale &&
|
385
|
+
max_value == o.max_value &&
|
386
|
+
minor_grid_lines == o.minor_grid_lines &&
|
387
|
+
minor_tick_mark == o.minor_tick_mark &&
|
388
|
+
minor_unit == o.minor_unit &&
|
389
|
+
minor_unit_scale == o.minor_unit_scale &&
|
390
|
+
min_value == o.min_value &&
|
391
|
+
tick_label_position == o.tick_label_position &&
|
392
|
+
tick_labels == o.tick_labels &&
|
393
|
+
tick_label_spacing == o.tick_label_spacing &&
|
394
|
+
tick_mark_spacing == o.tick_mark_spacing &&
|
395
|
+
title == o.title
|
396
|
+
end
|
397
|
+
|
398
|
+
# @see the `==` method
|
399
|
+
# @param [Object] Object to be compared
|
400
|
+
def eql?(o)
|
401
|
+
self == o
|
402
|
+
end
|
403
|
+
|
404
|
+
# Calculates hash code according to all attributes.
|
405
|
+
# @return [Fixnum] Hash code
|
406
|
+
def hash
|
407
|
+
[area, axis_between_categories, axis_line, base_unit_scale, category_type, cross_at, cross_type, display_unit, has_multi_level_labels, is_automatic_max_value, is_automatic_minor_unit, is_automatic_min_value, is_display_unit_label_shown, is_automatic_major_unit, is_logarithmic, is_plot_order_reversed, is_visible, log_base, major_grid_lines, major_tick_mark, major_unit, major_unit_scale, max_value, minor_grid_lines, minor_tick_mark, minor_unit, minor_unit_scale, min_value, tick_label_position, tick_labels, tick_label_spacing, tick_mark_spacing, title].hash
|
408
|
+
end
|
409
|
+
|
410
|
+
# Builds the object from hash
|
411
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
412
|
+
# @return [Object] Returns the model itself
|
413
|
+
def build_from_hash(attributes)
|
414
|
+
return nil unless attributes.is_a?(Hash)
|
415
|
+
self.class.swagger_types.each_pair do |key, type|
|
416
|
+
if type =~ /\AArray<(.*)>/i
|
417
|
+
# check to ensure the input is an array given that the the attribute
|
418
|
+
# is documented as an array but the input is not
|
419
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
420
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
421
|
+
end
|
422
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
423
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
424
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
425
|
+
end
|
426
|
+
|
427
|
+
self
|
428
|
+
end
|
429
|
+
|
430
|
+
# Deserializes the data based on type
|
431
|
+
# @param string type Data type
|
432
|
+
# @param string value Value to be deserialized
|
433
|
+
# @return [Object] Deserialized data
|
434
|
+
def _deserialize(type, value)
|
435
|
+
case type.to_sym
|
436
|
+
when :DateTime
|
437
|
+
DateTime.parse(value)
|
438
|
+
when :Date
|
439
|
+
Date.parse(value)
|
440
|
+
when :String
|
441
|
+
value.to_s
|
442
|
+
when :Integer
|
443
|
+
value.to_i
|
444
|
+
when :Float
|
445
|
+
value.to_f
|
446
|
+
when :BOOLEAN
|
447
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
448
|
+
true
|
449
|
+
else
|
450
|
+
false
|
451
|
+
end
|
452
|
+
when :Object
|
453
|
+
# generic object (usually a Hash), return directly
|
454
|
+
value
|
455
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
456
|
+
inner_type = Regexp.last_match[:inner_type]
|
457
|
+
value.map { |v| _deserialize(inner_type, v) }
|
458
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
459
|
+
k_type = Regexp.last_match[:k_type]
|
460
|
+
v_type = Regexp.last_match[:v_type]
|
461
|
+
{}.tap do |hash|
|
462
|
+
value.each do |k, v|
|
463
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
464
|
+
end
|
465
|
+
end
|
466
|
+
else # model
|
467
|
+
temp_model = AsposeCellsCloud.const_get(type).new
|
468
|
+
temp_model.build_from_hash(value)
|
469
|
+
end
|
470
|
+
end
|
471
|
+
|
472
|
+
# Returns the string representation of the object
|
473
|
+
# @return [String] String presentation of the object
|
474
|
+
def to_s
|
475
|
+
to_hash.to_s
|
476
|
+
end
|
477
|
+
|
478
|
+
# to_body is an alias to to_hash (backward compatibility)
|
479
|
+
# @return [Hash] Returns the object in the form of hash
|
480
|
+
def to_body
|
481
|
+
to_hash
|
482
|
+
end
|
483
|
+
|
484
|
+
# Returns the object in the form of hash
|
485
|
+
# @return [Hash] Returns the object in the form of hash
|
486
|
+
def to_hash
|
487
|
+
hash = {}
|
488
|
+
self.class.attribute_map.each_pair do |attr, param|
|
489
|
+
value = self.send(attr)
|
490
|
+
next if value.nil?
|
491
|
+
hash[param] = _to_hash(value)
|
492
|
+
end
|
493
|
+
hash
|
494
|
+
end
|
495
|
+
|
496
|
+
# Outputs non-array value in the form of hash
|
497
|
+
# For object, use to_hash. Otherwise, just return the value
|
498
|
+
# @param [Object] value Any valid value
|
499
|
+
# @return [Hash] Returns the value in the form of hash
|
500
|
+
def _to_hash(value)
|
501
|
+
if value.is_a?(Array)
|
502
|
+
value.compact.map{ |v| _to_hash(v) }
|
503
|
+
elsif value.is_a?(Hash)
|
504
|
+
{}.tap do |hash|
|
505
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
506
|
+
end
|
507
|
+
elsif value.respond_to? :to_hash
|
508
|
+
value.to_hash
|
509
|
+
else
|
510
|
+
value
|
511
|
+
end
|
512
|
+
end
|
513
|
+
|
514
|
+
end
|
515
|
+
|
516
|
+
end
|