hubspot-api-client 16.2.1 → 16.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -1
  3. data/Gemfile.lock +1 -1
  4. data/README.md +33 -1
  5. data/lib/hubspot/codegen/crm/associations/v4/api/batch_api.rb +428 -0
  6. data/lib/hubspot/codegen/crm/associations/v4/api/definitions_api.rb +332 -0
  7. data/lib/hubspot/codegen/crm/associations/v4/api_client.rb +412 -0
  8. data/lib/hubspot/codegen/crm/associations/v4/api_error.rb +63 -0
  9. data/lib/hubspot/codegen/crm/associations/v4/configuration.rb +296 -0
  10. data/lib/hubspot/codegen/crm/associations/v4/models/association_spec.rb +278 -0
  11. data/lib/hubspot/codegen/crm/associations/v4/models/association_spec_with_label.rb +287 -0
  12. data/lib/hubspot/codegen/crm/associations/v4/models/batch_input_public_association_multi_archive.rb +232 -0
  13. data/lib/hubspot/codegen/crm/associations/v4/models/batch_input_public_association_multi_post.rb +232 -0
  14. data/lib/hubspot/codegen/crm/associations/v4/models/batch_input_public_default_association_multi_post.rb +232 -0
  15. data/lib/hubspot/codegen/crm/associations/v4/models/batch_input_public_fetch_associations_batch_request.rb +232 -0
  16. data/lib/hubspot/codegen/crm/associations/v4/models/batch_response_labels_between_object_pair.rb +328 -0
  17. data/lib/hubspot/codegen/crm/associations/v4/models/batch_response_labels_between_object_pair_with_errors.rb +348 -0
  18. data/lib/hubspot/codegen/crm/associations/v4/models/batch_response_public_association_multi_with_label.rb +328 -0
  19. data/lib/hubspot/codegen/crm/associations/v4/models/batch_response_public_association_multi_with_label_with_errors.rb +348 -0
  20. data/lib/hubspot/codegen/crm/associations/v4/models/batch_response_public_default_association.rb +348 -0
  21. data/lib/hubspot/codegen/crm/associations/v4/models/collection_response_association_spec_with_label_no_paging.rb +232 -0
  22. data/lib/hubspot/codegen/crm/associations/v4/models/error.rb +307 -0
  23. data/lib/hubspot/codegen/crm/associations/v4/models/error_category.rb +278 -0
  24. data/lib/hubspot/codegen/crm/associations/v4/models/error_detail.rb +273 -0
  25. data/lib/hubspot/codegen/crm/associations/v4/models/labels_between_object_pair.rb +288 -0
  26. data/lib/hubspot/codegen/crm/associations/v4/models/multi_associated_object_with_label.rb +246 -0
  27. data/lib/hubspot/codegen/crm/associations/v4/models/next_page.rb +239 -0
  28. data/lib/hubspot/codegen/crm/associations/v4/models/paging.rb +234 -0
  29. data/lib/hubspot/codegen/crm/associations/v4/models/previous_page.rb +239 -0
  30. data/lib/hubspot/codegen/crm/associations/v4/models/public_association_definition_create_request.rb +244 -0
  31. data/lib/hubspot/codegen/crm/associations/v4/models/public_association_definition_update_request.rb +244 -0
  32. data/lib/hubspot/codegen/crm/associations/v4/models/public_association_multi_archive.rb +246 -0
  33. data/lib/hubspot/codegen/crm/associations/v4/models/public_association_multi_post.rb +260 -0
  34. data/lib/hubspot/codegen/crm/associations/v4/models/public_association_multi_with_label.rb +255 -0
  35. data/lib/hubspot/codegen/crm/associations/v4/models/public_default_association.rb +258 -0
  36. data/lib/hubspot/codegen/crm/associations/v4/models/public_default_association_multi_post.rb +244 -0
  37. data/lib/hubspot/codegen/crm/associations/v4/models/public_fetch_associations_batch_request.rb +239 -0
  38. data/lib/hubspot/codegen/crm/associations/v4/models/public_object_id.rb +230 -0
  39. data/lib/hubspot/codegen/crm/associations/v4/models/standard_error.rb +324 -0
  40. data/lib/hubspot/codegen/oauth/api/access_tokens_api.rb +0 -2
  41. data/lib/hubspot/codegen/oauth/api/refresh_tokens_api.rb +5 -7
  42. data/lib/hubspot/codegen/oauth/api/tokens_api.rb +0 -2
  43. data/lib/hubspot/codegen/oauth/api_client.rb +0 -2
  44. data/lib/hubspot/codegen/oauth/api_error.rb +0 -2
  45. data/lib/hubspot/codegen/oauth/configuration.rb +0 -2
  46. data/lib/hubspot/codegen/oauth/models/access_token_info_response.rb +0 -2
  47. data/lib/hubspot/codegen/oauth/models/error.rb +0 -2
  48. data/lib/hubspot/codegen/oauth/models/error_detail.rb +0 -2
  49. data/lib/hubspot/codegen/oauth/models/refresh_token_info_response.rb +0 -2
  50. data/lib/hubspot/codegen/oauth/models/token_response_if.rb +31 -33
  51. data/lib/hubspot/discovery/crm/associations/client.rb +3 -1
  52. data/lib/hubspot/discovery/crm/associations/v4/api/batch_api.rb +15 -0
  53. data/lib/hubspot/discovery/crm/associations/v4/api/definitions_api.rb +15 -0
  54. data/lib/hubspot/discovery/crm/associations/v4/client.rb +21 -0
  55. data/lib/hubspot/version.rb +1 -1
  56. data/spec/discovery/cms/blogs/client_spec.rb +9 -0
  57. data/spec/discovery/cms/client_spec.rb +13 -0
  58. data/spec/discovery/crm/associations/client_spec.rb +7 -0
  59. data/spec/discovery/crm/associations/v4/batch_api_spec.rb +11 -0
  60. data/spec/discovery/crm/associations/v4/definitions_api_spec.rb +10 -0
  61. data/spec/discovery/crm/client_spec.rb +21 -0
  62. data/spec/discovery/crm/extensions/client_spec.rb +11 -0
  63. data/spec/discovery/crm/objects/client_spec.rb +13 -0
  64. data/spec/discovery/marketing/client_spec.rb +9 -0
  65. metadata +58 -2
@@ -0,0 +1,273 @@
1
+ =begin
2
+ #CrmPublicAssociationsServiceV4
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: v4
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 Associations
19
+ module V4
20
+ class ErrorDetail
21
+ # A human readable message describing the error along with remediation steps where appropriate
22
+ attr_accessor :message
23
+
24
+ # The name of the field or parameter in which the error was found.
25
+ attr_accessor :_in
26
+
27
+ # The status code associated with the error detail
28
+ attr_accessor :code
29
+
30
+ # A specific category that contains more specific detail about the error
31
+ attr_accessor :sub_category
32
+
33
+ # Context about the error condition
34
+ attr_accessor :context
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'message' => :'message',
40
+ :'_in' => :'in',
41
+ :'code' => :'code',
42
+ :'sub_category' => :'subCategory',
43
+ :'context' => :'context'
44
+ }
45
+ end
46
+
47
+ # Returns all the JSON keys this model knows about
48
+ def self.acceptable_attributes
49
+ attribute_map.values
50
+ end
51
+
52
+ # Attribute type mapping.
53
+ def self.openapi_types
54
+ {
55
+ :'message' => :'String',
56
+ :'_in' => :'String',
57
+ :'code' => :'String',
58
+ :'sub_category' => :'String',
59
+ :'context' => :'Hash<String, Array<String>>'
60
+ }
61
+ end
62
+
63
+ # List of attributes with nullable: true
64
+ def self.openapi_nullable
65
+ Set.new([
66
+ ])
67
+ end
68
+
69
+ # Initializes the object
70
+ # @param [Hash] attributes Model attributes in the form of hash
71
+ def initialize(attributes = {})
72
+ if (!attributes.is_a?(Hash))
73
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Hubspot::Crm::Associations::V4::ErrorDetail` initialize method"
74
+ end
75
+
76
+ # check to see if the attribute exists and convert string to symbol for hash key
77
+ attributes = attributes.each_with_object({}) { |(k, v), h|
78
+ if (!self.class.attribute_map.key?(k.to_sym))
79
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Hubspot::Crm::Associations::V4::ErrorDetail`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
80
+ end
81
+ h[k.to_sym] = v
82
+ }
83
+
84
+ if attributes.key?(:'message')
85
+ self.message = attributes[:'message']
86
+ end
87
+
88
+ if attributes.key?(:'_in')
89
+ self._in = attributes[:'_in']
90
+ end
91
+
92
+ if attributes.key?(:'code')
93
+ self.code = attributes[:'code']
94
+ end
95
+
96
+ if attributes.key?(:'sub_category')
97
+ self.sub_category = attributes[:'sub_category']
98
+ end
99
+
100
+ if attributes.key?(:'context')
101
+ if (value = attributes[:'context']).is_a?(Hash)
102
+ self.context = value
103
+ end
104
+ end
105
+ end
106
+
107
+ # Show invalid properties with the reasons. Usually used together with valid?
108
+ # @return Array for valid properties with the reasons
109
+ def list_invalid_properties
110
+ invalid_properties = Array.new
111
+ if @message.nil?
112
+ invalid_properties.push('invalid value for "message", message cannot be nil.')
113
+ end
114
+
115
+ invalid_properties
116
+ end
117
+
118
+ # Check to see if the all the properties in the model are valid
119
+ # @return true if the model is valid
120
+ def valid?
121
+ return false if @message.nil?
122
+ true
123
+ end
124
+
125
+ # Checks equality by comparing each attribute.
126
+ # @param [Object] Object to be compared
127
+ def ==(o)
128
+ return true if self.equal?(o)
129
+ self.class == o.class &&
130
+ message == o.message &&
131
+ _in == o._in &&
132
+ code == o.code &&
133
+ sub_category == o.sub_category &&
134
+ context == o.context
135
+ end
136
+
137
+ # @see the `==` method
138
+ # @param [Object] Object to be compared
139
+ def eql?(o)
140
+ self == o
141
+ end
142
+
143
+ # Calculates hash code according to all attributes.
144
+ # @return [Integer] Hash code
145
+ def hash
146
+ [message, _in, code, sub_category, context].hash
147
+ end
148
+
149
+ # Builds the object from hash
150
+ # @param [Hash] attributes Model attributes in the form of hash
151
+ # @return [Object] Returns the model itself
152
+ def self.build_from_hash(attributes)
153
+ new.build_from_hash(attributes)
154
+ end
155
+
156
+ # Builds the object from hash
157
+ # @param [Hash] attributes Model attributes in the form of hash
158
+ # @return [Object] Returns the model itself
159
+ def build_from_hash(attributes)
160
+ return nil unless attributes.is_a?(Hash)
161
+ attributes = attributes.transform_keys(&:to_sym)
162
+ self.class.openapi_types.each_pair do |key, type|
163
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
164
+ self.send("#{key}=", nil)
165
+ elsif type =~ /\AArray<(.*)>/i
166
+ # check to ensure the input is an array given that the attribute
167
+ # is documented as an array but the input is not
168
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
169
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
170
+ end
171
+ elsif !attributes[self.class.attribute_map[key]].nil?
172
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
173
+ end
174
+ end
175
+
176
+ self
177
+ end
178
+
179
+ # Deserializes the data based on type
180
+ # @param string type Data type
181
+ # @param string value Value to be deserialized
182
+ # @return [Object] Deserialized data
183
+ def _deserialize(type, value)
184
+ case type.to_sym
185
+ when :Time
186
+ Time.parse(value)
187
+ when :Date
188
+ Date.parse(value)
189
+ when :String
190
+ value.to_s
191
+ when :Integer
192
+ value.to_i
193
+ when :Float
194
+ value.to_f
195
+ when :Boolean
196
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
197
+ true
198
+ else
199
+ false
200
+ end
201
+ when :Object
202
+ # generic object (usually a Hash), return directly
203
+ value
204
+ when /\AArray<(?<inner_type>.+)>\z/
205
+ inner_type = Regexp.last_match[:inner_type]
206
+ value.map { |v| _deserialize(inner_type, v) }
207
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
208
+ k_type = Regexp.last_match[:k_type]
209
+ v_type = Regexp.last_match[:v_type]
210
+ {}.tap do |hash|
211
+ value.each do |k, v|
212
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
213
+ end
214
+ end
215
+ else # model
216
+ # models (e.g. Pet) or oneOf
217
+ klass = Hubspot::Crm::Associations::V4.const_get(type)
218
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
219
+ end
220
+ end
221
+
222
+ # Returns the string representation of the object
223
+ # @return [String] String presentation of the object
224
+ def to_s
225
+ to_hash.to_s
226
+ end
227
+
228
+ # to_body is an alias to to_hash (backward compatibility)
229
+ # @return [Hash] Returns the object in the form of hash
230
+ def to_body
231
+ to_hash
232
+ end
233
+
234
+ # Returns the object in the form of hash
235
+ # @return [Hash] Returns the object in the form of hash
236
+ def to_hash
237
+ hash = {}
238
+ self.class.attribute_map.each_pair do |attr, param|
239
+ value = self.send(attr)
240
+ if value.nil?
241
+ is_nullable = self.class.openapi_nullable.include?(attr)
242
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
243
+ end
244
+
245
+ hash[param] = _to_hash(value)
246
+ end
247
+ hash
248
+ end
249
+
250
+ # Outputs non-array value in the form of hash
251
+ # For object, use to_hash. Otherwise, just return the value
252
+ # @param [Object] value Any valid value
253
+ # @return [Hash] Returns the value in the form of hash
254
+ def _to_hash(value)
255
+ if value.is_a?(Array)
256
+ value.compact.map { |v| _to_hash(v) }
257
+ elsif value.is_a?(Hash)
258
+ {}.tap do |hash|
259
+ value.each { |k, v| hash[k] = _to_hash(v) }
260
+ end
261
+ elsif value.respond_to? :to_hash
262
+ value.to_hash
263
+ else
264
+ value
265
+ end
266
+ end
267
+
268
+ end
269
+
270
+ end
271
+ end
272
+ end
273
+ end
@@ -0,0 +1,288 @@
1
+ =begin
2
+ #CrmPublicAssociationsServiceV4
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: v4
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 Associations
19
+ module V4
20
+ class LabelsBetweenObjectPair
21
+ attr_accessor :from_object_type_id
22
+
23
+ attr_accessor :from_object_id
24
+
25
+ attr_accessor :to_object_type_id
26
+
27
+ attr_accessor :to_object_id
28
+
29
+ attr_accessor :labels
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'from_object_type_id' => :'fromObjectTypeId',
35
+ :'from_object_id' => :'fromObjectId',
36
+ :'to_object_type_id' => :'toObjectTypeId',
37
+ :'to_object_id' => :'toObjectId',
38
+ :'labels' => :'labels'
39
+ }
40
+ end
41
+
42
+ # Returns all the JSON keys this model knows about
43
+ def self.acceptable_attributes
44
+ attribute_map.values
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.openapi_types
49
+ {
50
+ :'from_object_type_id' => :'String',
51
+ :'from_object_id' => :'Integer',
52
+ :'to_object_type_id' => :'String',
53
+ :'to_object_id' => :'Integer',
54
+ :'labels' => :'Array<String>'
55
+ }
56
+ end
57
+
58
+ # List of attributes with nullable: true
59
+ def self.openapi_nullable
60
+ Set.new([
61
+ ])
62
+ end
63
+
64
+ # Initializes the object
65
+ # @param [Hash] attributes Model attributes in the form of hash
66
+ def initialize(attributes = {})
67
+ if (!attributes.is_a?(Hash))
68
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Hubspot::Crm::Associations::V4::LabelsBetweenObjectPair` initialize method"
69
+ end
70
+
71
+ # check to see if the attribute exists and convert string to symbol for hash key
72
+ attributes = attributes.each_with_object({}) { |(k, v), h|
73
+ if (!self.class.attribute_map.key?(k.to_sym))
74
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Hubspot::Crm::Associations::V4::LabelsBetweenObjectPair`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
75
+ end
76
+ h[k.to_sym] = v
77
+ }
78
+
79
+ if attributes.key?(:'from_object_type_id')
80
+ self.from_object_type_id = attributes[:'from_object_type_id']
81
+ end
82
+
83
+ if attributes.key?(:'from_object_id')
84
+ self.from_object_id = attributes[:'from_object_id']
85
+ end
86
+
87
+ if attributes.key?(:'to_object_type_id')
88
+ self.to_object_type_id = attributes[:'to_object_type_id']
89
+ end
90
+
91
+ if attributes.key?(:'to_object_id')
92
+ self.to_object_id = attributes[:'to_object_id']
93
+ end
94
+
95
+ if attributes.key?(:'labels')
96
+ if (value = attributes[:'labels']).is_a?(Array)
97
+ self.labels = value
98
+ end
99
+ end
100
+ end
101
+
102
+ # Show invalid properties with the reasons. Usually used together with valid?
103
+ # @return Array for valid properties with the reasons
104
+ def list_invalid_properties
105
+ invalid_properties = Array.new
106
+ if @from_object_type_id.nil?
107
+ invalid_properties.push('invalid value for "from_object_type_id", from_object_type_id cannot be nil.')
108
+ end
109
+
110
+ if @from_object_id.nil?
111
+ invalid_properties.push('invalid value for "from_object_id", from_object_id cannot be nil.')
112
+ end
113
+
114
+ if @to_object_type_id.nil?
115
+ invalid_properties.push('invalid value for "to_object_type_id", to_object_type_id cannot be nil.')
116
+ end
117
+
118
+ if @to_object_id.nil?
119
+ invalid_properties.push('invalid value for "to_object_id", to_object_id cannot be nil.')
120
+ end
121
+
122
+ if @labels.nil?
123
+ invalid_properties.push('invalid value for "labels", labels cannot be nil.')
124
+ end
125
+
126
+ invalid_properties
127
+ end
128
+
129
+ # Check to see if the all the properties in the model are valid
130
+ # @return true if the model is valid
131
+ def valid?
132
+ return false if @from_object_type_id.nil?
133
+ return false if @from_object_id.nil?
134
+ return false if @to_object_type_id.nil?
135
+ return false if @to_object_id.nil?
136
+ return false if @labels.nil?
137
+ true
138
+ end
139
+
140
+ # Checks equality by comparing each attribute.
141
+ # @param [Object] Object to be compared
142
+ def ==(o)
143
+ return true if self.equal?(o)
144
+ self.class == o.class &&
145
+ from_object_type_id == o.from_object_type_id &&
146
+ from_object_id == o.from_object_id &&
147
+ to_object_type_id == o.to_object_type_id &&
148
+ to_object_id == o.to_object_id &&
149
+ labels == o.labels
150
+ end
151
+
152
+ # @see the `==` method
153
+ # @param [Object] Object to be compared
154
+ def eql?(o)
155
+ self == o
156
+ end
157
+
158
+ # Calculates hash code according to all attributes.
159
+ # @return [Integer] Hash code
160
+ def hash
161
+ [from_object_type_id, from_object_id, to_object_type_id, to_object_id, labels].hash
162
+ end
163
+
164
+ # Builds the object from hash
165
+ # @param [Hash] attributes Model attributes in the form of hash
166
+ # @return [Object] Returns the model itself
167
+ def self.build_from_hash(attributes)
168
+ new.build_from_hash(attributes)
169
+ end
170
+
171
+ # Builds the object from hash
172
+ # @param [Hash] attributes Model attributes in the form of hash
173
+ # @return [Object] Returns the model itself
174
+ def build_from_hash(attributes)
175
+ return nil unless attributes.is_a?(Hash)
176
+ attributes = attributes.transform_keys(&:to_sym)
177
+ self.class.openapi_types.each_pair do |key, type|
178
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
179
+ self.send("#{key}=", nil)
180
+ elsif type =~ /\AArray<(.*)>/i
181
+ # check to ensure the input is an array given that the attribute
182
+ # is documented as an array but the input is not
183
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
184
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
185
+ end
186
+ elsif !attributes[self.class.attribute_map[key]].nil?
187
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
188
+ end
189
+ end
190
+
191
+ self
192
+ end
193
+
194
+ # Deserializes the data based on type
195
+ # @param string type Data type
196
+ # @param string value Value to be deserialized
197
+ # @return [Object] Deserialized data
198
+ def _deserialize(type, value)
199
+ case type.to_sym
200
+ when :Time
201
+ Time.parse(value)
202
+ when :Date
203
+ Date.parse(value)
204
+ when :String
205
+ value.to_s
206
+ when :Integer
207
+ value.to_i
208
+ when :Float
209
+ value.to_f
210
+ when :Boolean
211
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
212
+ true
213
+ else
214
+ false
215
+ end
216
+ when :Object
217
+ # generic object (usually a Hash), return directly
218
+ value
219
+ when /\AArray<(?<inner_type>.+)>\z/
220
+ inner_type = Regexp.last_match[:inner_type]
221
+ value.map { |v| _deserialize(inner_type, v) }
222
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
223
+ k_type = Regexp.last_match[:k_type]
224
+ v_type = Regexp.last_match[:v_type]
225
+ {}.tap do |hash|
226
+ value.each do |k, v|
227
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
228
+ end
229
+ end
230
+ else # model
231
+ # models (e.g. Pet) or oneOf
232
+ klass = Hubspot::Crm::Associations::V4.const_get(type)
233
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
234
+ end
235
+ end
236
+
237
+ # Returns the string representation of the object
238
+ # @return [String] String presentation of the object
239
+ def to_s
240
+ to_hash.to_s
241
+ end
242
+
243
+ # to_body is an alias to to_hash (backward compatibility)
244
+ # @return [Hash] Returns the object in the form of hash
245
+ def to_body
246
+ to_hash
247
+ end
248
+
249
+ # Returns the object in the form of hash
250
+ # @return [Hash] Returns the object in the form of hash
251
+ def to_hash
252
+ hash = {}
253
+ self.class.attribute_map.each_pair do |attr, param|
254
+ value = self.send(attr)
255
+ if value.nil?
256
+ is_nullable = self.class.openapi_nullable.include?(attr)
257
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
258
+ end
259
+
260
+ hash[param] = _to_hash(value)
261
+ end
262
+ hash
263
+ end
264
+
265
+ # Outputs non-array value in the form of hash
266
+ # For object, use to_hash. Otherwise, just return the value
267
+ # @param [Object] value Any valid value
268
+ # @return [Hash] Returns the value in the form of hash
269
+ def _to_hash(value)
270
+ if value.is_a?(Array)
271
+ value.compact.map { |v| _to_hash(v) }
272
+ elsif value.is_a?(Hash)
273
+ {}.tap do |hash|
274
+ value.each { |k, v| hash[k] = _to_hash(v) }
275
+ end
276
+ elsif value.respond_to? :to_hash
277
+ value.to_hash
278
+ else
279
+ value
280
+ end
281
+ end
282
+
283
+ end
284
+
285
+ end
286
+ end
287
+ end
288
+ end