messente_api 1.4.0 → 2.2.0

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 (151) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +33 -30
  3. data/docs/BlacklistApi.md +105 -37
  4. data/docs/BulkMessagingApi.md +76 -0
  5. data/docs/BulkOmniMessageCreateSuccessResponse.md +18 -0
  6. data/docs/BulkOmniMessageCreateSuccessResponseMessagesInner.md +49 -0
  7. data/docs/BulkOmnimessage.md +18 -0
  8. data/docs/Channel.md +4 -5
  9. data/docs/ContactEnvelope.md +8 -7
  10. data/docs/ContactFields.md +26 -25
  11. data/docs/ContactListEnvelope.md +8 -7
  12. data/docs/ContactResponseFields.md +28 -27
  13. data/docs/ContactUpdateFields.md +24 -23
  14. data/docs/ContactsApi.md +221 -86
  15. data/docs/DeliveryReportApi.md +29 -13
  16. data/docs/DeliveryReportResponse.md +12 -11
  17. data/docs/DeliveryResult.md +22 -17
  18. data/docs/ErrorCodeOmnichannel.md +4 -5
  19. data/docs/ErrorCodeOmnichannelMachine.md +4 -5
  20. data/docs/ErrorCodePhonebook.md +4 -5
  21. data/docs/ErrorCodeStatistics.md +4 -5
  22. data/docs/ErrorItemNumberLookup.md +8 -7
  23. data/docs/ErrorItemNumberLookupError.md +10 -9
  24. data/docs/ErrorItemOmnichannel.md +14 -13
  25. data/docs/ErrorItemPhonebook.md +12 -11
  26. data/docs/ErrorItemStatistics.md +12 -11
  27. data/docs/ErrorNumberLookup.md +8 -7
  28. data/docs/ErrorOmnichannel.md +8 -7
  29. data/docs/ErrorPhonebook.md +8 -7
  30. data/docs/ErrorStatistics.md +8 -7
  31. data/docs/ErrorTitleOmnichannel.md +4 -5
  32. data/docs/ErrorTitlePhonebook.md +4 -5
  33. data/docs/FetchBlacklistSuccess.md +8 -7
  34. data/docs/GroupEnvelope.md +8 -7
  35. data/docs/GroupListEnvelope.md +8 -7
  36. data/docs/GroupName.md +8 -7
  37. data/docs/GroupResponseFields.md +14 -13
  38. data/docs/GroupsApi.md +136 -51
  39. data/docs/MessageResult.md +12 -11
  40. data/docs/MobileNetwork.md +16 -15
  41. data/docs/NumberLookupApi.md +30 -14
  42. data/docs/NumberToBlacklist.md +8 -7
  43. data/docs/NumbersToInvestigate.md +8 -7
  44. data/docs/OmniMessageCreateSuccessResponse.md +12 -11
  45. data/docs/Omnimessage.md +18 -17
  46. data/docs/OmnimessageApi.md +56 -23
  47. data/docs/OmnimessageMessagesInner.md +53 -0
  48. data/docs/PriceInfo.md +22 -0
  49. data/docs/Priority.md +4 -5
  50. data/docs/SMS.md +20 -17
  51. data/docs/StatisticsApi.md +30 -14
  52. data/docs/StatisticsReport.md +12 -11
  53. data/docs/StatisticsReportSettings.md +12 -11
  54. data/docs/StatisticsReportSuccess.md +8 -7
  55. data/docs/Status.md +4 -5
  56. data/docs/SyncNumberLookupResult.md +24 -23
  57. data/docs/SyncNumberLookupSuccess.md +10 -9
  58. data/docs/Telegram.md +20 -19
  59. data/docs/TextStore.md +4 -5
  60. data/docs/Viber.md +24 -19
  61. data/docs/ViberVideo.md +24 -0
  62. data/docs/WhatsApp.md +16 -19
  63. data/docs/WhatsAppComponent.md +24 -0
  64. data/docs/WhatsAppCurrency.md +22 -0
  65. data/docs/WhatsAppDatetime.md +18 -0
  66. data/docs/WhatsAppLanguage.md +20 -0
  67. data/docs/WhatsAppMedia.md +24 -0
  68. data/docs/WhatsAppParameter.md +30 -0
  69. data/docs/WhatsAppTemplate.md +22 -0
  70. data/git_push.sh +3 -4
  71. data/lib/messente_api/api/blacklist_api.rb +22 -15
  72. data/lib/messente_api/api/bulk_messaging_api.rb +88 -0
  73. data/lib/messente_api/api/contacts_api.rb +42 -28
  74. data/lib/messente_api/api/delivery_report_api.rb +6 -5
  75. data/lib/messente_api/api/groups_api.rb +30 -19
  76. data/lib/messente_api/api/number_lookup_api.rb +10 -6
  77. data/lib/messente_api/api/omnimessage_api.rb +14 -9
  78. data/lib/messente_api/api/statistics_api.rb +10 -6
  79. data/lib/messente_api/api_client.rb +72 -66
  80. data/lib/messente_api/api_error.rb +3 -2
  81. data/lib/messente_api/configuration.rb +64 -14
  82. data/lib/messente_api/models/{whats_app_audio.rb → bulk_omni_message_create_success_response.rb} +50 -38
  83. data/lib/messente_api/models/bulk_omni_message_create_success_response_messages_inner.rb +105 -0
  84. data/lib/messente_api/models/{whats_app_text.rb → bulk_omnimessage.rb} +49 -49
  85. data/lib/messente_api/models/channel.rb +9 -5
  86. data/lib/messente_api/models/contact_envelope.rb +31 -23
  87. data/lib/messente_api/models/contact_fields.rb +33 -23
  88. data/lib/messente_api/models/contact_list_envelope.rb +41 -23
  89. data/lib/messente_api/models/contact_response_fields.rb +31 -23
  90. data/lib/messente_api/models/contact_update_fields.rb +31 -23
  91. data/lib/messente_api/models/delivery_report_response.rb +37 -23
  92. data/lib/messente_api/models/delivery_result.rb +77 -27
  93. data/lib/messente_api/models/error_code_omnichannel.rb +9 -5
  94. data/lib/messente_api/models/error_code_omnichannel_machine.rb +9 -5
  95. data/lib/messente_api/models/error_code_phonebook.rb +9 -5
  96. data/lib/messente_api/models/error_code_statistics.rb +9 -5
  97. data/lib/messente_api/models/error_item_number_lookup.rb +33 -23
  98. data/lib/messente_api/models/error_item_number_lookup_error.rb +35 -23
  99. data/lib/messente_api/models/error_item_omnichannel.rb +61 -23
  100. data/lib/messente_api/models/error_item_phonebook.rb +59 -23
  101. data/lib/messente_api/models/error_item_statistics.rb +59 -23
  102. data/lib/messente_api/models/error_number_lookup.rb +33 -23
  103. data/lib/messente_api/models/error_omnichannel.rb +33 -23
  104. data/lib/messente_api/models/error_phonebook.rb +33 -23
  105. data/lib/messente_api/models/error_statistics.rb +33 -23
  106. data/lib/messente_api/models/error_title_omnichannel.rb +9 -5
  107. data/lib/messente_api/models/error_title_phonebook.rb +9 -5
  108. data/lib/messente_api/models/fetch_blacklist_success.rb +41 -23
  109. data/lib/messente_api/models/group_envelope.rb +31 -23
  110. data/lib/messente_api/models/group_list_envelope.rb +41 -23
  111. data/lib/messente_api/models/group_name.rb +33 -23
  112. data/lib/messente_api/models/group_response_fields.rb +37 -23
  113. data/lib/messente_api/models/message_result.rb +59 -23
  114. data/lib/messente_api/models/mobile_network.rb +31 -23
  115. data/lib/messente_api/models/number_to_blacklist.rb +33 -23
  116. data/lib/messente_api/models/numbers_to_investigate.rb +62 -24
  117. data/lib/messente_api/models/omni_message_create_success_response.rb +37 -23
  118. data/lib/messente_api/models/omnimessage.rb +59 -25
  119. data/lib/messente_api/models/omnimessage_messages_inner.rb +107 -0
  120. data/lib/messente_api/models/price_info.rb +257 -0
  121. data/lib/messente_api/models/priority.rb +9 -5
  122. data/lib/messente_api/models/sms.rb +45 -25
  123. data/lib/messente_api/models/statistics_report.rb +37 -23
  124. data/lib/messente_api/models/statistics_report_settings.rb +35 -23
  125. data/lib/messente_api/models/statistics_report_success.rb +33 -23
  126. data/lib/messente_api/models/status.rb +9 -5
  127. data/lib/messente_api/models/sync_number_lookup_result.rb +35 -24
  128. data/lib/messente_api/models/sync_number_lookup_success.rb +35 -23
  129. data/lib/messente_api/models/telegram.rb +31 -23
  130. data/lib/messente_api/models/text_store.rb +9 -5
  131. data/lib/messente_api/models/viber.rb +55 -28
  132. data/lib/messente_api/models/viber_video.rb +274 -0
  133. data/lib/messente_api/models/whats_app.rb +45 -54
  134. data/lib/messente_api/models/whats_app_component.rb +255 -0
  135. data/lib/messente_api/models/whats_app_currency.rb +257 -0
  136. data/lib/messente_api/models/{whats_app_document.rb → whats_app_datetime.rb} +48 -48
  137. data/lib/messente_api/models/{whats_app_image.rb → whats_app_language.rb} +55 -45
  138. data/lib/messente_api/models/whats_app_media.rb +246 -0
  139. data/lib/messente_api/models/whats_app_parameter.rb +278 -0
  140. data/lib/messente_api/models/whats_app_template.rb +251 -0
  141. data/lib/messente_api/version.rb +3 -3
  142. data/lib/messente_api.rb +16 -6
  143. data/messente_api.gemspec +5 -5
  144. data/spec/spec_helper.rb +2 -2
  145. metadata +35 -39
  146. data/docs/WhatsAppAudio.md +0 -17
  147. data/docs/WhatsAppDocument.md +0 -19
  148. data/docs/WhatsAppImage.md +0 -19
  149. data/docs/WhatsAppText.md +0 -19
  150. data/spec/api_client_spec.rb +0 -226
  151. data/spec/configuration_spec.rb +0 -42
@@ -3,14 +3,15 @@
3
3
 
4
4
  #[Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world.
5
5
 
6
- The version of the OpenAPI document: 1.4.0
6
+ The version of the OpenAPI document: 2.0.0
7
7
  Contact: messente@messente.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ Generator version: 7.6.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module MessenteApi
16
17
  # A container for contacts
@@ -25,6 +26,11 @@ module MessenteApi
25
26
  }
26
27
  end
27
28
 
29
+ # Returns all the JSON keys this model knows about
30
+ def self.acceptable_attributes
31
+ attribute_map.values
32
+ end
33
+
28
34
  # Attribute type mapping.
29
35
  def self.openapi_types
30
36
  {
@@ -63,6 +69,7 @@ module MessenteApi
63
69
  # Show invalid properties with the reasons. Usually used together with valid?
64
70
  # @return Array for valid properties with the reasons
65
71
  def list_invalid_properties
72
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
66
73
  invalid_properties = Array.new
67
74
  invalid_properties
68
75
  end
@@ -70,9 +77,20 @@ module MessenteApi
70
77
  # Check to see if the all the properties in the model are valid
71
78
  # @return true if the model is valid
72
79
  def valid?
80
+ warn '[DEPRECATED] the `valid?` method is obsolete'
73
81
  true
74
82
  end
75
83
 
84
+ # Custom attribute writer method with validation
85
+ # @param [Object] contacts Value to be assigned
86
+ def contacts=(contacts)
87
+ if contacts.nil?
88
+ fail ArgumentError, 'contacts cannot be nil'
89
+ end
90
+
91
+ @contacts = contacts
92
+ end
93
+
76
94
  # Checks equality by comparing each attribute.
77
95
  # @param [Object] Object to be compared
78
96
  def ==(o)
@@ -97,37 +115,33 @@ module MessenteApi
97
115
  # @param [Hash] attributes Model attributes in the form of hash
98
116
  # @return [Object] Returns the model itself
99
117
  def self.build_from_hash(attributes)
100
- new.build_from_hash(attributes)
101
- end
102
-
103
- # Builds the object from hash
104
- # @param [Hash] attributes Model attributes in the form of hash
105
- # @return [Object] Returns the model itself
106
- def build_from_hash(attributes)
107
118
  return nil unless attributes.is_a?(Hash)
108
- self.class.openapi_types.each_pair do |key, type|
109
- if type =~ /\AArray<(.*)>/i
119
+ attributes = attributes.transform_keys(&:to_sym)
120
+ transformed_hash = {}
121
+ openapi_types.each_pair do |key, type|
122
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
123
+ transformed_hash["#{key}"] = nil
124
+ elsif type =~ /\AArray<(.*)>/i
110
125
  # check to ensure the input is an array given that the attribute
111
126
  # is documented as an array but the input is not
112
- if attributes[self.class.attribute_map[key]].is_a?(Array)
113
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
127
+ if attributes[attribute_map[key]].is_a?(Array)
128
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
114
129
  end
115
- elsif !attributes[self.class.attribute_map[key]].nil?
116
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
117
- end # or else data not found in attributes(hash), not an issue as the data can be optional
130
+ elsif !attributes[attribute_map[key]].nil?
131
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
132
+ end
118
133
  end
119
-
120
- self
134
+ new(transformed_hash)
121
135
  end
122
136
 
123
137
  # Deserializes the data based on type
124
138
  # @param string type Data type
125
139
  # @param string value Value to be deserialized
126
140
  # @return [Object] Deserialized data
127
- def _deserialize(type, value)
141
+ def self._deserialize(type, value)
128
142
  case type.to_sym
129
- when :DateTime
130
- DateTime.parse(value)
143
+ when :Time
144
+ Time.parse(value)
131
145
  when :Date
132
146
  Date.parse(value)
133
147
  when :String
@@ -157,7 +171,9 @@ module MessenteApi
157
171
  end
158
172
  end
159
173
  else # model
160
- MessenteApi.const_get(type).build_from_hash(value)
174
+ # models (e.g. Pet) or oneOf
175
+ klass = MessenteApi.const_get(type)
176
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
161
177
  end
162
178
  end
163
179
 
@@ -183,7 +199,7 @@ module MessenteApi
183
199
  is_nullable = self.class.openapi_nullable.include?(attr)
184
200
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
185
201
  end
186
-
202
+
187
203
  hash[param] = _to_hash(value)
188
204
  end
189
205
  hash
@@ -206,5 +222,7 @@ module MessenteApi
206
222
  value
207
223
  end
208
224
  end
225
+
209
226
  end
227
+
210
228
  end
@@ -3,14 +3,15 @@
3
3
 
4
4
  #[Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world.
5
5
 
6
- The version of the OpenAPI document: 1.4.0
6
+ The version of the OpenAPI document: 2.0.0
7
7
  Contact: messente@messente.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ Generator version: 7.6.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module MessenteApi
16
17
  # A container for response fields of a contact
@@ -65,6 +66,11 @@ module MessenteApi
65
66
  }
66
67
  end
67
68
 
69
+ # Returns all the JSON keys this model knows about
70
+ def self.acceptable_attributes
71
+ attribute_map.values
72
+ end
73
+
68
74
  # Attribute type mapping.
69
75
  def self.openapi_types
70
76
  {
@@ -161,6 +167,7 @@ module MessenteApi
161
167
  # Show invalid properties with the reasons. Usually used together with valid?
162
168
  # @return Array for valid properties with the reasons
163
169
  def list_invalid_properties
170
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
164
171
  invalid_properties = Array.new
165
172
  invalid_properties
166
173
  end
@@ -168,6 +175,7 @@ module MessenteApi
168
175
  # Check to see if the all the properties in the model are valid
169
176
  # @return true if the model is valid
170
177
  def valid?
178
+ warn '[DEPRECATED] the `valid?` method is obsolete'
171
179
  true
172
180
  end
173
181
 
@@ -205,37 +213,33 @@ module MessenteApi
205
213
  # @param [Hash] attributes Model attributes in the form of hash
206
214
  # @return [Object] Returns the model itself
207
215
  def self.build_from_hash(attributes)
208
- new.build_from_hash(attributes)
209
- end
210
-
211
- # Builds the object from hash
212
- # @param [Hash] attributes Model attributes in the form of hash
213
- # @return [Object] Returns the model itself
214
- def build_from_hash(attributes)
215
216
  return nil unless attributes.is_a?(Hash)
216
- self.class.openapi_types.each_pair do |key, type|
217
- if type =~ /\AArray<(.*)>/i
217
+ attributes = attributes.transform_keys(&:to_sym)
218
+ transformed_hash = {}
219
+ openapi_types.each_pair do |key, type|
220
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
221
+ transformed_hash["#{key}"] = nil
222
+ elsif type =~ /\AArray<(.*)>/i
218
223
  # check to ensure the input is an array given that the attribute
219
224
  # is documented as an array but the input is not
220
- if attributes[self.class.attribute_map[key]].is_a?(Array)
221
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
225
+ if attributes[attribute_map[key]].is_a?(Array)
226
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
222
227
  end
223
- elsif !attributes[self.class.attribute_map[key]].nil?
224
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
225
- end # or else data not found in attributes(hash), not an issue as the data can be optional
228
+ elsif !attributes[attribute_map[key]].nil?
229
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
230
+ end
226
231
  end
227
-
228
- self
232
+ new(transformed_hash)
229
233
  end
230
234
 
231
235
  # Deserializes the data based on type
232
236
  # @param string type Data type
233
237
  # @param string value Value to be deserialized
234
238
  # @return [Object] Deserialized data
235
- def _deserialize(type, value)
239
+ def self._deserialize(type, value)
236
240
  case type.to_sym
237
- when :DateTime
238
- DateTime.parse(value)
241
+ when :Time
242
+ Time.parse(value)
239
243
  when :Date
240
244
  Date.parse(value)
241
245
  when :String
@@ -265,7 +269,9 @@ module MessenteApi
265
269
  end
266
270
  end
267
271
  else # model
268
- MessenteApi.const_get(type).build_from_hash(value)
272
+ # models (e.g. Pet) or oneOf
273
+ klass = MessenteApi.const_get(type)
274
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
269
275
  end
270
276
  end
271
277
 
@@ -291,7 +297,7 @@ module MessenteApi
291
297
  is_nullable = self.class.openapi_nullable.include?(attr)
292
298
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
293
299
  end
294
-
300
+
295
301
  hash[param] = _to_hash(value)
296
302
  end
297
303
  hash
@@ -314,5 +320,7 @@ module MessenteApi
314
320
  value
315
321
  end
316
322
  end
323
+
317
324
  end
325
+
318
326
  end
@@ -3,14 +3,15 @@
3
3
 
4
4
  #[Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world.
5
5
 
6
- The version of the OpenAPI document: 1.4.0
6
+ The version of the OpenAPI document: 2.0.0
7
7
  Contact: messente@messente.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ Generator version: 7.6.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module MessenteApi
16
17
  # A container for fields of a contact
@@ -57,6 +58,11 @@ module MessenteApi
57
58
  }
58
59
  end
59
60
 
61
+ # Returns all the JSON keys this model knows about
62
+ def self.acceptable_attributes
63
+ attribute_map.values
64
+ end
65
+
60
66
  # Attribute type mapping.
61
67
  def self.openapi_types
62
68
  {
@@ -142,6 +148,7 @@ module MessenteApi
142
148
  # Show invalid properties with the reasons. Usually used together with valid?
143
149
  # @return Array for valid properties with the reasons
144
150
  def list_invalid_properties
151
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
145
152
  invalid_properties = Array.new
146
153
  invalid_properties
147
154
  end
@@ -149,6 +156,7 @@ module MessenteApi
149
156
  # Check to see if the all the properties in the model are valid
150
157
  # @return true if the model is valid
151
158
  def valid?
159
+ warn '[DEPRECATED] the `valid?` method is obsolete'
152
160
  true
153
161
  end
154
162
 
@@ -184,37 +192,33 @@ module MessenteApi
184
192
  # @param [Hash] attributes Model attributes in the form of hash
185
193
  # @return [Object] Returns the model itself
186
194
  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
195
  return nil unless attributes.is_a?(Hash)
195
- self.class.openapi_types.each_pair do |key, type|
196
- if type =~ /\AArray<(.*)>/i
196
+ attributes = attributes.transform_keys(&:to_sym)
197
+ transformed_hash = {}
198
+ openapi_types.each_pair do |key, type|
199
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
200
+ transformed_hash["#{key}"] = nil
201
+ elsif type =~ /\AArray<(.*)>/i
197
202
  # check to ensure the input is an array given that the attribute
198
203
  # is documented as an array but the input is not
199
- if attributes[self.class.attribute_map[key]].is_a?(Array)
200
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
204
+ if attributes[attribute_map[key]].is_a?(Array)
205
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
201
206
  end
202
- elsif !attributes[self.class.attribute_map[key]].nil?
203
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
204
- end # or else data not found in attributes(hash), not an issue as the data can be optional
207
+ elsif !attributes[attribute_map[key]].nil?
208
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
209
+ end
205
210
  end
206
-
207
- self
211
+ new(transformed_hash)
208
212
  end
209
213
 
210
214
  # Deserializes the data based on type
211
215
  # @param string type Data type
212
216
  # @param string value Value to be deserialized
213
217
  # @return [Object] Deserialized data
214
- def _deserialize(type, value)
218
+ def self._deserialize(type, value)
215
219
  case type.to_sym
216
- when :DateTime
217
- DateTime.parse(value)
220
+ when :Time
221
+ Time.parse(value)
218
222
  when :Date
219
223
  Date.parse(value)
220
224
  when :String
@@ -244,7 +248,9 @@ module MessenteApi
244
248
  end
245
249
  end
246
250
  else # model
247
- MessenteApi.const_get(type).build_from_hash(value)
251
+ # models (e.g. Pet) or oneOf
252
+ klass = MessenteApi.const_get(type)
253
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
248
254
  end
249
255
  end
250
256
 
@@ -270,7 +276,7 @@ module MessenteApi
270
276
  is_nullable = self.class.openapi_nullable.include?(attr)
271
277
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
272
278
  end
273
-
279
+
274
280
  hash[param] = _to_hash(value)
275
281
  end
276
282
  hash
@@ -293,5 +299,7 @@ module MessenteApi
293
299
  value
294
300
  end
295
301
  end
302
+
296
303
  end
304
+
297
305
  end
@@ -3,14 +3,15 @@
3
3
 
4
4
  #[Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world.
5
5
 
6
- The version of the OpenAPI document: 1.4.0
6
+ The version of the OpenAPI document: 2.0.0
7
7
  Contact: messente@messente.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ Generator version: 7.6.0
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module MessenteApi
16
17
  # A container for successful delivery report response
@@ -33,6 +34,11 @@ module MessenteApi
33
34
  }
34
35
  end
35
36
 
37
+ # Returns all the JSON keys this model knows about
38
+ def self.acceptable_attributes
39
+ attribute_map.values
40
+ end
41
+
36
42
  # Attribute type mapping.
37
43
  def self.openapi_types
38
44
  {
@@ -67,20 +73,27 @@ module MessenteApi
67
73
  if (value = attributes[:'statuses']).is_a?(Array)
68
74
  self.statuses = value
69
75
  end
76
+ else
77
+ self.statuses = nil
70
78
  end
71
79
 
72
80
  if attributes.key?(:'to')
73
81
  self.to = attributes[:'to']
82
+ else
83
+ self.to = nil
74
84
  end
75
85
 
76
86
  if attributes.key?(:'omnimessage_id')
77
87
  self.omnimessage_id = attributes[:'omnimessage_id']
88
+ else
89
+ self.omnimessage_id = nil
78
90
  end
79
91
  end
80
92
 
81
93
  # Show invalid properties with the reasons. Usually used together with valid?
82
94
  # @return Array for valid properties with the reasons
83
95
  def list_invalid_properties
96
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
84
97
  invalid_properties = Array.new
85
98
  if @statuses.nil?
86
99
  invalid_properties.push('invalid value for "statuses", statuses cannot be nil.')
@@ -100,6 +113,7 @@ module MessenteApi
100
113
  # Check to see if the all the properties in the model are valid
101
114
  # @return true if the model is valid
102
115
  def valid?
116
+ warn '[DEPRECATED] the `valid?` method is obsolete'
103
117
  return false if @statuses.nil?
104
118
  return false if @to.nil?
105
119
  return false if @omnimessage_id.nil?
@@ -132,37 +146,33 @@ module MessenteApi
132
146
  # @param [Hash] attributes Model attributes in the form of hash
133
147
  # @return [Object] Returns the model itself
134
148
  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
149
  return nil unless attributes.is_a?(Hash)
143
- self.class.openapi_types.each_pair do |key, type|
144
- if type =~ /\AArray<(.*)>/i
150
+ attributes = attributes.transform_keys(&:to_sym)
151
+ transformed_hash = {}
152
+ openapi_types.each_pair do |key, type|
153
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
154
+ transformed_hash["#{key}"] = nil
155
+ elsif type =~ /\AArray<(.*)>/i
145
156
  # check to ensure the input is an array given that the attribute
146
157
  # is documented as an array but the input is not
147
- if attributes[self.class.attribute_map[key]].is_a?(Array)
148
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
158
+ if attributes[attribute_map[key]].is_a?(Array)
159
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
149
160
  end
150
- elsif !attributes[self.class.attribute_map[key]].nil?
151
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
152
- end # or else data not found in attributes(hash), not an issue as the data can be optional
161
+ elsif !attributes[attribute_map[key]].nil?
162
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
163
+ end
153
164
  end
154
-
155
- self
165
+ new(transformed_hash)
156
166
  end
157
167
 
158
168
  # Deserializes the data based on type
159
169
  # @param string type Data type
160
170
  # @param string value Value to be deserialized
161
171
  # @return [Object] Deserialized data
162
- def _deserialize(type, value)
172
+ def self._deserialize(type, value)
163
173
  case type.to_sym
164
- when :DateTime
165
- DateTime.parse(value)
174
+ when :Time
175
+ Time.parse(value)
166
176
  when :Date
167
177
  Date.parse(value)
168
178
  when :String
@@ -192,7 +202,9 @@ module MessenteApi
192
202
  end
193
203
  end
194
204
  else # model
195
- MessenteApi.const_get(type).build_from_hash(value)
205
+ # models (e.g. Pet) or oneOf
206
+ klass = MessenteApi.const_get(type)
207
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
196
208
  end
197
209
  end
198
210
 
@@ -218,7 +230,7 @@ module MessenteApi
218
230
  is_nullable = self.class.openapi_nullable.include?(attr)
219
231
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
220
232
  end
221
-
233
+
222
234
  hash[param] = _to_hash(value)
223
235
  end
224
236
  hash
@@ -241,5 +253,7 @@ module MessenteApi
241
253
  value
242
254
  end
243
255
  end
256
+
244
257
  end
258
+
245
259
  end