aspose_cells_cloud 23.8 → 23.9

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 (28) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -4
  3. data/lib/aspose_cells_cloud/api/cells_api.rb +23 -0
  4. data/lib/aspose_cells_cloud/models/abstract_calculation_engine.rb +234 -0
  5. data/lib/aspose_cells_cloud/models/{barcode_response.rb → abstract_calculation_monitor.rb} +33 -45
  6. data/lib/aspose_cells_cloud/models/auto_fitter_options.rb +64 -4
  7. data/lib/aspose_cells_cloud/models/calculation_options.rb +40 -4
  8. data/lib/aspose_cells_cloud/models/{barcode_response_list.rb → chart_globalization_settings.rb} +2 -2
  9. data/lib/aspose_cells_cloud/models/formula_settings.rb +330 -0
  10. data/lib/aspose_cells_cloud/models/globalization_settings.rb +258 -0
  11. data/lib/aspose_cells_cloud/models/list_column.rb +16 -4
  12. data/lib/aspose_cells_cloud/models/list_object.rb +73 -1
  13. data/lib/aspose_cells_cloud/models/pivot_globalization_settings.rb +198 -0
  14. data/lib/aspose_cells_cloud/models/query_table.rb +258 -0
  15. data/lib/aspose_cells_cloud/models/range_sort_request.rb +222 -0
  16. data/lib/aspose_cells_cloud/models/workbook_settings.rb +220 -4
  17. data/lib/aspose_cells_cloud/models/write_protection.rb +246 -0
  18. data/lib/aspose_cells_cloud/models/xml_data_binding.rb +210 -0
  19. data/lib/aspose_cells_cloud/models/xml_map.rb +234 -0
  20. data/lib/aspose_cells_cloud/requests/post_worksheet_cells_range_sort_request.rb +138 -0
  21. data/lib/aspose_cells_cloud/requests/post_worksheet_list_object_insert_slicer_request.rb +159 -0
  22. data/lib/aspose_cells_cloud/requests/post_worksheet_list_object_remove_duplicates_request.rb +137 -0
  23. data/lib/aspose_cells_cloud/version.rb +1 -1
  24. data/lib/aspose_cells_cloud.rb +14 -2
  25. data/spec/api/list_objects_controller_spec.rb +35 -0
  26. data/spec/api/ranges_controller_spec.rb +20 -0
  27. data/spec/one_case_spec.rb +27 -0
  28. metadata +17 -4
@@ -62,6 +62,18 @@ module AsposeCellsCloud
62
62
  #
63
63
  attr_accessor :table_style_type
64
64
  #
65
+ attr_accessor :data_range
66
+ #
67
+ attr_accessor :data_source_type
68
+ #
69
+ attr_accessor :comment
70
+ #
71
+ attr_accessor :xml_map
72
+ #
73
+ attr_accessor :alternative_text
74
+ #
75
+ attr_accessor :alternative_description
76
+ #
65
77
  attr_accessor :link
66
78
 
67
79
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -82,6 +94,12 @@ module AsposeCellsCloud
82
94
  :'show_totals' => :'ShowTotals',
83
95
  :'table_style_name' => :'TableStyleName',
84
96
  :'table_style_type' => :'TableStyleType',
97
+ :'data_range' => :'DataRange',
98
+ :'data_source_type' => :'DataSourceType',
99
+ :'comment' => :'Comment',
100
+ :'xml_map' => :'XmlMap',
101
+ :'alternative_text' => :'AlternativeText',
102
+ :'alternative_description' => :'AlternativeDescription',
85
103
  :'link' => :'link'
86
104
  }
87
105
  end
@@ -104,6 +122,12 @@ module AsposeCellsCloud
104
122
  :'show_totals' => :'BOOLEAN',
105
123
  :'table_style_name' => :'String',
106
124
  :'table_style_type' => :'String',
125
+ :'data_range' => :'Range',
126
+ :'data_source_type' => :'String',
127
+ :'comment' => :'String',
128
+ :'xml_map' => :'XmlMap',
129
+ :'alternative_text' => :'String',
130
+ :'alternative_description' => :'String',
107
131
  :'link' => :'Link'
108
132
  }
109
133
  end
@@ -161,6 +185,24 @@ module AsposeCellsCloud
161
185
  if attributes.has_key?(:'TableStyleType')
162
186
  self.table_style_type = attributes[:'TableStyleType']
163
187
  end
188
+ if attributes.has_key?(:'DataRange')
189
+ self.data_range = attributes[:'DataRange']
190
+ end
191
+ if attributes.has_key?(:'DataSourceType')
192
+ self.data_source_type = attributes[:'DataSourceType']
193
+ end
194
+ if attributes.has_key?(:'Comment')
195
+ self.comment = attributes[:'Comment']
196
+ end
197
+ if attributes.has_key?(:'XmlMap')
198
+ self.xml_map = attributes[:'XmlMap']
199
+ end
200
+ if attributes.has_key?(:'AlternativeText')
201
+ self.alternative_text = attributes[:'AlternativeText']
202
+ end
203
+ if attributes.has_key?(:'AlternativeDescription')
204
+ self.alternative_description = attributes[:'AlternativeDescription']
205
+ end
164
206
  if attributes.has_key?(:'link')
165
207
  self.link = attributes[:'link']
166
208
  end
@@ -216,6 +258,24 @@ module AsposeCellsCloud
216
258
  if @table_style_type.nil?
217
259
  invalid_properties.push("invalid value for 'table_style_type', table_style_type cannot be nil.")
218
260
  end
261
+ if @data_range.nil?
262
+ invalid_properties.push("invalid value for 'data_range', data_range cannot be nil.")
263
+ end
264
+ if @data_source_type.nil?
265
+ invalid_properties.push("invalid value for 'data_source_type', data_source_type cannot be nil.")
266
+ end
267
+ if @comment.nil?
268
+ invalid_properties.push("invalid value for 'comment', comment cannot be nil.")
269
+ end
270
+ if @xml_map.nil?
271
+ invalid_properties.push("invalid value for 'xml_map', xml_map cannot be nil.")
272
+ end
273
+ if @alternative_text.nil?
274
+ invalid_properties.push("invalid value for 'alternative_text', alternative_text cannot be nil.")
275
+ end
276
+ if @alternative_description.nil?
277
+ invalid_properties.push("invalid value for 'alternative_description', alternative_description cannot be nil.")
278
+ end
219
279
  if @link.nil?
220
280
  invalid_properties.push("invalid value for 'link', link cannot be nil.")
221
281
  end
@@ -241,6 +301,12 @@ module AsposeCellsCloud
241
301
  return false if @show_totals.nil?
242
302
  return false if @table_style_name.nil?
243
303
  return false if @table_style_type.nil?
304
+ return false if @data_range.nil?
305
+ return false if @data_source_type.nil?
306
+ return false if @comment.nil?
307
+ return false if @xml_map.nil?
308
+ return false if @alternative_text.nil?
309
+ return false if @alternative_description.nil?
244
310
  return false if @link.nil?
245
311
  return true
246
312
  end
@@ -265,6 +331,12 @@ module AsposeCellsCloud
265
331
  show_totals == o.show_totals &&
266
332
  table_style_name == o.table_style_name &&
267
333
  table_style_type == o.table_style_type &&
334
+ data_range == o.data_range &&
335
+ data_source_type == o.data_source_type &&
336
+ comment == o.comment &&
337
+ xml_map == o.xml_map &&
338
+ alternative_text == o.alternative_text &&
339
+ alternative_description == o.alternative_description &&
268
340
  link == o.link
269
341
  std_dev == o.std_dev
270
342
  end
@@ -278,7 +350,7 @@ module AsposeCellsCloud
278
350
  # Calculates hash code according to all attributes.
279
351
  # @return [Fixnum] Hash code
280
352
  def hash
281
- [ auto_filter , display_name , start_column , start_row , end_column , end_row , list_columns , show_header_row , show_table_style_column_stripes , show_table_style_first_column , show_table_style_last_column , show_table_style_row_stripes , show_totals , table_style_name , table_style_type , link ].hash
353
+ [ auto_filter , display_name , start_column , start_row , end_column , end_row , list_columns , show_header_row , show_table_style_column_stripes , show_table_style_first_column , show_table_style_last_column , show_table_style_row_stripes , show_totals , table_style_name , table_style_type , data_range , data_source_type , comment , xml_map , alternative_text , alternative_description , link ].hash
282
354
  end
283
355
 
284
356
  # Builds the object from hash
@@ -0,0 +1,198 @@
1
+ =begin
2
+ --------------------------------------------------------------------------------------------------------------------
3
+ <copyright company="Aspose" file="PivotGlobalizationSettingsrb.cs">
4
+ Copyright (c) 2023 Aspose.Cells Cloud
5
+ </copyright>
6
+ <summary>
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
24
+ </summary>
25
+ --------------------------------------------------------------------------------------------------------------------
26
+ =end
27
+
28
+
29
+ require 'date'
30
+
31
+ module AsposeCellsCloud
32
+
33
+ class PivotGlobalizationSettings
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
+
56
+ end
57
+
58
+ # Show invalid properties with the reasons. Usually used together with valid?
59
+ # @return Array for valid properies with the reasons
60
+ def list_invalid_properties
61
+ invalid_properties = Array.new
62
+
63
+ return invalid_properties
64
+ end
65
+
66
+ # Check to see if the all the properties in the model are valid
67
+ # @return true if the model is valid
68
+ def valid?
69
+ return true
70
+ end
71
+
72
+ # Checks equality by comparing each attribute.
73
+ # @param [Object] Object to be compared
74
+ def ==(o)
75
+ return true if self.equal?(o)
76
+ self.class == o.class &&
77
+ std_dev == o.std_dev
78
+ end
79
+
80
+ # @see the `==` method
81
+ # @param [Object] Object to be compared
82
+ def eql?(o)
83
+ self == o
84
+ end
85
+
86
+ # Calculates hash code according to all attributes.
87
+ # @return [Fixnum] Hash code
88
+ def hash
89
+ [ ].hash
90
+ end
91
+
92
+ # Builds the object from hash
93
+ # @param [Hash] attributes Model attributes in the form of hash
94
+ # @return [Object] Returns the model itself
95
+ def build_from_hash(attributes)
96
+ return nil unless attributes.is_a?(Hash)
97
+ self.class.swagger_types.each_pair do |key, type|
98
+ if type =~ /\AArray<(.*)>/i
99
+ # check to ensure the input is an array given that the the attribute
100
+ # is documented as an array but the input is not
101
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
102
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
103
+ end
104
+ elsif !attributes[self.class.attribute_map[key]].nil?
105
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
106
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
107
+ end
108
+
109
+ self
110
+ end
111
+
112
+ # Deserializes the data based on type
113
+ # @param string type Data type
114
+ # @param string value Value to be deserialized
115
+ # @return [Object] Deserialized data
116
+ def _deserialize(type, value)
117
+ case type.to_sym
118
+ when :DateTime
119
+ DateTime.parse(value)
120
+ when :Date
121
+ Date.parse(value)
122
+ when :String
123
+ value.to_s
124
+ when :Integer
125
+ value.to_i
126
+ when :Float
127
+ value.to_f
128
+ when :BOOLEAN
129
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
130
+ true
131
+ else
132
+ false
133
+ end
134
+ when :Object
135
+ # generic object (usually a Hash), return directly
136
+ value
137
+ when /\AArray<(?<inner_type>.+)>\z/
138
+ inner_type = Regexp.last_match[:inner_type]
139
+ value.map { |v| _deserialize(inner_type, v) }
140
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
141
+ k_type = Regexp.last_match[:k_type]
142
+ v_type = Regexp.last_match[:v_type]
143
+ {}.tap do |hash|
144
+ value.each do |k, v|
145
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
146
+ end
147
+ end
148
+ else # model
149
+ temp_model = AsposeCellsCloud.const_get(type).new
150
+ temp_model.build_from_hash(value)
151
+ end
152
+ end
153
+
154
+ # Returns the string representation of the object
155
+ # @return [String] String presentation of the object
156
+ def to_s
157
+ to_hash.to_s
158
+ end
159
+
160
+ # to_body is an alias to to_hash (backward compatibility)
161
+ # @return [Hash] Returns the object in the form of hash
162
+ def to_body
163
+ to_hash
164
+ end
165
+
166
+ # Returns the object in the form of hash
167
+ # @return [Hash] Returns the object in the form of hash
168
+ def to_hash
169
+ hash = {}
170
+ self.class.attribute_map.each_pair do |attr, param|
171
+ value = self.send(attr)
172
+ next if value.nil?
173
+ hash[param] = _to_hash(value)
174
+ end
175
+ hash
176
+ end
177
+
178
+ # Outputs non-array value in the form of hash
179
+ # For object, use to_hash. Otherwise, just return the value
180
+ # @param [Object] value Any valid value
181
+ # @return [Hash] Returns the value in the form of hash
182
+ def _to_hash(value)
183
+ if value.is_a?(Array)
184
+ value.compact.map{ |v| _to_hash(v) }
185
+ elsif value.is_a?(Hash)
186
+ {}.tap do |hash|
187
+ value.each { |k, v| hash[k] = _to_hash(v) }
188
+ end
189
+ elsif value.respond_to? :to_hash
190
+ value.to_hash
191
+ else
192
+ value
193
+ end
194
+ end
195
+
196
+ end
197
+
198
+ end
@@ -0,0 +1,258 @@
1
+ =begin
2
+ --------------------------------------------------------------------------------------------------------------------
3
+ <copyright company="Aspose" file="QueryTablerb.cs">
4
+ Copyright (c) 2023 Aspose.Cells Cloud
5
+ </copyright>
6
+ <summary>
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
24
+ </summary>
25
+ --------------------------------------------------------------------------------------------------------------------
26
+ =end
27
+
28
+
29
+ require 'date'
30
+
31
+ module AsposeCellsCloud
32
+
33
+ class QueryTable
34
+ #
35
+ attr_accessor :connection_id
36
+ #
37
+ attr_accessor :name
38
+ #
39
+ attr_accessor :result_range
40
+ #
41
+ attr_accessor :preserve_formatting
42
+ #
43
+ attr_accessor :adjust_column_width
44
+
45
+ # Attribute mapping from ruby-style variable name to JSON key.
46
+ def self.attribute_map
47
+ {
48
+ :'connection_id' => :'ConnectionId',
49
+ :'name' => :'Name',
50
+ :'result_range' => :'ResultRange',
51
+ :'preserve_formatting' => :'PreserveFormatting',
52
+ :'adjust_column_width' => :'AdjustColumnWidth'
53
+ }
54
+ end
55
+
56
+ # Attribute type mapping.
57
+ def self.swagger_types
58
+ {
59
+ :'connection_id' => :'Integer',
60
+ :'name' => :'String',
61
+ :'result_range' => :'Range',
62
+ :'preserve_formatting' => :'BOOLEAN',
63
+ :'adjust_column_width' => :'BOOLEAN'
64
+ }
65
+ end
66
+
67
+ # Initializes the object
68
+ # @param [Hash] attributes Model attributes in the form of hash
69
+ def initialize(attributes = {})
70
+ return unless attributes.is_a?(Hash)
71
+
72
+ # convert string to symbol for hash key
73
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
74
+
75
+ if attributes.has_key?(:'ConnectionId')
76
+ self.connection_id = attributes[:'ConnectionId']
77
+ end
78
+ if attributes.has_key?(:'Name')
79
+ self.name = attributes[:'Name']
80
+ end
81
+ if attributes.has_key?(:'ResultRange')
82
+ self.result_range = attributes[:'ResultRange']
83
+ end
84
+ if attributes.has_key?(:'PreserveFormatting')
85
+ self.preserve_formatting = attributes[:'PreserveFormatting']
86
+ end
87
+ if attributes.has_key?(:'AdjustColumnWidth')
88
+ self.adjust_column_width = attributes[:'AdjustColumnWidth']
89
+ end
90
+
91
+ end
92
+
93
+ # Show invalid properties with the reasons. Usually used together with valid?
94
+ # @return Array for valid properies with the reasons
95
+ def list_invalid_properties
96
+ invalid_properties = Array.new
97
+ if @connection_id.nil?
98
+ invalid_properties.push("invalid value for 'connection_id', connection_id cannot be nil.")
99
+ end
100
+ if @name.nil?
101
+ invalid_properties.push("invalid value for 'name', name cannot be nil.")
102
+ end
103
+ if @result_range.nil?
104
+ invalid_properties.push("invalid value for 'result_range', result_range cannot be nil.")
105
+ end
106
+ if @preserve_formatting.nil?
107
+ invalid_properties.push("invalid value for 'preserve_formatting', preserve_formatting cannot be nil.")
108
+ end
109
+ if @adjust_column_width.nil?
110
+ invalid_properties.push("invalid value for 'adjust_column_width', adjust_column_width cannot be nil.")
111
+ end
112
+
113
+ return invalid_properties
114
+ end
115
+
116
+ # Check to see if the all the properties in the model are valid
117
+ # @return true if the model is valid
118
+ def valid?
119
+ return false if @connection_id.nil?
120
+ return false if @name.nil?
121
+ return false if @result_range.nil?
122
+ return false if @preserve_formatting.nil?
123
+ return false if @adjust_column_width.nil?
124
+ return true
125
+ end
126
+
127
+ # Checks equality by comparing each attribute.
128
+ # @param [Object] Object to be compared
129
+ def ==(o)
130
+ return true if self.equal?(o)
131
+ self.class == o.class &&
132
+ connection_id == o.connection_id &&
133
+ name == o.name &&
134
+ result_range == o.result_range &&
135
+ preserve_formatting == o.preserve_formatting &&
136
+ adjust_column_width == o.adjust_column_width
137
+ std_dev == o.std_dev
138
+ end
139
+
140
+ # @see the `==` method
141
+ # @param [Object] Object to be compared
142
+ def eql?(o)
143
+ self == o
144
+ end
145
+
146
+ # Calculates hash code according to all attributes.
147
+ # @return [Fixnum] Hash code
148
+ def hash
149
+ [ connection_id , name , result_range , preserve_formatting , adjust_column_width ].hash
150
+ end
151
+
152
+ # Builds the object from hash
153
+ # @param [Hash] attributes Model attributes in the form of hash
154
+ # @return [Object] Returns the model itself
155
+ def build_from_hash(attributes)
156
+ return nil unless attributes.is_a?(Hash)
157
+ self.class.swagger_types.each_pair do |key, type|
158
+ if type =~ /\AArray<(.*)>/i
159
+ # check to ensure the input is an array given that the the attribute
160
+ # is documented as an array but the input is not
161
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
162
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
163
+ end
164
+ elsif !attributes[self.class.attribute_map[key]].nil?
165
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
166
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
167
+ end
168
+
169
+ self
170
+ end
171
+
172
+ # Deserializes the data based on type
173
+ # @param string type Data type
174
+ # @param string value Value to be deserialized
175
+ # @return [Object] Deserialized data
176
+ def _deserialize(type, value)
177
+ case type.to_sym
178
+ when :DateTime
179
+ DateTime.parse(value)
180
+ when :Date
181
+ Date.parse(value)
182
+ when :String
183
+ value.to_s
184
+ when :Integer
185
+ value.to_i
186
+ when :Float
187
+ value.to_f
188
+ when :BOOLEAN
189
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
190
+ true
191
+ else
192
+ false
193
+ end
194
+ when :Object
195
+ # generic object (usually a Hash), return directly
196
+ value
197
+ when /\AArray<(?<inner_type>.+)>\z/
198
+ inner_type = Regexp.last_match[:inner_type]
199
+ value.map { |v| _deserialize(inner_type, v) }
200
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
201
+ k_type = Regexp.last_match[:k_type]
202
+ v_type = Regexp.last_match[:v_type]
203
+ {}.tap do |hash|
204
+ value.each do |k, v|
205
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
206
+ end
207
+ end
208
+ else # model
209
+ temp_model = AsposeCellsCloud.const_get(type).new
210
+ temp_model.build_from_hash(value)
211
+ end
212
+ end
213
+
214
+ # Returns the string representation of the object
215
+ # @return [String] String presentation of the object
216
+ def to_s
217
+ to_hash.to_s
218
+ end
219
+
220
+ # to_body is an alias to to_hash (backward compatibility)
221
+ # @return [Hash] Returns the object in the form of hash
222
+ def to_body
223
+ to_hash
224
+ end
225
+
226
+ # Returns the object in the form of hash
227
+ # @return [Hash] Returns the object in the form of hash
228
+ def to_hash
229
+ hash = {}
230
+ self.class.attribute_map.each_pair do |attr, param|
231
+ value = self.send(attr)
232
+ next if value.nil?
233
+ hash[param] = _to_hash(value)
234
+ end
235
+ hash
236
+ end
237
+
238
+ # Outputs non-array value in the form of hash
239
+ # For object, use to_hash. Otherwise, just return the value
240
+ # @param [Object] value Any valid value
241
+ # @return [Hash] Returns the value in the form of hash
242
+ def _to_hash(value)
243
+ if value.is_a?(Array)
244
+ value.compact.map{ |v| _to_hash(v) }
245
+ elsif value.is_a?(Hash)
246
+ {}.tap do |hash|
247
+ value.each { |k, v| hash[k] = _to_hash(v) }
248
+ end
249
+ elsif value.respond_to? :to_hash
250
+ value.to_hash
251
+ else
252
+ value
253
+ end
254
+ end
255
+
256
+ end
257
+
258
+ end