aspose_cells_cloud 24.7 → 24.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -41,6 +41,8 @@ module AsposeCellsCloud
41
41
  attr_accessor :height
42
42
  #Indicates image width.
43
43
  attr_accessor :width
44
+ #
45
+ attr_accessor :image_adapt_option
44
46
 
45
47
  # Attribute mapping from ruby-style variable name to JSON key.
46
48
  def self.attribute_map
@@ -49,7 +51,8 @@ module AsposeCellsCloud
49
51
  :'font_name' => :'FontName',
50
52
  :'font_size' => :'FontSize',
51
53
  :'height' => :'Height',
52
- :'width' => :'Width'
54
+ :'width' => :'Width',
55
+ :'image_adapt_option' => :'ImageAdaptOption'
53
56
  }
54
57
  end
55
58
 
@@ -60,7 +63,8 @@ module AsposeCellsCloud
60
63
  :'font_name' => :'String',
61
64
  :'font_size' => :'Integer',
62
65
  :'height' => :'Integer',
63
- :'width' => :'Integer'
66
+ :'width' => :'Integer',
67
+ :'image_adapt_option' => :'String'
64
68
  }
65
69
  end
66
70
 
@@ -87,6 +91,9 @@ module AsposeCellsCloud
87
91
  if attributes.has_key?(:'Width')
88
92
  self.width = attributes[:'Width']
89
93
  end
94
+ if attributes.has_key?(:'ImageAdaptOption')
95
+ self.image_adapt_option = attributes[:'ImageAdaptOption']
96
+ end
90
97
 
91
98
  end
92
99
 
@@ -109,6 +116,9 @@ module AsposeCellsCloud
109
116
  if @width.nil?
110
117
  invalid_properties.push("invalid value for 'width', width cannot be nil.")
111
118
  end
119
+ if @image_adapt_option.nil?
120
+ invalid_properties.push("invalid value for 'image_adapt_option', image_adapt_option cannot be nil.")
121
+ end
112
122
 
113
123
  return invalid_properties
114
124
  end
@@ -121,6 +131,7 @@ module AsposeCellsCloud
121
131
  return false if @font_size.nil?
122
132
  return false if @height.nil?
123
133
  return false if @width.nil?
134
+ return false if @image_adapt_option.nil?
124
135
  return true
125
136
  end
126
137
 
@@ -133,7 +144,8 @@ module AsposeCellsCloud
133
144
  font_name == o.font_name &&
134
145
  font_size == o.font_size &&
135
146
  height == o.height &&
136
- width == o.width
147
+ width == o.width &&
148
+ image_adapt_option == o.image_adapt_option
137
149
  std_dev == o.std_dev
138
150
  end
139
151
 
@@ -146,7 +158,7 @@ module AsposeCellsCloud
146
158
  # Calculates hash code according to all attributes.
147
159
  # @return [Fixnum] Hash code
148
160
  def hash
149
- [ text , font_name , font_size , height , width ].hash
161
+ [ text , font_name , font_size , height , width , image_adapt_option ].hash
150
162
  end
151
163
 
152
164
  # Builds the object from hash
@@ -0,0 +1,318 @@
1
+ =begin
2
+ --------------------------------------------------------------------------------------------------------------------
3
+ <copyright company="Aspose" file="TrimContentOptionsrb.cs">
4
+ Copyright (c) 2024 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 TrimContentOptions
34
+ #
35
+ attr_accessor :data_source
36
+ #
37
+ attr_accessor :file_info
38
+ #
39
+ attr_accessor :trim_content
40
+ #
41
+ attr_accessor :trim_leading
42
+ #
43
+ attr_accessor :trim_trailing
44
+ #
45
+ attr_accessor :trim_space_between_word_to1
46
+ #
47
+ attr_accessor :trim_non_breaking_spaces
48
+ #
49
+ attr_accessor :remove_extra_line_breaks
50
+ #
51
+ attr_accessor :remove_all_line_breaks
52
+ #
53
+ attr_accessor :scope_options
54
+
55
+ # Attribute mapping from ruby-style variable name to JSON key.
56
+ def self.attribute_map
57
+ {
58
+ :'data_source' => :'DataSource',
59
+ :'file_info' => :'FileInfo',
60
+ :'trim_content' => :'TrimContent',
61
+ :'trim_leading' => :'TrimLeading',
62
+ :'trim_trailing' => :'TrimTrailing',
63
+ :'trim_space_between_word_to1' => :'TrimSpaceBetweenWordTo1',
64
+ :'trim_non_breaking_spaces' => :'TrimNonBreakingSpaces',
65
+ :'remove_extra_line_breaks' => :'RemoveExtraLineBreaks',
66
+ :'remove_all_line_breaks' => :'RemoveAllLineBreaks',
67
+ :'scope_options' => :'ScopeOptions'
68
+ }
69
+ end
70
+
71
+ # Attribute type mapping.
72
+ def self.swagger_types
73
+ {
74
+ :'data_source' => :'DataSource',
75
+ :'file_info' => :'FileInfo',
76
+ :'trim_content' => :'String',
77
+ :'trim_leading' => :'BOOLEAN',
78
+ :'trim_trailing' => :'BOOLEAN',
79
+ :'trim_space_between_word_to1' => :'BOOLEAN',
80
+ :'trim_non_breaking_spaces' => :'BOOLEAN',
81
+ :'remove_extra_line_breaks' => :'BOOLEAN',
82
+ :'remove_all_line_breaks' => :'BOOLEAN',
83
+ :'scope_options' => :'ScopeOptions'
84
+ }
85
+ end
86
+
87
+ # Initializes the object
88
+ # @param [Hash] attributes Model attributes in the form of hash
89
+ def initialize(attributes = {})
90
+ return unless attributes.is_a?(Hash)
91
+
92
+ # convert string to symbol for hash key
93
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
94
+
95
+ if attributes.has_key?(:'DataSource')
96
+ self.data_source = attributes[:'DataSource']
97
+ end
98
+ if attributes.has_key?(:'FileInfo')
99
+ self.file_info = attributes[:'FileInfo']
100
+ end
101
+ if attributes.has_key?(:'TrimContent')
102
+ self.trim_content = attributes[:'TrimContent']
103
+ end
104
+ if attributes.has_key?(:'TrimLeading')
105
+ self.trim_leading = attributes[:'TrimLeading']
106
+ end
107
+ if attributes.has_key?(:'TrimTrailing')
108
+ self.trim_trailing = attributes[:'TrimTrailing']
109
+ end
110
+ if attributes.has_key?(:'TrimSpaceBetweenWordTo1')
111
+ self.trim_space_between_word_to1 = attributes[:'TrimSpaceBetweenWordTo1']
112
+ end
113
+ if attributes.has_key?(:'TrimNonBreakingSpaces')
114
+ self.trim_non_breaking_spaces = attributes[:'TrimNonBreakingSpaces']
115
+ end
116
+ if attributes.has_key?(:'RemoveExtraLineBreaks')
117
+ self.remove_extra_line_breaks = attributes[:'RemoveExtraLineBreaks']
118
+ end
119
+ if attributes.has_key?(:'RemoveAllLineBreaks')
120
+ self.remove_all_line_breaks = attributes[:'RemoveAllLineBreaks']
121
+ end
122
+ if attributes.has_key?(:'ScopeOptions')
123
+ self.scope_options = attributes[:'ScopeOptions']
124
+ end
125
+
126
+ end
127
+
128
+ # Show invalid properties with the reasons. Usually used together with valid?
129
+ # @return Array for valid properies with the reasons
130
+ def list_invalid_properties
131
+ invalid_properties = Array.new
132
+ if @data_source.nil?
133
+ invalid_properties.push("invalid value for 'data_source', data_source cannot be nil.")
134
+ end
135
+ if @file_info.nil?
136
+ invalid_properties.push("invalid value for 'file_info', file_info cannot be nil.")
137
+ end
138
+ if @trim_content.nil?
139
+ invalid_properties.push("invalid value for 'trim_content', trim_content cannot be nil.")
140
+ end
141
+ if @trim_leading.nil?
142
+ invalid_properties.push("invalid value for 'trim_leading', trim_leading cannot be nil.")
143
+ end
144
+ if @trim_trailing.nil?
145
+ invalid_properties.push("invalid value for 'trim_trailing', trim_trailing cannot be nil.")
146
+ end
147
+ if @trim_space_between_word_to1.nil?
148
+ invalid_properties.push("invalid value for 'trim_space_between_word_to1', trim_space_between_word_to1 cannot be nil.")
149
+ end
150
+ if @trim_non_breaking_spaces.nil?
151
+ invalid_properties.push("invalid value for 'trim_non_breaking_spaces', trim_non_breaking_spaces cannot be nil.")
152
+ end
153
+ if @remove_extra_line_breaks.nil?
154
+ invalid_properties.push("invalid value for 'remove_extra_line_breaks', remove_extra_line_breaks cannot be nil.")
155
+ end
156
+ if @remove_all_line_breaks.nil?
157
+ invalid_properties.push("invalid value for 'remove_all_line_breaks', remove_all_line_breaks cannot be nil.")
158
+ end
159
+ if @scope_options.nil?
160
+ invalid_properties.push("invalid value for 'scope_options', scope_options cannot be nil.")
161
+ end
162
+
163
+ return invalid_properties
164
+ end
165
+
166
+ # Check to see if the all the properties in the model are valid
167
+ # @return true if the model is valid
168
+ def valid?
169
+ return false if @data_source.nil?
170
+ return false if @file_info.nil?
171
+ return false if @trim_content.nil?
172
+ return false if @trim_leading.nil?
173
+ return false if @trim_trailing.nil?
174
+ return false if @trim_space_between_word_to1.nil?
175
+ return false if @trim_non_breaking_spaces.nil?
176
+ return false if @remove_extra_line_breaks.nil?
177
+ return false if @remove_all_line_breaks.nil?
178
+ return false if @scope_options.nil?
179
+ return true
180
+ end
181
+
182
+ # Checks equality by comparing each attribute.
183
+ # @param [Object] Object to be compared
184
+ def ==(o)
185
+ return true if self.equal?(o)
186
+ self.class == o.class &&
187
+ data_source == o.data_source &&
188
+ file_info == o.file_info &&
189
+ trim_content == o.trim_content &&
190
+ trim_leading == o.trim_leading &&
191
+ trim_trailing == o.trim_trailing &&
192
+ trim_space_between_word_to1 == o.trim_space_between_word_to1 &&
193
+ trim_non_breaking_spaces == o.trim_non_breaking_spaces &&
194
+ remove_extra_line_breaks == o.remove_extra_line_breaks &&
195
+ remove_all_line_breaks == o.remove_all_line_breaks &&
196
+ scope_options == o.scope_options
197
+ std_dev == o.std_dev
198
+ end
199
+
200
+ # @see the `==` method
201
+ # @param [Object] Object to be compared
202
+ def eql?(o)
203
+ self == o
204
+ end
205
+
206
+ # Calculates hash code according to all attributes.
207
+ # @return [Fixnum] Hash code
208
+ def hash
209
+ [ data_source , file_info , trim_content , trim_leading , trim_trailing , trim_space_between_word_to1 , trim_non_breaking_spaces , remove_extra_line_breaks , remove_all_line_breaks , scope_options ].hash
210
+ end
211
+
212
+ # Builds the object from hash
213
+ # @param [Hash] attributes Model attributes in the form of hash
214
+ # @return [Object] Returns the model itself
215
+ def build_from_hash(attributes)
216
+ return nil unless attributes.is_a?(Hash)
217
+ self.class.swagger_types.each_pair do |key, type|
218
+ if type =~ /\AArray<(.*)>/i
219
+ # check to ensure the input is an array given that the the attribute
220
+ # is documented as an array but the input is not
221
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
222
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
223
+ end
224
+ elsif !attributes[self.class.attribute_map[key]].nil?
225
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
226
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
227
+ end
228
+
229
+ self
230
+ end
231
+
232
+ # Deserializes the data based on type
233
+ # @param string type Data type
234
+ # @param string value Value to be deserialized
235
+ # @return [Object] Deserialized data
236
+ def _deserialize(type, value)
237
+ case type.to_sym
238
+ when :DateTime
239
+ DateTime.parse(value)
240
+ when :Date
241
+ Date.parse(value)
242
+ when :String
243
+ value.to_s
244
+ when :Integer
245
+ value.to_i
246
+ when :Float
247
+ value.to_f
248
+ when :BOOLEAN
249
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
250
+ true
251
+ else
252
+ false
253
+ end
254
+ when :Object
255
+ # generic object (usually a Hash), return directly
256
+ value
257
+ when /\AArray<(?<inner_type>.+)>\z/
258
+ inner_type = Regexp.last_match[:inner_type]
259
+ value.map { |v| _deserialize(inner_type, v) }
260
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
261
+ k_type = Regexp.last_match[:k_type]
262
+ v_type = Regexp.last_match[:v_type]
263
+ {}.tap do |hash|
264
+ value.each do |k, v|
265
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
266
+ end
267
+ end
268
+ else # model
269
+ temp_model = AsposeCellsCloud.const_get(type).new
270
+ temp_model.build_from_hash(value)
271
+ end
272
+ end
273
+
274
+ # Returns the string representation of the object
275
+ # @return [String] String presentation of the object
276
+ def to_s
277
+ to_hash.to_s
278
+ end
279
+
280
+ # to_body is an alias to to_hash (backward compatibility)
281
+ # @return [Hash] Returns the object in the form of hash
282
+ def to_body
283
+ to_hash
284
+ end
285
+
286
+ # Returns the object in the form of hash
287
+ # @return [Hash] Returns the object in the form of hash
288
+ def to_hash
289
+ hash = {}
290
+ self.class.attribute_map.each_pair do |attr, param|
291
+ value = self.send(attr)
292
+ next if value.nil?
293
+ hash[param] = _to_hash(value)
294
+ end
295
+ hash
296
+ end
297
+
298
+ # Outputs non-array value in the form of hash
299
+ # For object, use to_hash. Otherwise, just return the value
300
+ # @param [Object] value Any valid value
301
+ # @return [Hash] Returns the value in the form of hash
302
+ def _to_hash(value)
303
+ if value.is_a?(Array)
304
+ value.compact.map{ |v| _to_hash(v) }
305
+ elsif value.is_a?(Hash)
306
+ {}.tap do |hash|
307
+ value.each { |k, v| hash[k] = _to_hash(v) }
308
+ end
309
+ elsif value.respond_to? :to_hash
310
+ value.to_hash
311
+ else
312
+ value
313
+ end
314
+ end
315
+
316
+ end
317
+
318
+ end
@@ -0,0 +1,246 @@
1
+ =begin
2
+ --------------------------------------------------------------------------------------------------------------------
3
+ <copyright company="Aspose" file="WordCaseOptionsrb.cs">
4
+ Copyright (c) 2024 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 WordCaseOptions
34
+ #
35
+ attr_accessor :data_source
36
+ #
37
+ attr_accessor :file_info
38
+ #
39
+ attr_accessor :word_case_type
40
+ #
41
+ attr_accessor :scope_options
42
+
43
+ # Attribute mapping from ruby-style variable name to JSON key.
44
+ def self.attribute_map
45
+ {
46
+ :'data_source' => :'DataSource',
47
+ :'file_info' => :'FileInfo',
48
+ :'word_case_type' => :'WordCaseType',
49
+ :'scope_options' => :'ScopeOptions'
50
+ }
51
+ end
52
+
53
+ # Attribute type mapping.
54
+ def self.swagger_types
55
+ {
56
+ :'data_source' => :'DataSource',
57
+ :'file_info' => :'FileInfo',
58
+ :'word_case_type' => :'String',
59
+ :'scope_options' => :'ScopeOptions'
60
+ }
61
+ end
62
+
63
+ # Initializes the object
64
+ # @param [Hash] attributes Model attributes in the form of hash
65
+ def initialize(attributes = {})
66
+ return unless attributes.is_a?(Hash)
67
+
68
+ # convert string to symbol for hash key
69
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
70
+
71
+ if attributes.has_key?(:'DataSource')
72
+ self.data_source = attributes[:'DataSource']
73
+ end
74
+ if attributes.has_key?(:'FileInfo')
75
+ self.file_info = attributes[:'FileInfo']
76
+ end
77
+ if attributes.has_key?(:'WordCaseType')
78
+ self.word_case_type = attributes[:'WordCaseType']
79
+ end
80
+ if attributes.has_key?(:'ScopeOptions')
81
+ self.scope_options = attributes[:'ScopeOptions']
82
+ end
83
+
84
+ end
85
+
86
+ # Show invalid properties with the reasons. Usually used together with valid?
87
+ # @return Array for valid properies with the reasons
88
+ def list_invalid_properties
89
+ invalid_properties = Array.new
90
+ if @data_source.nil?
91
+ invalid_properties.push("invalid value for 'data_source', data_source cannot be nil.")
92
+ end
93
+ if @file_info.nil?
94
+ invalid_properties.push("invalid value for 'file_info', file_info cannot be nil.")
95
+ end
96
+ if @word_case_type.nil?
97
+ invalid_properties.push("invalid value for 'word_case_type', word_case_type cannot be nil.")
98
+ end
99
+ if @scope_options.nil?
100
+ invalid_properties.push("invalid value for 'scope_options', scope_options cannot be nil.")
101
+ end
102
+
103
+ return invalid_properties
104
+ end
105
+
106
+ # Check to see if the all the properties in the model are valid
107
+ # @return true if the model is valid
108
+ def valid?
109
+ return false if @data_source.nil?
110
+ return false if @file_info.nil?
111
+ return false if @word_case_type.nil?
112
+ return false if @scope_options.nil?
113
+ return true
114
+ end
115
+
116
+ # Checks equality by comparing each attribute.
117
+ # @param [Object] Object to be compared
118
+ def ==(o)
119
+ return true if self.equal?(o)
120
+ self.class == o.class &&
121
+ data_source == o.data_source &&
122
+ file_info == o.file_info &&
123
+ word_case_type == o.word_case_type &&
124
+ scope_options == o.scope_options
125
+ std_dev == o.std_dev
126
+ end
127
+
128
+ # @see the `==` method
129
+ # @param [Object] Object to be compared
130
+ def eql?(o)
131
+ self == o
132
+ end
133
+
134
+ # Calculates hash code according to all attributes.
135
+ # @return [Fixnum] Hash code
136
+ def hash
137
+ [ data_source , file_info , word_case_type , scope_options ].hash
138
+ end
139
+
140
+ # Builds the object from hash
141
+ # @param [Hash] attributes Model attributes in the form of hash
142
+ # @return [Object] Returns the model itself
143
+ def build_from_hash(attributes)
144
+ return nil unless attributes.is_a?(Hash)
145
+ self.class.swagger_types.each_pair do |key, type|
146
+ if type =~ /\AArray<(.*)>/i
147
+ # check to ensure the input is an array given that the the attribute
148
+ # is documented as an array but the input is not
149
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
150
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
151
+ end
152
+ elsif !attributes[self.class.attribute_map[key]].nil?
153
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
154
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
155
+ end
156
+
157
+ self
158
+ end
159
+
160
+ # Deserializes the data based on type
161
+ # @param string type Data type
162
+ # @param string value Value to be deserialized
163
+ # @return [Object] Deserialized data
164
+ def _deserialize(type, value)
165
+ case type.to_sym
166
+ when :DateTime
167
+ DateTime.parse(value)
168
+ when :Date
169
+ Date.parse(value)
170
+ when :String
171
+ value.to_s
172
+ when :Integer
173
+ value.to_i
174
+ when :Float
175
+ value.to_f
176
+ when :BOOLEAN
177
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
178
+ true
179
+ else
180
+ false
181
+ end
182
+ when :Object
183
+ # generic object (usually a Hash), return directly
184
+ value
185
+ when /\AArray<(?<inner_type>.+)>\z/
186
+ inner_type = Regexp.last_match[:inner_type]
187
+ value.map { |v| _deserialize(inner_type, v) }
188
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
189
+ k_type = Regexp.last_match[:k_type]
190
+ v_type = Regexp.last_match[:v_type]
191
+ {}.tap do |hash|
192
+ value.each do |k, v|
193
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
194
+ end
195
+ end
196
+ else # model
197
+ temp_model = AsposeCellsCloud.const_get(type).new
198
+ temp_model.build_from_hash(value)
199
+ end
200
+ end
201
+
202
+ # Returns the string representation of the object
203
+ # @return [String] String presentation of the object
204
+ def to_s
205
+ to_hash.to_s
206
+ end
207
+
208
+ # to_body is an alias to to_hash (backward compatibility)
209
+ # @return [Hash] Returns the object in the form of hash
210
+ def to_body
211
+ to_hash
212
+ end
213
+
214
+ # Returns the object in the form of hash
215
+ # @return [Hash] Returns the object in the form of hash
216
+ def to_hash
217
+ hash = {}
218
+ self.class.attribute_map.each_pair do |attr, param|
219
+ value = self.send(attr)
220
+ next if value.nil?
221
+ hash[param] = _to_hash(value)
222
+ end
223
+ hash
224
+ end
225
+
226
+ # Outputs non-array value in the form of hash
227
+ # For object, use to_hash. Otherwise, just return the value
228
+ # @param [Object] value Any valid value
229
+ # @return [Hash] Returns the value in the form of hash
230
+ def _to_hash(value)
231
+ if value.is_a?(Array)
232
+ value.compact.map{ |v| _to_hash(v) }
233
+ elsif value.is_a?(Hash)
234
+ {}.tap do |hash|
235
+ value.each { |k, v| hash[k] = _to_hash(v) }
236
+ end
237
+ elsif value.respond_to? :to_hash
238
+ value.to_hash
239
+ else
240
+ value
241
+ end
242
+ end
243
+
244
+ end
245
+
246
+ end