aspose_cells_cloud 25.2 → 25.4

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 (67) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +59 -62
  3. data/lib/aspose_cells_cloud/api/cells_api.rb +66 -0
  4. data/lib/aspose_cells_cloud/models/chart_points.rb +1 -1
  5. data/lib/aspose_cells_cloud/models/charts.rb +1 -1
  6. data/lib/aspose_cells_cloud/models/check_external_reference_options.rb +258 -0
  7. data/lib/aspose_cells_cloud/models/check_formula_error_options.rb +258 -0
  8. data/lib/aspose_cells_cloud/models/checked_external_reference_response.rb +258 -0
  9. data/lib/aspose_cells_cloud/models/checked_formula_errors_response.rb +246 -0
  10. data/lib/aspose_cells_cloud/models/convert_workbook_options.rb +282 -0
  11. data/lib/aspose_cells_cloud/models/data_cleansing.rb +1 -1
  12. data/lib/aspose_cells_cloud/models/dif_save_options.rb +64 -4
  13. data/lib/aspose_cells_cloud/models/docx_save_options.rb +28 -4
  14. data/lib/aspose_cells_cloud/models/files_result.rb +1 -1
  15. data/lib/aspose_cells_cloud/models/html_save_options.rb +64 -4
  16. data/lib/aspose_cells_cloud/models/image_save_options.rb +64 -4
  17. data/lib/aspose_cells_cloud/models/json_save_options.rb +64 -4
  18. data/lib/aspose_cells_cloud/models/m_html_save_options.rb +392 -8
  19. data/lib/aspose_cells_cloud/models/markdown_save_options.rb +64 -4
  20. data/lib/aspose_cells_cloud/models/ods_save_options.rb +100 -4
  21. data/lib/aspose_cells_cloud/models/ooxml_save_options.rb +64 -4
  22. data/lib/aspose_cells_cloud/models/page_sections_response.rb +1 -1
  23. data/lib/aspose_cells_cloud/models/paginated_save_options.rb +28 -4
  24. data/lib/aspose_cells_cloud/models/pdf_save_options.rb +64 -4
  25. data/lib/aspose_cells_cloud/models/pptx_save_options.rb +28 -4
  26. data/lib/aspose_cells_cloud/models/save_files_to_cloud_result.rb +1 -1
  27. data/lib/aspose_cells_cloud/models/save_options.rb +64 -4
  28. data/lib/aspose_cells_cloud/models/shapes.rb +1 -1
  29. data/lib/aspose_cells_cloud/models/specify_cells_object.rb +234 -0
  30. data/lib/aspose_cells_cloud/models/spreadsheet_m_l2003_save_options.rb +64 -4
  31. data/lib/aspose_cells_cloud/models/sql_script_save_options.rb +64 -4
  32. data/lib/aspose_cells_cloud/models/styles.rb +1 -1
  33. data/lib/aspose_cells_cloud/models/styles_response.rb +234 -0
  34. data/lib/aspose_cells_cloud/models/svg_save_options.rb +208 -4
  35. data/lib/aspose_cells_cloud/models/txt_save_options.rb +64 -4
  36. data/lib/aspose_cells_cloud/models/workbook.rb +1 -1
  37. data/lib/aspose_cells_cloud/models/xls_save_options.rb +88 -4
  38. data/lib/aspose_cells_cloud/models/xlsb_save_options.rb +88 -4
  39. data/lib/aspose_cells_cloud/models/xps_save_options.rb +28 -4
  40. data/lib/aspose_cells_cloud/requests/add_picture_in_cell_request.rb +149 -0
  41. data/lib/aspose_cells_cloud/requests/check_workbook_formula_errors_request.rb +103 -0
  42. data/lib/aspose_cells_cloud/requests/check_wrokbook_external_reference_request.rb +103 -0
  43. data/lib/aspose_cells_cloud/requests/get_all_styles_request.rb +117 -0
  44. data/lib/aspose_cells_cloud/requests/get_workbook_request.rb +9 -2
  45. data/lib/aspose_cells_cloud/requests/post_convert_workbook_request.rb +111 -0
  46. data/lib/aspose_cells_cloud/requests/post_convert_workbook_to_docx_request.rb +9 -2
  47. data/lib/aspose_cells_cloud/requests/post_convert_workbook_to_html_request.rb +9 -2
  48. data/lib/aspose_cells_cloud/requests/post_convert_workbook_to_json_request.rb +9 -2
  49. data/lib/aspose_cells_cloud/requests/post_convert_workbook_to_markdown_request.rb +9 -2
  50. data/lib/aspose_cells_cloud/requests/post_convert_workbook_to_pdf_request.rb +9 -2
  51. data/lib/aspose_cells_cloud/requests/post_convert_workbook_to_pptx_request.rb +9 -2
  52. data/lib/aspose_cells_cloud/requests/post_convert_worksheet_to_image_request.rb +10 -2
  53. data/lib/aspose_cells_cloud/requests/post_export_request.rb +9 -2
  54. data/lib/aspose_cells_cloud/requests/post_import_data_request.rb +9 -2
  55. data/lib/aspose_cells_cloud/requests/post_workbook_save_as_request.rb +9 -2
  56. data/lib/aspose_cells_cloud/requests/post_worksheet_cells_range_to_image_request.rb +1 -1
  57. data/lib/aspose_cells_cloud/requests/put_convert_workbook_request.rb +13 -2
  58. data/lib/aspose_cells_cloud/version.rb +1 -1
  59. data/lib/aspose_cells_cloud.rb +12 -0
  60. data/spec/api/batch_controller_spec.rb +23 -0
  61. data/spec/api/pivot_tables_controller_spec.rb +1 -4
  62. data/spec/conversion/conversion_json_spec.rb +0 -22
  63. data/spec/conversion/conversion_png_spec.rb +0 -22
  64. data/spec/conversion/conversion_spec.rb +18 -104
  65. data/spec/document/light_cells_spec.rb +54 -428
  66. data/spec/spec_helper.rb +3 -3
  67. metadata +14 -2
@@ -0,0 +1,258 @@
1
+ =begin
2
+ --------------------------------------------------------------------------------------------------------------------
3
+ <copyright company="Aspose" file="CheckFormulaErrorOptionsrb.cs">
4
+ Copyright (c) 2025 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 CheckFormulaErrorOptions
34
+ #
35
+ attr_accessor :data_source
36
+ #
37
+ attr_accessor :file_info
38
+ #
39
+ attr_accessor :sheet_name
40
+ #
41
+ attr_accessor :chart_index
42
+ #
43
+ attr_accessor :names
44
+
45
+ # Attribute mapping from ruby-style variable name to JSON key.
46
+ def self.attribute_map
47
+ {
48
+ :'data_source' => :'DataSource',
49
+ :'file_info' => :'FileInfo',
50
+ :'sheet_name' => :'SheetName',
51
+ :'chart_index' => :'ChartIndex',
52
+ :'names' => :'Names'
53
+ }
54
+ end
55
+
56
+ # Attribute type mapping.
57
+ def self.swagger_types
58
+ {
59
+ :'data_source' => :'DataSource',
60
+ :'file_info' => :'FileInfo',
61
+ :'sheet_name' => :'String',
62
+ :'chart_index' => :'Integer',
63
+ :'names' => :'Array<String>'
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?(:'DataSource')
76
+ self.data_source = attributes[:'DataSource']
77
+ end
78
+ if attributes.has_key?(:'FileInfo')
79
+ self.file_info = attributes[:'FileInfo']
80
+ end
81
+ if attributes.has_key?(:'SheetName')
82
+ self.sheet_name = attributes[:'SheetName']
83
+ end
84
+ if attributes.has_key?(:'ChartIndex')
85
+ self.chart_index = attributes[:'ChartIndex']
86
+ end
87
+ if attributes.has_key?(:'Names')
88
+ self.names = attributes[:'Names']
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 @data_source.nil?
98
+ invalid_properties.push("invalid value for 'data_source', data_source cannot be nil.")
99
+ end
100
+ if @file_info.nil?
101
+ invalid_properties.push("invalid value for 'file_info', file_info cannot be nil.")
102
+ end
103
+ if @sheet_name.nil?
104
+ invalid_properties.push("invalid value for 'sheet_name', sheet_name cannot be nil.")
105
+ end
106
+ if @chart_index.nil?
107
+ invalid_properties.push("invalid value for 'chart_index', chart_index cannot be nil.")
108
+ end
109
+ if @names.nil?
110
+ invalid_properties.push("invalid value for 'names', names 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 @data_source.nil?
120
+ return false if @file_info.nil?
121
+ return false if @sheet_name.nil?
122
+ return false if @chart_index.nil?
123
+ return false if @names.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
+ data_source == o.data_source &&
133
+ file_info == o.file_info &&
134
+ sheet_name == o.sheet_name &&
135
+ chart_index == o.chart_index &&
136
+ names == o.names
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
+ [ data_source , file_info , sheet_name , chart_index , names ].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
@@ -0,0 +1,258 @@
1
+ =begin
2
+ --------------------------------------------------------------------------------------------------------------------
3
+ <copyright company="Aspose" file="CheckedExternalReferenceResponserb.cs">
4
+ Copyright (c) 2025 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 CheckedExternalReferenceResponse
34
+ #
35
+ attr_accessor :reference_other_workbook
36
+ #
37
+ attr_accessor :reference_other_worksheet
38
+ #
39
+ attr_accessor :formulas
40
+ #
41
+ attr_accessor :code
42
+ #
43
+ attr_accessor :status
44
+
45
+ # Attribute mapping from ruby-style variable name to JSON key.
46
+ def self.attribute_map
47
+ {
48
+ :'reference_other_workbook' => :'ReferenceOtherWorkbook',
49
+ :'reference_other_worksheet' => :'ReferenceOtherWorksheet',
50
+ :'formulas' => :'Formulas',
51
+ :'code' => :'Code',
52
+ :'status' => :'Status'
53
+ }
54
+ end
55
+
56
+ # Attribute type mapping.
57
+ def self.swagger_types
58
+ {
59
+ :'reference_other_workbook' => :'BOOLEAN',
60
+ :'reference_other_worksheet' => :'BOOLEAN',
61
+ :'formulas' => :'Array<String>',
62
+ :'code' => :'Integer',
63
+ :'status' => :'String'
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?(:'ReferenceOtherWorkbook')
76
+ self.reference_other_workbook = attributes[:'ReferenceOtherWorkbook']
77
+ end
78
+ if attributes.has_key?(:'ReferenceOtherWorksheet')
79
+ self.reference_other_worksheet = attributes[:'ReferenceOtherWorksheet']
80
+ end
81
+ if attributes.has_key?(:'Formulas')
82
+ self.formulas = attributes[:'Formulas']
83
+ end
84
+ if attributes.has_key?(:'Code')
85
+ self.code = attributes[:'Code']
86
+ end
87
+ if attributes.has_key?(:'Status')
88
+ self.status = attributes[:'Status']
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 @reference_other_workbook.nil?
98
+ invalid_properties.push("invalid value for 'reference_other_workbook', reference_other_workbook cannot be nil.")
99
+ end
100
+ if @reference_other_worksheet.nil?
101
+ invalid_properties.push("invalid value for 'reference_other_worksheet', reference_other_worksheet cannot be nil.")
102
+ end
103
+ if @formulas.nil?
104
+ invalid_properties.push("invalid value for 'formulas', formulas cannot be nil.")
105
+ end
106
+ if @code.nil?
107
+ invalid_properties.push("invalid value for 'code', code cannot be nil.")
108
+ end
109
+ if @status.nil?
110
+ invalid_properties.push("invalid value for 'status', status 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 @reference_other_workbook.nil?
120
+ return false if @reference_other_worksheet.nil?
121
+ return false if @formulas.nil?
122
+ return false if @code.nil?
123
+ return false if @status.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
+ reference_other_workbook == o.reference_other_workbook &&
133
+ reference_other_worksheet == o.reference_other_worksheet &&
134
+ formulas == o.formulas &&
135
+ code == o.code &&
136
+ status == o.status
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
+ [ reference_other_workbook , reference_other_worksheet , formulas , code , status ].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