bandwidth-sdk 17.0.0 → 17.0.1

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 (44) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +3 -3
  3. data/README.md +11 -3
  4. data/bandwidth.yml +78 -22
  5. data/coverage/.last_run.json +1 -1
  6. data/coverage/.resultset.json +115 -96
  7. data/coverage/index.html +660 -390
  8. data/docs/MultiChannelAction.md +32 -81
  9. data/docs/MultiChannelApi.md +1 -1
  10. data/docs/{MultiChannelChannelListObject.md → MultiChannelChannelListMMSObject.md} +3 -3
  11. data/docs/{MultiChannelMessageResponseDataChannelListInner.md → MultiChannelChannelListMMSResponseObject.md} +3 -3
  12. data/docs/MultiChannelChannelListObjectBase.md +22 -0
  13. data/docs/MultiChannelChannelListOwnerObject.md +18 -0
  14. data/docs/MultiChannelChannelListRBMObject.md +24 -0
  15. data/docs/{MultiChannelChannelListObjectContent.md → MultiChannelChannelListRBMObjectAllOfContent.md} +6 -10
  16. data/docs/MultiChannelChannelListRBMResponseObject.md +26 -0
  17. data/docs/MultiChannelChannelListRequestObject.md +24 -0
  18. data/docs/MultiChannelChannelListResponseObject.md +26 -0
  19. data/docs/MultiChannelChannelListSMSObject.md +24 -0
  20. data/docs/MultiChannelChannelListSMSResponseObject.md +26 -0
  21. data/docs/MultiChannelMessageRequest.md +1 -1
  22. data/docs/MultiChannelMessageResponseData.md +1 -1
  23. data/docs/RbmActionBase.md +1 -1
  24. data/docs/RbmSuggestionResponse.md +1 -1
  25. data/lib/bandwidth-sdk/models/multi_channel_action.rb +71 -26
  26. data/lib/bandwidth-sdk/models/{multi_channel_channel_list_object.rb → multi_channel_channel_list_mms_object.rb} +11 -4
  27. data/lib/bandwidth-sdk/models/{multi_channel_message_response_data_channel_list_inner.rb → multi_channel_channel_list_mms_response_object.rb} +6 -5
  28. data/lib/bandwidth-sdk/models/multi_channel_channel_list_object_base.rb +275 -0
  29. data/lib/bandwidth-sdk/models/multi_channel_channel_list_owner_object.rb +220 -0
  30. data/lib/bandwidth-sdk/models/multi_channel_channel_list_rbm_object.rb +298 -0
  31. data/lib/bandwidth-sdk/models/{multi_channel_channel_list_object_content.rb → multi_channel_channel_list_rbm_object_all_of_content.rb} +2 -4
  32. data/lib/bandwidth-sdk/models/multi_channel_channel_list_rbm_response_object.rb +316 -0
  33. data/lib/bandwidth-sdk/models/multi_channel_channel_list_request_object.rb +104 -0
  34. data/lib/bandwidth-sdk/models/multi_channel_channel_list_response_object.rb +104 -0
  35. data/lib/bandwidth-sdk/models/multi_channel_channel_list_sms_object.rb +298 -0
  36. data/lib/bandwidth-sdk/models/multi_channel_channel_list_sms_response_object.rb +316 -0
  37. data/lib/bandwidth-sdk/models/multi_channel_message_request.rb +1 -1
  38. data/lib/bandwidth-sdk/models/multi_channel_message_response_data.rb +1 -1
  39. data/lib/bandwidth-sdk/version.rb +1 -1
  40. data/lib/bandwidth-sdk.rb +11 -3
  41. data/spec/smoke/multi_channel_api_spec.rb +124 -23
  42. data/spec/smoke/phone_number_lookup_api_spec.rb +1 -1
  43. data/spec/unit/api/multi_channel_api_spec.rb +13 -2
  44. metadata +24 -8
@@ -0,0 +1,298 @@
1
+ =begin
2
+ #Bandwidth
3
+
4
+ #Bandwidth's Communication APIs
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: letstalk@bandwidth.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.8.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Bandwidth
17
+ class MultiChannelChannelListRBMObject
18
+ # The sender ID of the message. This could be an alphanumeric sender ID.
19
+ attr_accessor :from
20
+
21
+ # The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard.
22
+ attr_accessor :application_id
23
+
24
+ attr_accessor :channel
25
+
26
+ attr_accessor :content
27
+
28
+ class EnumAttributeValidator
29
+ attr_reader :datatype
30
+ attr_reader :allowable_values
31
+
32
+ def initialize(datatype, allowable_values)
33
+ @allowable_values = allowable_values.map do |value|
34
+ case datatype.to_s
35
+ when /Integer/i
36
+ value.to_i
37
+ when /Float/i
38
+ value.to_f
39
+ else
40
+ value
41
+ end
42
+ end
43
+ end
44
+
45
+ def valid?(value)
46
+ !value || allowable_values.include?(value)
47
+ end
48
+ end
49
+
50
+ # Attribute mapping from ruby-style variable name to JSON key.
51
+ def self.attribute_map
52
+ {
53
+ :'from' => :'from',
54
+ :'application_id' => :'applicationId',
55
+ :'channel' => :'channel',
56
+ :'content' => :'content'
57
+ }
58
+ end
59
+
60
+ # Returns all the JSON keys this model knows about
61
+ def self.acceptable_attributes
62
+ attribute_map.values
63
+ end
64
+
65
+ # Attribute type mapping.
66
+ def self.openapi_types
67
+ {
68
+ :'from' => :'String',
69
+ :'application_id' => :'String',
70
+ :'channel' => :'MultiChannelMessageChannelEnum',
71
+ :'content' => :'MultiChannelChannelListRBMObjectAllOfContent'
72
+ }
73
+ end
74
+
75
+ # List of attributes with nullable: true
76
+ def self.openapi_nullable
77
+ Set.new([
78
+ ])
79
+ end
80
+
81
+ # List of class defined in allOf (OpenAPI v3)
82
+ def self.openapi_all_of
83
+ [
84
+ :'MultiChannelChannelListObjectBase'
85
+ ]
86
+ end
87
+
88
+ # Initializes the object
89
+ # @param [Hash] attributes Model attributes in the form of hash
90
+ def initialize(attributes = {})
91
+ if (!attributes.is_a?(Hash))
92
+ fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MultiChannelChannelListRBMObject` initialize method'
93
+ end
94
+
95
+ # check to see if the attribute exists and convert string to symbol for hash key
96
+ attributes = attributes.each_with_object({}) { |(k, v), h|
97
+ if (!self.class.attribute_map.key?(k.to_sym))
98
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MultiChannelChannelListRBMObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
99
+ end
100
+ h[k.to_sym] = v
101
+ }
102
+
103
+ if attributes.key?(:'from')
104
+ self.from = attributes[:'from']
105
+ else
106
+ self.from = nil
107
+ end
108
+
109
+ if attributes.key?(:'application_id')
110
+ self.application_id = attributes[:'application_id']
111
+ else
112
+ self.application_id = nil
113
+ end
114
+
115
+ if attributes.key?(:'channel')
116
+ self.channel = attributes[:'channel']
117
+ else
118
+ self.channel = nil
119
+ end
120
+
121
+ if attributes.key?(:'content')
122
+ self.content = attributes[:'content']
123
+ else
124
+ self.content = nil
125
+ end
126
+ end
127
+
128
+ # Show invalid properties with the reasons. Usually used together with valid?
129
+ # @return Array for valid properties with the reasons
130
+ def list_invalid_properties
131
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
132
+ invalid_properties = Array.new
133
+ if @from.nil?
134
+ invalid_properties.push('invalid value for "from", from cannot be nil.')
135
+ end
136
+
137
+ if @application_id.nil?
138
+ invalid_properties.push('invalid value for "application_id", application_id cannot be nil.')
139
+ end
140
+
141
+ if @channel.nil?
142
+ invalid_properties.push('invalid value for "channel", channel cannot be nil.')
143
+ end
144
+
145
+ if @content.nil?
146
+ invalid_properties.push('invalid value for "content", content cannot be nil.')
147
+ end
148
+
149
+ invalid_properties
150
+ end
151
+
152
+ # Check to see if the all the properties in the model are valid
153
+ # @return true if the model is valid
154
+ def valid?
155
+ warn '[DEPRECATED] the `valid?` method is obsolete'
156
+ return false if @from.nil?
157
+ return false if @application_id.nil?
158
+ return false if @channel.nil?
159
+ return false if @content.nil?
160
+ true
161
+ end
162
+
163
+ # Checks equality by comparing each attribute.
164
+ # @param [Object] Object to be compared
165
+ def ==(o)
166
+ return true if self.equal?(o)
167
+ self.class == o.class &&
168
+ from == o.from &&
169
+ application_id == o.application_id &&
170
+ channel == o.channel &&
171
+ content == o.content
172
+ end
173
+
174
+ # @see the `==` method
175
+ # @param [Object] Object to be compared
176
+ def eql?(o)
177
+ self == o
178
+ end
179
+
180
+ # Calculates hash code according to all attributes.
181
+ # @return [Integer] Hash code
182
+ def hash
183
+ [from, application_id, channel, content].hash
184
+ end
185
+
186
+ # Builds the object from hash
187
+ # @param [Hash] attributes Model attributes in the form of hash
188
+ # @return [Object] Returns the model itself
189
+ def self.build_from_hash(attributes)
190
+ return nil unless attributes.is_a?(Hash)
191
+ attributes = attributes.transform_keys(&:to_sym)
192
+ transformed_hash = {}
193
+ openapi_types.each_pair do |key, type|
194
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
195
+ transformed_hash["#{key}"] = nil
196
+ elsif type =~ /\AArray<(.*)>/i
197
+ # check to ensure the input is an array given that the attribute
198
+ # is documented as an array but the input is not
199
+ if attributes[attribute_map[key]].is_a?(Array)
200
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
201
+ end
202
+ elsif !attributes[attribute_map[key]].nil?
203
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
204
+ end
205
+ end
206
+ new(transformed_hash)
207
+ end
208
+
209
+ # Deserializes the data based on type
210
+ # @param string type Data type
211
+ # @param string value Value to be deserialized
212
+ # @return [Object] Deserialized data
213
+ def self._deserialize(type, value)
214
+ case type.to_sym
215
+ when :Time
216
+ Time.parse(value)
217
+ when :Date
218
+ Date.parse(value)
219
+ when :String
220
+ value.to_s
221
+ when :Integer
222
+ value.to_i
223
+ when :Float
224
+ value.to_f
225
+ when :Boolean
226
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
227
+ true
228
+ else
229
+ false
230
+ end
231
+ when :Object
232
+ # generic object (usually a Hash), return directly
233
+ value
234
+ when /\AArray<(?<inner_type>.+)>\z/
235
+ inner_type = Regexp.last_match[:inner_type]
236
+ value.map { |v| _deserialize(inner_type, v) }
237
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
238
+ k_type = Regexp.last_match[:k_type]
239
+ v_type = Regexp.last_match[:v_type]
240
+ {}.tap do |hash|
241
+ value.each do |k, v|
242
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
243
+ end
244
+ end
245
+ else # model
246
+ # models (e.g. Pet) or oneOf
247
+ klass = Bandwidth.const_get(type)
248
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
249
+ end
250
+ end
251
+
252
+ # Returns the string representation of the object
253
+ # @return [String] String presentation of the object
254
+ def to_s
255
+ to_hash.to_s
256
+ end
257
+
258
+ # to_body is an alias to to_hash (backward compatibility)
259
+ # @return [Hash] Returns the object in the form of hash
260
+ def to_body
261
+ to_hash
262
+ end
263
+
264
+ # Returns the object in the form of hash
265
+ # @return [Hash] Returns the object in the form of hash
266
+ def to_hash
267
+ hash = {}
268
+ self.class.attribute_map.each_pair do |attr, param|
269
+ value = self.send(attr)
270
+ if value.nil?
271
+ is_nullable = self.class.openapi_nullable.include?(attr)
272
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
273
+ end
274
+
275
+ hash[param] = _to_hash(value)
276
+ end
277
+ hash
278
+ end
279
+
280
+ # Outputs non-array value in the form of hash
281
+ # For object, use to_hash. Otherwise, just return the value
282
+ # @param [Object] value Any valid value
283
+ # @return [Hash] Returns the value in the form of hash
284
+ def _to_hash(value)
285
+ if value.is_a?(Array)
286
+ value.compact.map { |v| _to_hash(v) }
287
+ elsif value.is_a?(Hash)
288
+ {}.tap do |hash|
289
+ value.each { |k, v| hash[k] = _to_hash(v) }
290
+ end
291
+ elsif value.respond_to? :to_hash
292
+ value.to_hash
293
+ else
294
+ value
295
+ end
296
+ end
297
+ end
298
+ end
@@ -15,16 +15,14 @@ require 'time'
15
15
 
16
16
  module Bandwidth
17
17
  # The content of the message.
18
- module MultiChannelChannelListObjectContent
18
+ module MultiChannelChannelListRBMObjectAllOfContent
19
19
  class << self
20
20
  # List of class defined in oneOf (OpenAPI v3)
21
21
  def openapi_one_of
22
22
  [
23
- :'MmsMessageContent',
24
23
  :'RbmMessageContentRichCard',
25
24
  :'RbmMessageContentText',
26
- :'RbmMessageMedia',
27
- :'SmsMessageContent'
25
+ :'RbmMessageMedia'
28
26
  ]
29
27
  end
30
28
 
@@ -0,0 +1,316 @@
1
+ =begin
2
+ #Bandwidth
3
+
4
+ #Bandwidth's Communication APIs
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: letstalk@bandwidth.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.8.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Bandwidth
17
+ class MultiChannelChannelListRBMResponseObject
18
+ # The sender ID of the message. This could be an alphanumeric sender ID.
19
+ attr_accessor :from
20
+
21
+ # The ID of the Application your from number or senderId is associated with in the Bandwidth Phone Number Dashboard.
22
+ attr_accessor :application_id
23
+
24
+ attr_accessor :channel
25
+
26
+ attr_accessor :content
27
+
28
+ # The Bandwidth senderId associated with the message. Identical to 'from'.
29
+ attr_accessor :owner
30
+
31
+ class EnumAttributeValidator
32
+ attr_reader :datatype
33
+ attr_reader :allowable_values
34
+
35
+ def initialize(datatype, allowable_values)
36
+ @allowable_values = allowable_values.map do |value|
37
+ case datatype.to_s
38
+ when /Integer/i
39
+ value.to_i
40
+ when /Float/i
41
+ value.to_f
42
+ else
43
+ value
44
+ end
45
+ end
46
+ end
47
+
48
+ def valid?(value)
49
+ !value || allowable_values.include?(value)
50
+ end
51
+ end
52
+
53
+ # Attribute mapping from ruby-style variable name to JSON key.
54
+ def self.attribute_map
55
+ {
56
+ :'from' => :'from',
57
+ :'application_id' => :'applicationId',
58
+ :'channel' => :'channel',
59
+ :'content' => :'content',
60
+ :'owner' => :'owner'
61
+ }
62
+ end
63
+
64
+ # Returns all the JSON keys this model knows about
65
+ def self.acceptable_attributes
66
+ attribute_map.values
67
+ end
68
+
69
+ # Attribute type mapping.
70
+ def self.openapi_types
71
+ {
72
+ :'from' => :'String',
73
+ :'application_id' => :'String',
74
+ :'channel' => :'MultiChannelMessageChannelEnum',
75
+ :'content' => :'MultiChannelChannelListRBMObjectAllOfContent',
76
+ :'owner' => :'String'
77
+ }
78
+ end
79
+
80
+ # List of attributes with nullable: true
81
+ def self.openapi_nullable
82
+ Set.new([
83
+ ])
84
+ end
85
+
86
+ # List of class defined in allOf (OpenAPI v3)
87
+ def self.openapi_all_of
88
+ [
89
+ :'MultiChannelChannelListOwnerObject',
90
+ :'MultiChannelChannelListRBMObject'
91
+ ]
92
+ end
93
+
94
+ # Initializes the object
95
+ # @param [Hash] attributes Model attributes in the form of hash
96
+ def initialize(attributes = {})
97
+ if (!attributes.is_a?(Hash))
98
+ fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::MultiChannelChannelListRBMResponseObject` initialize method'
99
+ end
100
+
101
+ # check to see if the attribute exists and convert string to symbol for hash key
102
+ attributes = attributes.each_with_object({}) { |(k, v), h|
103
+ if (!self.class.attribute_map.key?(k.to_sym))
104
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::MultiChannelChannelListRBMResponseObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
105
+ end
106
+ h[k.to_sym] = v
107
+ }
108
+
109
+ if attributes.key?(:'from')
110
+ self.from = attributes[:'from']
111
+ else
112
+ self.from = nil
113
+ end
114
+
115
+ if attributes.key?(:'application_id')
116
+ self.application_id = attributes[:'application_id']
117
+ else
118
+ self.application_id = nil
119
+ end
120
+
121
+ if attributes.key?(:'channel')
122
+ self.channel = attributes[:'channel']
123
+ else
124
+ self.channel = nil
125
+ end
126
+
127
+ if attributes.key?(:'content')
128
+ self.content = attributes[:'content']
129
+ else
130
+ self.content = nil
131
+ end
132
+
133
+ if attributes.key?(:'owner')
134
+ self.owner = attributes[:'owner']
135
+ else
136
+ self.owner = nil
137
+ end
138
+ end
139
+
140
+ # Show invalid properties with the reasons. Usually used together with valid?
141
+ # @return Array for valid properties with the reasons
142
+ def list_invalid_properties
143
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
144
+ invalid_properties = Array.new
145
+ if @from.nil?
146
+ invalid_properties.push('invalid value for "from", from cannot be nil.')
147
+ end
148
+
149
+ if @application_id.nil?
150
+ invalid_properties.push('invalid value for "application_id", application_id cannot be nil.')
151
+ end
152
+
153
+ if @channel.nil?
154
+ invalid_properties.push('invalid value for "channel", channel cannot be nil.')
155
+ end
156
+
157
+ if @content.nil?
158
+ invalid_properties.push('invalid value for "content", content cannot be nil.')
159
+ end
160
+
161
+ if @owner.nil?
162
+ invalid_properties.push('invalid value for "owner", owner cannot be nil.')
163
+ end
164
+
165
+ invalid_properties
166
+ end
167
+
168
+ # Check to see if the all the properties in the model are valid
169
+ # @return true if the model is valid
170
+ def valid?
171
+ warn '[DEPRECATED] the `valid?` method is obsolete'
172
+ return false if @from.nil?
173
+ return false if @application_id.nil?
174
+ return false if @channel.nil?
175
+ return false if @content.nil?
176
+ return false if @owner.nil?
177
+ true
178
+ end
179
+
180
+ # Checks equality by comparing each attribute.
181
+ # @param [Object] Object to be compared
182
+ def ==(o)
183
+ return true if self.equal?(o)
184
+ self.class == o.class &&
185
+ from == o.from &&
186
+ application_id == o.application_id &&
187
+ channel == o.channel &&
188
+ content == o.content &&
189
+ owner == o.owner
190
+ end
191
+
192
+ # @see the `==` method
193
+ # @param [Object] Object to be compared
194
+ def eql?(o)
195
+ self == o
196
+ end
197
+
198
+ # Calculates hash code according to all attributes.
199
+ # @return [Integer] Hash code
200
+ def hash
201
+ [from, application_id, channel, content, owner].hash
202
+ end
203
+
204
+ # Builds the object from hash
205
+ # @param [Hash] attributes Model attributes in the form of hash
206
+ # @return [Object] Returns the model itself
207
+ def self.build_from_hash(attributes)
208
+ return nil unless attributes.is_a?(Hash)
209
+ attributes = attributes.transform_keys(&:to_sym)
210
+ transformed_hash = {}
211
+ openapi_types.each_pair do |key, type|
212
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
213
+ transformed_hash["#{key}"] = nil
214
+ elsif type =~ /\AArray<(.*)>/i
215
+ # check to ensure the input is an array given that the attribute
216
+ # is documented as an array but the input is not
217
+ if attributes[attribute_map[key]].is_a?(Array)
218
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
219
+ end
220
+ elsif !attributes[attribute_map[key]].nil?
221
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
222
+ end
223
+ end
224
+ new(transformed_hash)
225
+ end
226
+
227
+ # Deserializes the data based on type
228
+ # @param string type Data type
229
+ # @param string value Value to be deserialized
230
+ # @return [Object] Deserialized data
231
+ def self._deserialize(type, value)
232
+ case type.to_sym
233
+ when :Time
234
+ Time.parse(value)
235
+ when :Date
236
+ Date.parse(value)
237
+ when :String
238
+ value.to_s
239
+ when :Integer
240
+ value.to_i
241
+ when :Float
242
+ value.to_f
243
+ when :Boolean
244
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
245
+ true
246
+ else
247
+ false
248
+ end
249
+ when :Object
250
+ # generic object (usually a Hash), return directly
251
+ value
252
+ when /\AArray<(?<inner_type>.+)>\z/
253
+ inner_type = Regexp.last_match[:inner_type]
254
+ value.map { |v| _deserialize(inner_type, v) }
255
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
256
+ k_type = Regexp.last_match[:k_type]
257
+ v_type = Regexp.last_match[:v_type]
258
+ {}.tap do |hash|
259
+ value.each do |k, v|
260
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
261
+ end
262
+ end
263
+ else # model
264
+ # models (e.g. Pet) or oneOf
265
+ klass = Bandwidth.const_get(type)
266
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
267
+ end
268
+ end
269
+
270
+ # Returns the string representation of the object
271
+ # @return [String] String presentation of the object
272
+ def to_s
273
+ to_hash.to_s
274
+ end
275
+
276
+ # to_body is an alias to to_hash (backward compatibility)
277
+ # @return [Hash] Returns the object in the form of hash
278
+ def to_body
279
+ to_hash
280
+ end
281
+
282
+ # Returns the object in the form of hash
283
+ # @return [Hash] Returns the object in the form of hash
284
+ def to_hash
285
+ hash = {}
286
+ self.class.attribute_map.each_pair do |attr, param|
287
+ value = self.send(attr)
288
+ if value.nil?
289
+ is_nullable = self.class.openapi_nullable.include?(attr)
290
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
291
+ end
292
+
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
+ end
316
+ end