hubspot-api-client 16.0.4 → 16.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -1
  3. data/Gemfile.lock +1 -1
  4. data/lib/hubspot/codegen/crm/objects/postal_mail/api/associations_api.rb +264 -0
  5. data/lib/hubspot/codegen/crm/objects/postal_mail/api/basic_api.rb +391 -0
  6. data/lib/hubspot/codegen/crm/objects/postal_mail/api/batch_api.rb +295 -0
  7. data/lib/hubspot/codegen/crm/objects/postal_mail/api/public_object_api.rb +94 -0
  8. data/lib/hubspot/codegen/crm/objects/postal_mail/api/search_api.rb +92 -0
  9. data/lib/hubspot/codegen/crm/objects/postal_mail/api_client.rb +412 -0
  10. data/lib/hubspot/codegen/crm/objects/postal_mail/api_error.rb +63 -0
  11. data/lib/hubspot/codegen/crm/objects/postal_mail/configuration.rb +296 -0
  12. data/lib/hubspot/codegen/crm/objects/postal_mail/models/associated_id.rb +244 -0
  13. data/lib/hubspot/codegen/crm/objects/postal_mail/models/association_spec.rb +278 -0
  14. data/lib/hubspot/codegen/crm/objects/postal_mail/models/association_spec_with_label.rb +287 -0
  15. data/lib/hubspot/codegen/crm/objects/postal_mail/models/batch_input_simple_public_object_batch_input.rb +232 -0
  16. data/lib/hubspot/codegen/crm/objects/postal_mail/models/batch_input_simple_public_object_id.rb +232 -0
  17. data/lib/hubspot/codegen/crm/objects/postal_mail/models/batch_input_simple_public_object_input.rb +232 -0
  18. data/lib/hubspot/codegen/crm/objects/postal_mail/models/batch_read_input_simple_public_object_id.rb +273 -0
  19. data/lib/hubspot/codegen/crm/objects/postal_mail/models/batch_response_simple_public_object.rb +328 -0
  20. data/lib/hubspot/codegen/crm/objects/postal_mail/models/batch_response_simple_public_object_with_errors.rb +348 -0
  21. data/lib/hubspot/codegen/crm/objects/postal_mail/models/collection_response_associated_id.rb +241 -0
  22. data/lib/hubspot/codegen/crm/objects/postal_mail/models/collection_response_multi_associated_object_with_label_forward_paging.rb +241 -0
  23. data/lib/hubspot/codegen/crm/objects/postal_mail/models/collection_response_simple_public_object_with_associations_forward_paging.rb +241 -0
  24. data/lib/hubspot/codegen/crm/objects/postal_mail/models/collection_response_with_total_simple_public_object_forward_paging.rb +255 -0
  25. data/lib/hubspot/codegen/crm/objects/postal_mail/models/error.rb +307 -0
  26. data/lib/hubspot/codegen/crm/objects/postal_mail/models/error_category.rb +278 -0
  27. data/lib/hubspot/codegen/crm/objects/postal_mail/models/error_detail.rb +273 -0
  28. data/lib/hubspot/codegen/crm/objects/postal_mail/models/filter.rb +299 -0
  29. data/lib/hubspot/codegen/crm/objects/postal_mail/models/filter_group.rb +232 -0
  30. data/lib/hubspot/codegen/crm/objects/postal_mail/models/forward_paging.rb +225 -0
  31. data/lib/hubspot/codegen/crm/objects/postal_mail/models/labels_between_object_pair.rb +288 -0
  32. data/lib/hubspot/codegen/crm/objects/postal_mail/models/multi_associated_object_with_label.rb +246 -0
  33. data/lib/hubspot/codegen/crm/objects/postal_mail/models/next_page.rb +239 -0
  34. data/lib/hubspot/codegen/crm/objects/postal_mail/models/paging.rb +234 -0
  35. data/lib/hubspot/codegen/crm/objects/postal_mail/models/previous_page.rb +239 -0
  36. data/lib/hubspot/codegen/crm/objects/postal_mail/models/public_merge_input.rb +244 -0
  37. data/lib/hubspot/codegen/crm/objects/postal_mail/models/public_object_search_request.rb +301 -0
  38. data/lib/hubspot/codegen/crm/objects/postal_mail/models/simple_public_object.rb +303 -0
  39. data/lib/hubspot/codegen/crm/objects/postal_mail/models/simple_public_object_batch_input.rb +246 -0
  40. data/lib/hubspot/codegen/crm/objects/postal_mail/models/simple_public_object_id.rb +230 -0
  41. data/lib/hubspot/codegen/crm/objects/postal_mail/models/simple_public_object_input.rb +232 -0
  42. data/lib/hubspot/codegen/crm/objects/postal_mail/models/simple_public_object_with_associations.rb +314 -0
  43. data/lib/hubspot/codegen/crm/objects/postal_mail/models/standard_error.rb +324 -0
  44. data/lib/hubspot/codegen/crm/objects/postal_mail/models/value_with_timestamp.rb +285 -0
  45. data/lib/hubspot/codegen/marketing/events/models/property_value.rb +13 -4
  46. data/lib/hubspot/discovery/crm/objects/client.rb +1 -0
  47. data/lib/hubspot/discovery/crm/objects/postal_mail/api/associations_api.rb +15 -0
  48. data/lib/hubspot/discovery/crm/objects/postal_mail/api/basic_api.rb +15 -0
  49. data/lib/hubspot/discovery/crm/objects/postal_mail/api/batch_api.rb +15 -0
  50. data/lib/hubspot/discovery/crm/objects/postal_mail/api/public_object_api.rb +15 -0
  51. data/lib/hubspot/discovery/crm/objects/postal_mail/api/search_api.rb +15 -0
  52. data/lib/hubspot/discovery/crm/objects/postal_mail/client.rb +25 -0
  53. data/lib/hubspot/discovery/crm/pipelines/api/pipeline_audits_api.rb +13 -0
  54. data/lib/hubspot/discovery/crm/pipelines/api/pipeline_stage_audits_api.rb +13 -0
  55. data/lib/hubspot/discovery/crm/pipelines/client.rb +2 -0
  56. data/lib/hubspot/version.rb +1 -1
  57. data/spec/discovery/crm/objects/postal_mail/associations_api_spec.rb +9 -0
  58. data/spec/discovery/crm/objects/postal_mail/basic_api_spec.rb +10 -0
  59. data/spec/discovery/crm/objects/postal_mail/batch_api_spec.rb +10 -0
  60. data/spec/discovery/crm/objects/postal_mail/public_object_api_spec.rb +7 -0
  61. data/spec/discovery/crm/objects/postal_mail/search_api_spec.rb +7 -0
  62. data/spec/discovery/crm/pipelines/pipeline_audits_api_spec.rb +8 -0
  63. data/spec/discovery/crm/pipelines/pipeline_stage_audits_api_spec.rb +8 -0
  64. metadata +66 -3
@@ -0,0 +1,255 @@
1
+ =begin
2
+ #Postal Mail
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: v3
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.2.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Hubspot
17
+ module Crm
18
+ module Objects
19
+ module PostalMail
20
+ class CollectionResponseWithTotalSimplePublicObjectForwardPaging
21
+ attr_accessor :total
22
+
23
+ attr_accessor :results
24
+
25
+ attr_accessor :paging
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'total' => :'total',
31
+ :'results' => :'results',
32
+ :'paging' => :'paging'
33
+ }
34
+ end
35
+
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ attribute_map.values
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'total' => :'Integer',
45
+ :'results' => :'Array<SimplePublicObject>',
46
+ :'paging' => :'ForwardPaging'
47
+ }
48
+ end
49
+
50
+ # List of attributes with nullable: true
51
+ def self.openapi_nullable
52
+ Set.new([
53
+ ])
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ if (!attributes.is_a?(Hash))
60
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Hubspot::Crm::Objects::PostalMail::CollectionResponseWithTotalSimplePublicObjectForwardPaging` initialize method"
61
+ end
62
+
63
+ # check to see if the attribute exists and convert string to symbol for hash key
64
+ attributes = attributes.each_with_object({}) { |(k, v), h|
65
+ if (!self.class.attribute_map.key?(k.to_sym))
66
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Hubspot::Crm::Objects::PostalMail::CollectionResponseWithTotalSimplePublicObjectForwardPaging`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
67
+ end
68
+ h[k.to_sym] = v
69
+ }
70
+
71
+ if attributes.key?(:'total')
72
+ self.total = attributes[:'total']
73
+ end
74
+
75
+ if attributes.key?(:'results')
76
+ if (value = attributes[:'results']).is_a?(Array)
77
+ self.results = value
78
+ end
79
+ end
80
+
81
+ if attributes.key?(:'paging')
82
+ self.paging = attributes[:'paging']
83
+ end
84
+ end
85
+
86
+ # Show invalid properties with the reasons. Usually used together with valid?
87
+ # @return Array for valid properties with the reasons
88
+ def list_invalid_properties
89
+ invalid_properties = Array.new
90
+ if @total.nil?
91
+ invalid_properties.push('invalid value for "total", total cannot be nil.')
92
+ end
93
+
94
+ if @results.nil?
95
+ invalid_properties.push('invalid value for "results", results cannot be nil.')
96
+ end
97
+
98
+ invalid_properties
99
+ end
100
+
101
+ # Check to see if the all the properties in the model are valid
102
+ # @return true if the model is valid
103
+ def valid?
104
+ return false if @total.nil?
105
+ return false if @results.nil?
106
+ true
107
+ end
108
+
109
+ # Checks equality by comparing each attribute.
110
+ # @param [Object] Object to be compared
111
+ def ==(o)
112
+ return true if self.equal?(o)
113
+ self.class == o.class &&
114
+ total == o.total &&
115
+ results == o.results &&
116
+ paging == o.paging
117
+ end
118
+
119
+ # @see the `==` method
120
+ # @param [Object] Object to be compared
121
+ def eql?(o)
122
+ self == o
123
+ end
124
+
125
+ # Calculates hash code according to all attributes.
126
+ # @return [Integer] Hash code
127
+ def hash
128
+ [total, results, paging].hash
129
+ end
130
+
131
+ # Builds the object from hash
132
+ # @param [Hash] attributes Model attributes in the form of hash
133
+ # @return [Object] Returns the model itself
134
+ def self.build_from_hash(attributes)
135
+ new.build_from_hash(attributes)
136
+ end
137
+
138
+ # Builds the object from hash
139
+ # @param [Hash] attributes Model attributes in the form of hash
140
+ # @return [Object] Returns the model itself
141
+ def build_from_hash(attributes)
142
+ return nil unless attributes.is_a?(Hash)
143
+ attributes = attributes.transform_keys(&:to_sym)
144
+ self.class.openapi_types.each_pair do |key, type|
145
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
146
+ self.send("#{key}=", nil)
147
+ elsif type =~ /\AArray<(.*)>/i
148
+ # check to ensure the input is an array given that the attribute
149
+ # is documented as an array but the input is not
150
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
151
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
152
+ end
153
+ elsif !attributes[self.class.attribute_map[key]].nil?
154
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
155
+ end
156
+ end
157
+
158
+ self
159
+ end
160
+
161
+ # Deserializes the data based on type
162
+ # @param string type Data type
163
+ # @param string value Value to be deserialized
164
+ # @return [Object] Deserialized data
165
+ def _deserialize(type, value)
166
+ case type.to_sym
167
+ when :Time
168
+ Time.parse(value)
169
+ when :Date
170
+ Date.parse(value)
171
+ when :String
172
+ value.to_s
173
+ when :Integer
174
+ value.to_i
175
+ when :Float
176
+ value.to_f
177
+ when :Boolean
178
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
179
+ true
180
+ else
181
+ false
182
+ end
183
+ when :Object
184
+ # generic object (usually a Hash), return directly
185
+ value
186
+ when /\AArray<(?<inner_type>.+)>\z/
187
+ inner_type = Regexp.last_match[:inner_type]
188
+ value.map { |v| _deserialize(inner_type, v) }
189
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
190
+ k_type = Regexp.last_match[:k_type]
191
+ v_type = Regexp.last_match[:v_type]
192
+ {}.tap do |hash|
193
+ value.each do |k, v|
194
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
195
+ end
196
+ end
197
+ else # model
198
+ # models (e.g. Pet) or oneOf
199
+ klass = Hubspot::Crm::Objects::PostalMail.const_get(type)
200
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
201
+ end
202
+ end
203
+
204
+ # Returns the string representation of the object
205
+ # @return [String] String presentation of the object
206
+ def to_s
207
+ to_hash.to_s
208
+ end
209
+
210
+ # to_body is an alias to to_hash (backward compatibility)
211
+ # @return [Hash] Returns the object in the form of hash
212
+ def to_body
213
+ to_hash
214
+ end
215
+
216
+ # Returns the object in the form of hash
217
+ # @return [Hash] Returns the object in the form of hash
218
+ def to_hash
219
+ hash = {}
220
+ self.class.attribute_map.each_pair do |attr, param|
221
+ value = self.send(attr)
222
+ if value.nil?
223
+ is_nullable = self.class.openapi_nullable.include?(attr)
224
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
225
+ end
226
+
227
+ hash[param] = _to_hash(value)
228
+ end
229
+ hash
230
+ end
231
+
232
+ # Outputs non-array value in the form of hash
233
+ # For object, use to_hash. Otherwise, just return the value
234
+ # @param [Object] value Any valid value
235
+ # @return [Hash] Returns the value in the form of hash
236
+ def _to_hash(value)
237
+ if value.is_a?(Array)
238
+ value.compact.map { |v| _to_hash(v) }
239
+ elsif value.is_a?(Hash)
240
+ {}.tap do |hash|
241
+ value.each { |k, v| hash[k] = _to_hash(v) }
242
+ end
243
+ elsif value.respond_to? :to_hash
244
+ value.to_hash
245
+ else
246
+ value
247
+ end
248
+ end
249
+
250
+ end
251
+
252
+ end
253
+ end
254
+ end
255
+ end
@@ -0,0 +1,307 @@
1
+ =begin
2
+ #Postal Mail
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: v3
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.2.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Hubspot
17
+ module Crm
18
+ module Objects
19
+ module PostalMail
20
+ class Error
21
+ # A human readable message describing the error along with remediation steps where appropriate
22
+ attr_accessor :message
23
+
24
+ # A unique identifier for the request. Include this value with any error reports or support tickets
25
+ attr_accessor :correlation_id
26
+
27
+ # The error category
28
+ attr_accessor :category
29
+
30
+ # A specific category that contains more specific detail about the error
31
+ attr_accessor :sub_category
32
+
33
+ # further information about the error
34
+ attr_accessor :errors
35
+
36
+ # Context about the error condition
37
+ attr_accessor :context
38
+
39
+ # A map of link names to associated URIs containing documentation about the error or recommended remediation steps
40
+ attr_accessor :links
41
+
42
+ # Attribute mapping from ruby-style variable name to JSON key.
43
+ def self.attribute_map
44
+ {
45
+ :'message' => :'message',
46
+ :'correlation_id' => :'correlationId',
47
+ :'category' => :'category',
48
+ :'sub_category' => :'subCategory',
49
+ :'errors' => :'errors',
50
+ :'context' => :'context',
51
+ :'links' => :'links'
52
+ }
53
+ end
54
+
55
+ # Returns all the JSON keys this model knows about
56
+ def self.acceptable_attributes
57
+ attribute_map.values
58
+ end
59
+
60
+ # Attribute type mapping.
61
+ def self.openapi_types
62
+ {
63
+ :'message' => :'String',
64
+ :'correlation_id' => :'String',
65
+ :'category' => :'String',
66
+ :'sub_category' => :'String',
67
+ :'errors' => :'Array<ErrorDetail>',
68
+ :'context' => :'Hash<String, Array<String>>',
69
+ :'links' => :'Hash<String, String>'
70
+ }
71
+ end
72
+
73
+ # List of attributes with nullable: true
74
+ def self.openapi_nullable
75
+ Set.new([
76
+ ])
77
+ end
78
+
79
+ # Initializes the object
80
+ # @param [Hash] attributes Model attributes in the form of hash
81
+ def initialize(attributes = {})
82
+ if (!attributes.is_a?(Hash))
83
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Hubspot::Crm::Objects::PostalMail::Error` initialize method"
84
+ end
85
+
86
+ # check to see if the attribute exists and convert string to symbol for hash key
87
+ attributes = attributes.each_with_object({}) { |(k, v), h|
88
+ if (!self.class.attribute_map.key?(k.to_sym))
89
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Hubspot::Crm::Objects::PostalMail::Error`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
90
+ end
91
+ h[k.to_sym] = v
92
+ }
93
+
94
+ if attributes.key?(:'message')
95
+ self.message = attributes[:'message']
96
+ end
97
+
98
+ if attributes.key?(:'correlation_id')
99
+ self.correlation_id = attributes[:'correlation_id']
100
+ end
101
+
102
+ if attributes.key?(:'category')
103
+ self.category = attributes[:'category']
104
+ end
105
+
106
+ if attributes.key?(:'sub_category')
107
+ self.sub_category = attributes[:'sub_category']
108
+ end
109
+
110
+ if attributes.key?(:'errors')
111
+ if (value = attributes[:'errors']).is_a?(Array)
112
+ self.errors = value
113
+ end
114
+ end
115
+
116
+ if attributes.key?(:'context')
117
+ if (value = attributes[:'context']).is_a?(Hash)
118
+ self.context = value
119
+ end
120
+ end
121
+
122
+ if attributes.key?(:'links')
123
+ if (value = attributes[:'links']).is_a?(Hash)
124
+ self.links = value
125
+ end
126
+ end
127
+ end
128
+
129
+ # Show invalid properties with the reasons. Usually used together with valid?
130
+ # @return Array for valid properties with the reasons
131
+ def list_invalid_properties
132
+ invalid_properties = Array.new
133
+ if @message.nil?
134
+ invalid_properties.push('invalid value for "message", message cannot be nil.')
135
+ end
136
+
137
+ if @correlation_id.nil?
138
+ invalid_properties.push('invalid value for "correlation_id", correlation_id cannot be nil.')
139
+ end
140
+
141
+ if @category.nil?
142
+ invalid_properties.push('invalid value for "category", category cannot be nil.')
143
+ end
144
+
145
+ invalid_properties
146
+ end
147
+
148
+ # Check to see if the all the properties in the model are valid
149
+ # @return true if the model is valid
150
+ def valid?
151
+ return false if @message.nil?
152
+ return false if @correlation_id.nil?
153
+ return false if @category.nil?
154
+ true
155
+ end
156
+
157
+ # Checks equality by comparing each attribute.
158
+ # @param [Object] Object to be compared
159
+ def ==(o)
160
+ return true if self.equal?(o)
161
+ self.class == o.class &&
162
+ message == o.message &&
163
+ correlation_id == o.correlation_id &&
164
+ category == o.category &&
165
+ sub_category == o.sub_category &&
166
+ errors == o.errors &&
167
+ context == o.context &&
168
+ links == o.links
169
+ end
170
+
171
+ # @see the `==` method
172
+ # @param [Object] Object to be compared
173
+ def eql?(o)
174
+ self == o
175
+ end
176
+
177
+ # Calculates hash code according to all attributes.
178
+ # @return [Integer] Hash code
179
+ def hash
180
+ [message, correlation_id, category, sub_category, errors, context, links].hash
181
+ end
182
+
183
+ # Builds the object from hash
184
+ # @param [Hash] attributes Model attributes in the form of hash
185
+ # @return [Object] Returns the model itself
186
+ def self.build_from_hash(attributes)
187
+ new.build_from_hash(attributes)
188
+ end
189
+
190
+ # Builds the object from hash
191
+ # @param [Hash] attributes Model attributes in the form of hash
192
+ # @return [Object] Returns the model itself
193
+ def build_from_hash(attributes)
194
+ return nil unless attributes.is_a?(Hash)
195
+ attributes = attributes.transform_keys(&:to_sym)
196
+ self.class.openapi_types.each_pair do |key, type|
197
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
198
+ self.send("#{key}=", nil)
199
+ elsif type =~ /\AArray<(.*)>/i
200
+ # check to ensure the input is an array given that the attribute
201
+ # is documented as an array but the input is not
202
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
203
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
204
+ end
205
+ elsif !attributes[self.class.attribute_map[key]].nil?
206
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
207
+ end
208
+ end
209
+
210
+ self
211
+ end
212
+
213
+ # Deserializes the data based on type
214
+ # @param string type Data type
215
+ # @param string value Value to be deserialized
216
+ # @return [Object] Deserialized data
217
+ def _deserialize(type, value)
218
+ case type.to_sym
219
+ when :Time
220
+ Time.parse(value)
221
+ when :Date
222
+ Date.parse(value)
223
+ when :String
224
+ value.to_s
225
+ when :Integer
226
+ value.to_i
227
+ when :Float
228
+ value.to_f
229
+ when :Boolean
230
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
231
+ true
232
+ else
233
+ false
234
+ end
235
+ when :Object
236
+ # generic object (usually a Hash), return directly
237
+ value
238
+ when /\AArray<(?<inner_type>.+)>\z/
239
+ inner_type = Regexp.last_match[:inner_type]
240
+ value.map { |v| _deserialize(inner_type, v) }
241
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
242
+ k_type = Regexp.last_match[:k_type]
243
+ v_type = Regexp.last_match[:v_type]
244
+ {}.tap do |hash|
245
+ value.each do |k, v|
246
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
247
+ end
248
+ end
249
+ else # model
250
+ # models (e.g. Pet) or oneOf
251
+ klass = Hubspot::Crm::Objects::PostalMail.const_get(type)
252
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
253
+ end
254
+ end
255
+
256
+ # Returns the string representation of the object
257
+ # @return [String] String presentation of the object
258
+ def to_s
259
+ to_hash.to_s
260
+ end
261
+
262
+ # to_body is an alias to to_hash (backward compatibility)
263
+ # @return [Hash] Returns the object in the form of hash
264
+ def to_body
265
+ to_hash
266
+ end
267
+
268
+ # Returns the object in the form of hash
269
+ # @return [Hash] Returns the object in the form of hash
270
+ def to_hash
271
+ hash = {}
272
+ self.class.attribute_map.each_pair do |attr, param|
273
+ value = self.send(attr)
274
+ if value.nil?
275
+ is_nullable = self.class.openapi_nullable.include?(attr)
276
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
277
+ end
278
+
279
+ hash[param] = _to_hash(value)
280
+ end
281
+ hash
282
+ end
283
+
284
+ # Outputs non-array value in the form of hash
285
+ # For object, use to_hash. Otherwise, just return the value
286
+ # @param [Object] value Any valid value
287
+ # @return [Hash] Returns the value in the form of hash
288
+ def _to_hash(value)
289
+ if value.is_a?(Array)
290
+ value.compact.map { |v| _to_hash(v) }
291
+ elsif value.is_a?(Hash)
292
+ {}.tap do |hash|
293
+ value.each { |k, v| hash[k] = _to_hash(v) }
294
+ end
295
+ elsif value.respond_to? :to_hash
296
+ value.to_hash
297
+ else
298
+ value
299
+ end
300
+ end
301
+
302
+ end
303
+
304
+ end
305
+ end
306
+ end
307
+ end