messente_api 1.3.1 → 2.1.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 (150) 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 -15
  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 +15 -0
  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 +22 -19
  61. data/docs/WhatsApp.md +16 -19
  62. data/docs/WhatsAppComponent.md +24 -0
  63. data/docs/WhatsAppCurrency.md +22 -0
  64. data/docs/WhatsAppDatetime.md +18 -0
  65. data/docs/WhatsAppLanguage.md +20 -0
  66. data/docs/WhatsAppMedia.md +24 -0
  67. data/docs/WhatsAppParameter.md +30 -0
  68. data/docs/WhatsAppTemplate.md +22 -0
  69. data/git_push.sh +3 -4
  70. data/lib/messente_api/api/blacklist_api.rb +22 -15
  71. data/lib/messente_api/api/bulk_messaging_api.rb +88 -0
  72. data/lib/messente_api/api/contacts_api.rb +42 -28
  73. data/lib/messente_api/api/delivery_report_api.rb +6 -5
  74. data/lib/messente_api/api/groups_api.rb +30 -19
  75. data/lib/messente_api/api/number_lookup_api.rb +10 -6
  76. data/lib/messente_api/api/omnimessage_api.rb +14 -9
  77. data/lib/messente_api/api/statistics_api.rb +10 -6
  78. data/lib/messente_api/api_client.rb +72 -66
  79. data/lib/messente_api/api_error.rb +3 -2
  80. data/lib/messente_api/configuration.rb +64 -14
  81. data/lib/messente_api/models/{whats_app_audio.rb → bulk_omni_message_create_success_response.rb} +50 -38
  82. data/lib/messente_api/models/bulk_omni_message_create_success_response_messages_inner.rb +105 -0
  83. data/lib/messente_api/models/{whats_app_text.rb → bulk_omnimessage.rb} +49 -49
  84. data/lib/messente_api/models/channel.rb +9 -5
  85. data/lib/messente_api/models/contact_envelope.rb +31 -23
  86. data/lib/messente_api/models/contact_fields.rb +33 -23
  87. data/lib/messente_api/models/contact_list_envelope.rb +41 -23
  88. data/lib/messente_api/models/contact_response_fields.rb +31 -23
  89. data/lib/messente_api/models/contact_update_fields.rb +31 -23
  90. data/lib/messente_api/models/delivery_report_response.rb +37 -23
  91. data/lib/messente_api/models/delivery_result.rb +77 -27
  92. data/lib/messente_api/models/error_code_omnichannel.rb +9 -5
  93. data/lib/messente_api/models/error_code_omnichannel_machine.rb +9 -5
  94. data/lib/messente_api/models/error_code_phonebook.rb +9 -5
  95. data/lib/messente_api/models/error_code_statistics.rb +9 -5
  96. data/lib/messente_api/models/error_item_number_lookup.rb +33 -23
  97. data/lib/messente_api/models/error_item_number_lookup_error.rb +35 -23
  98. data/lib/messente_api/models/error_item_omnichannel.rb +61 -23
  99. data/lib/messente_api/models/error_item_phonebook.rb +59 -23
  100. data/lib/messente_api/models/error_item_statistics.rb +59 -23
  101. data/lib/messente_api/models/error_number_lookup.rb +33 -23
  102. data/lib/messente_api/models/error_omnichannel.rb +33 -23
  103. data/lib/messente_api/models/error_phonebook.rb +33 -23
  104. data/lib/messente_api/models/error_statistics.rb +33 -23
  105. data/lib/messente_api/models/error_title_omnichannel.rb +9 -5
  106. data/lib/messente_api/models/error_title_phonebook.rb +9 -5
  107. data/lib/messente_api/models/fetch_blacklist_success.rb +41 -23
  108. data/lib/messente_api/models/group_envelope.rb +31 -23
  109. data/lib/messente_api/models/group_list_envelope.rb +41 -23
  110. data/lib/messente_api/models/group_name.rb +33 -23
  111. data/lib/messente_api/models/group_response_fields.rb +37 -23
  112. data/lib/messente_api/models/message_result.rb +59 -23
  113. data/lib/messente_api/models/mobile_network.rb +31 -23
  114. data/lib/messente_api/models/number_to_blacklist.rb +33 -23
  115. data/lib/messente_api/models/numbers_to_investigate.rb +62 -24
  116. data/lib/messente_api/models/omni_message_create_success_response.rb +37 -23
  117. data/lib/messente_api/models/omnimessage.rb +71 -28
  118. data/lib/messente_api/models/omnimessage_messages_inner.rb +107 -0
  119. data/lib/messente_api/models/price_info.rb +257 -0
  120. data/lib/messente_api/models/priority.rb +41 -0
  121. data/lib/messente_api/models/sms.rb +45 -25
  122. data/lib/messente_api/models/statistics_report.rb +37 -23
  123. data/lib/messente_api/models/statistics_report_settings.rb +35 -23
  124. data/lib/messente_api/models/statistics_report_success.rb +33 -23
  125. data/lib/messente_api/models/status.rb +9 -5
  126. data/lib/messente_api/models/sync_number_lookup_result.rb +35 -24
  127. data/lib/messente_api/models/sync_number_lookup_success.rb +35 -23
  128. data/lib/messente_api/models/telegram.rb +31 -23
  129. data/lib/messente_api/models/text_store.rb +9 -5
  130. data/lib/messente_api/models/viber.rb +43 -25
  131. data/lib/messente_api/models/whats_app.rb +45 -54
  132. data/lib/messente_api/models/whats_app_component.rb +255 -0
  133. data/lib/messente_api/models/whats_app_currency.rb +257 -0
  134. data/lib/messente_api/models/{whats_app_document.rb → whats_app_datetime.rb} +48 -48
  135. data/lib/messente_api/models/{whats_app_image.rb → whats_app_language.rb} +55 -45
  136. data/lib/messente_api/models/whats_app_media.rb +246 -0
  137. data/lib/messente_api/models/whats_app_parameter.rb +278 -0
  138. data/lib/messente_api/models/whats_app_template.rb +251 -0
  139. data/lib/messente_api/version.rb +3 -3
  140. data/lib/messente_api.rb +16 -6
  141. data/messente_api.gemspec +5 -5
  142. data/spec/spec_helper.rb +2 -2
  143. metadata +35 -40
  144. data/docs/WhatsAppAudio.md +0 -17
  145. data/docs/WhatsAppDocument.md +0 -19
  146. data/docs/WhatsAppImage.md +0 -19
  147. data/docs/WhatsAppText.md +0 -19
  148. data/messente_api-1.3.0.gem +0 -0
  149. data/spec/api_client_spec.rb +0 -226
  150. 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.3.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 message part of an omnimessage
@@ -23,6 +24,28 @@ module MessenteApi
23
24
  # Sender that was used for the message
24
25
  attr_accessor :sender
25
26
 
27
+ class EnumAttributeValidator
28
+ attr_reader :datatype
29
+ attr_reader :allowable_values
30
+
31
+ def initialize(datatype, allowable_values)
32
+ @allowable_values = allowable_values.map do |value|
33
+ case datatype.to_s
34
+ when /Integer/i
35
+ value.to_i
36
+ when /Float/i
37
+ value.to_f
38
+ else
39
+ value
40
+ end
41
+ end
42
+ end
43
+
44
+ def valid?(value)
45
+ !value || allowable_values.include?(value)
46
+ end
47
+ end
48
+
26
49
  # Attribute mapping from ruby-style variable name to JSON key.
27
50
  def self.attribute_map
28
51
  {
@@ -32,6 +55,11 @@ module MessenteApi
32
55
  }
33
56
  end
34
57
 
58
+ # Returns all the JSON keys this model knows about
59
+ def self.acceptable_attributes
60
+ attribute_map.values
61
+ end
62
+
35
63
  # Attribute type mapping.
36
64
  def self.openapi_types
37
65
  {
@@ -64,20 +92,27 @@ module MessenteApi
64
92
 
65
93
  if attributes.key?(:'message_id')
66
94
  self.message_id = attributes[:'message_id']
95
+ else
96
+ self.message_id = nil
67
97
  end
68
98
 
69
99
  if attributes.key?(:'channel')
70
100
  self.channel = attributes[:'channel']
101
+ else
102
+ self.channel = nil
71
103
  end
72
104
 
73
105
  if attributes.key?(:'sender')
74
106
  self.sender = attributes[:'sender']
107
+ else
108
+ self.sender = nil
75
109
  end
76
110
  end
77
111
 
78
112
  # Show invalid properties with the reasons. Usually used together with valid?
79
113
  # @return Array for valid properties with the reasons
80
114
  def list_invalid_properties
115
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
81
116
  invalid_properties = Array.new
82
117
  if @message_id.nil?
83
118
  invalid_properties.push('invalid value for "message_id", message_id cannot be nil.')
@@ -97,6 +132,7 @@ module MessenteApi
97
132
  # Check to see if the all the properties in the model are valid
98
133
  # @return true if the model is valid
99
134
  def valid?
135
+ warn '[DEPRECATED] the `valid?` method is obsolete'
100
136
  return false if @message_id.nil?
101
137
  return false if @channel.nil?
102
138
  return false if @sender.nil?
@@ -129,37 +165,33 @@ module MessenteApi
129
165
  # @param [Hash] attributes Model attributes in the form of hash
130
166
  # @return [Object] Returns the model itself
131
167
  def self.build_from_hash(attributes)
132
- new.build_from_hash(attributes)
133
- end
134
-
135
- # Builds the object from hash
136
- # @param [Hash] attributes Model attributes in the form of hash
137
- # @return [Object] Returns the model itself
138
- def build_from_hash(attributes)
139
168
  return nil unless attributes.is_a?(Hash)
140
- self.class.openapi_types.each_pair do |key, type|
141
- if type =~ /\AArray<(.*)>/i
169
+ attributes = attributes.transform_keys(&:to_sym)
170
+ transformed_hash = {}
171
+ openapi_types.each_pair do |key, type|
172
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
173
+ transformed_hash["#{key}"] = nil
174
+ elsif type =~ /\AArray<(.*)>/i
142
175
  # check to ensure the input is an array given that the attribute
143
176
  # is documented as an array but the input is not
144
- if attributes[self.class.attribute_map[key]].is_a?(Array)
145
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
177
+ if attributes[attribute_map[key]].is_a?(Array)
178
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
146
179
  end
147
- elsif !attributes[self.class.attribute_map[key]].nil?
148
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
149
- end # or else data not found in attributes(hash), not an issue as the data can be optional
180
+ elsif !attributes[attribute_map[key]].nil?
181
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
182
+ end
150
183
  end
151
-
152
- self
184
+ new(transformed_hash)
153
185
  end
154
186
 
155
187
  # Deserializes the data based on type
156
188
  # @param string type Data type
157
189
  # @param string value Value to be deserialized
158
190
  # @return [Object] Deserialized data
159
- def _deserialize(type, value)
191
+ def self._deserialize(type, value)
160
192
  case type.to_sym
161
- when :DateTime
162
- DateTime.parse(value)
193
+ when :Time
194
+ Time.parse(value)
163
195
  when :Date
164
196
  Date.parse(value)
165
197
  when :String
@@ -189,7 +221,9 @@ module MessenteApi
189
221
  end
190
222
  end
191
223
  else # model
192
- MessenteApi.const_get(type).build_from_hash(value)
224
+ # models (e.g. Pet) or oneOf
225
+ klass = MessenteApi.const_get(type)
226
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
193
227
  end
194
228
  end
195
229
 
@@ -215,7 +249,7 @@ module MessenteApi
215
249
  is_nullable = self.class.openapi_nullable.include?(attr)
216
250
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
217
251
  end
218
-
252
+
219
253
  hash[param] = _to_hash(value)
220
254
  end
221
255
  hash
@@ -238,5 +272,7 @@ module MessenteApi
238
272
  value
239
273
  end
240
274
  end
275
+
241
276
  end
277
+
242
278
  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.3.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
  # Info about the network related to the phone number
@@ -41,6 +42,11 @@ module MessenteApi
41
42
  }
42
43
  end
43
44
 
45
+ # Returns all the JSON keys this model knows about
46
+ def self.acceptable_attributes
47
+ attribute_map.values
48
+ end
49
+
44
50
  # Attribute type mapping.
45
51
  def self.openapi_types
46
52
  {
@@ -97,6 +103,7 @@ module MessenteApi
97
103
  # Show invalid properties with the reasons. Usually used together with valid?
98
104
  # @return Array for valid properties with the reasons
99
105
  def list_invalid_properties
106
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
100
107
  invalid_properties = Array.new
101
108
  invalid_properties
102
109
  end
@@ -104,6 +111,7 @@ module MessenteApi
104
111
  # Check to see if the all the properties in the model are valid
105
112
  # @return true if the model is valid
106
113
  def valid?
114
+ warn '[DEPRECATED] the `valid?` method is obsolete'
107
115
  true
108
116
  end
109
117
 
@@ -135,37 +143,33 @@ module MessenteApi
135
143
  # @param [Hash] attributes Model attributes in the form of hash
136
144
  # @return [Object] Returns the model itself
137
145
  def self.build_from_hash(attributes)
138
- new.build_from_hash(attributes)
139
- end
140
-
141
- # Builds the object from hash
142
- # @param [Hash] attributes Model attributes in the form of hash
143
- # @return [Object] Returns the model itself
144
- def build_from_hash(attributes)
145
146
  return nil unless attributes.is_a?(Hash)
146
- self.class.openapi_types.each_pair do |key, type|
147
- if type =~ /\AArray<(.*)>/i
147
+ attributes = attributes.transform_keys(&:to_sym)
148
+ transformed_hash = {}
149
+ openapi_types.each_pair do |key, type|
150
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
151
+ transformed_hash["#{key}"] = nil
152
+ elsif type =~ /\AArray<(.*)>/i
148
153
  # check to ensure the input is an array given that the attribute
149
154
  # 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) })
155
+ if attributes[attribute_map[key]].is_a?(Array)
156
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
152
157
  end
153
- elsif !attributes[self.class.attribute_map[key]].nil?
154
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
155
- end # or else data not found in attributes(hash), not an issue as the data can be optional
158
+ elsif !attributes[attribute_map[key]].nil?
159
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
160
+ end
156
161
  end
157
-
158
- self
162
+ new(transformed_hash)
159
163
  end
160
164
 
161
165
  # Deserializes the data based on type
162
166
  # @param string type Data type
163
167
  # @param string value Value to be deserialized
164
168
  # @return [Object] Deserialized data
165
- def _deserialize(type, value)
169
+ def self._deserialize(type, value)
166
170
  case type.to_sym
167
- when :DateTime
168
- DateTime.parse(value)
171
+ when :Time
172
+ Time.parse(value)
169
173
  when :Date
170
174
  Date.parse(value)
171
175
  when :String
@@ -195,7 +199,9 @@ module MessenteApi
195
199
  end
196
200
  end
197
201
  else # model
198
- MessenteApi.const_get(type).build_from_hash(value)
202
+ # models (e.g. Pet) or oneOf
203
+ klass = MessenteApi.const_get(type)
204
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
199
205
  end
200
206
  end
201
207
 
@@ -221,7 +227,7 @@ module MessenteApi
221
227
  is_nullable = self.class.openapi_nullable.include?(attr)
222
228
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
223
229
  end
224
-
230
+
225
231
  hash[param] = _to_hash(value)
226
232
  end
227
233
  hash
@@ -244,5 +250,7 @@ module MessenteApi
244
250
  value
245
251
  end
246
252
  end
253
+
247
254
  end
255
+
248
256
  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.3.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 a soon-to-be blacklisted number
@@ -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
  {
@@ -55,12 +61,15 @@ module MessenteApi
55
61
 
56
62
  if attributes.key?(:'phone_number')
57
63
  self.phone_number = attributes[:'phone_number']
64
+ else
65
+ self.phone_number = nil
58
66
  end
59
67
  end
60
68
 
61
69
  # Show invalid properties with the reasons. Usually used together with valid?
62
70
  # @return Array for valid properties with the reasons
63
71
  def list_invalid_properties
72
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
64
73
  invalid_properties = Array.new
65
74
  if @phone_number.nil?
66
75
  invalid_properties.push('invalid value for "phone_number", phone_number cannot be nil.')
@@ -72,6 +81,7 @@ module MessenteApi
72
81
  # Check to see if the all the properties in the model are valid
73
82
  # @return true if the model is valid
74
83
  def valid?
84
+ warn '[DEPRECATED] the `valid?` method is obsolete'
75
85
  return false if @phone_number.nil?
76
86
  true
77
87
  end
@@ -100,37 +110,33 @@ module MessenteApi
100
110
  # @param [Hash] attributes Model attributes in the form of hash
101
111
  # @return [Object] Returns the model itself
102
112
  def self.build_from_hash(attributes)
103
- new.build_from_hash(attributes)
104
- end
105
-
106
- # Builds the object from hash
107
- # @param [Hash] attributes Model attributes in the form of hash
108
- # @return [Object] Returns the model itself
109
- def build_from_hash(attributes)
110
113
  return nil unless attributes.is_a?(Hash)
111
- self.class.openapi_types.each_pair do |key, type|
112
- if type =~ /\AArray<(.*)>/i
114
+ attributes = attributes.transform_keys(&:to_sym)
115
+ transformed_hash = {}
116
+ openapi_types.each_pair do |key, type|
117
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
118
+ transformed_hash["#{key}"] = nil
119
+ elsif type =~ /\AArray<(.*)>/i
113
120
  # check to ensure the input is an array given that the attribute
114
121
  # is documented as an array but the input is not
115
- if attributes[self.class.attribute_map[key]].is_a?(Array)
116
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
122
+ if attributes[attribute_map[key]].is_a?(Array)
123
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
117
124
  end
118
- elsif !attributes[self.class.attribute_map[key]].nil?
119
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
120
- end # or else data not found in attributes(hash), not an issue as the data can be optional
125
+ elsif !attributes[attribute_map[key]].nil?
126
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
127
+ end
121
128
  end
122
-
123
- self
129
+ new(transformed_hash)
124
130
  end
125
131
 
126
132
  # Deserializes the data based on type
127
133
  # @param string type Data type
128
134
  # @param string value Value to be deserialized
129
135
  # @return [Object] Deserialized data
130
- def _deserialize(type, value)
136
+ def self._deserialize(type, value)
131
137
  case type.to_sym
132
- when :DateTime
133
- DateTime.parse(value)
138
+ when :Time
139
+ Time.parse(value)
134
140
  when :Date
135
141
  Date.parse(value)
136
142
  when :String
@@ -160,7 +166,9 @@ module MessenteApi
160
166
  end
161
167
  end
162
168
  else # model
163
- MessenteApi.const_get(type).build_from_hash(value)
169
+ # models (e.g. Pet) or oneOf
170
+ klass = MessenteApi.const_get(type)
171
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
164
172
  end
165
173
  end
166
174
 
@@ -186,7 +194,7 @@ module MessenteApi
186
194
  is_nullable = self.class.openapi_nullable.include?(attr)
187
195
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
188
196
  end
189
-
197
+
190
198
  hash[param] = _to_hash(value)
191
199
  end
192
200
  hash
@@ -209,5 +217,7 @@ module MessenteApi
209
217
  value
210
218
  end
211
219
  end
220
+
212
221
  end
222
+
213
223
  end
@@ -3,19 +3,20 @@
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.3.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 phone numbers
17
18
  class NumbersToInvestigate
18
- # Array of phone numbers
19
+ # A list of phone numbers. Max 10 numbers per request
19
20
  attr_accessor :numbers
20
21
 
21
22
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -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
  {
@@ -57,27 +63,59 @@ module MessenteApi
57
63
  if (value = attributes[:'numbers']).is_a?(Array)
58
64
  self.numbers = value
59
65
  end
66
+ else
67
+ self.numbers = nil
60
68
  end
61
69
  end
62
70
 
63
71
  # Show invalid properties with the reasons. Usually used together with valid?
64
72
  # @return Array for valid properties with the reasons
65
73
  def list_invalid_properties
74
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
66
75
  invalid_properties = Array.new
67
76
  if @numbers.nil?
68
77
  invalid_properties.push('invalid value for "numbers", numbers cannot be nil.')
69
78
  end
70
79
 
80
+ if @numbers.length > 10
81
+ invalid_properties.push('invalid value for "numbers", number of items must be less than or equal to 10.')
82
+ end
83
+
84
+ if @numbers.length < 1
85
+ invalid_properties.push('invalid value for "numbers", number of items must be greater than or equal to 1.')
86
+ end
87
+
71
88
  invalid_properties
72
89
  end
73
90
 
74
91
  # Check to see if the all the properties in the model are valid
75
92
  # @return true if the model is valid
76
93
  def valid?
94
+ warn '[DEPRECATED] the `valid?` method is obsolete'
77
95
  return false if @numbers.nil?
96
+ return false if @numbers.length > 10
97
+ return false if @numbers.length < 1
78
98
  true
79
99
  end
80
100
 
101
+ # Custom attribute writer method with validation
102
+ # @param [Object] numbers Value to be assigned
103
+ def numbers=(numbers)
104
+ if numbers.nil?
105
+ fail ArgumentError, 'numbers cannot be nil'
106
+ end
107
+
108
+ if numbers.length > 10
109
+ fail ArgumentError, 'invalid value for "numbers", number of items must be less than or equal to 10.'
110
+ end
111
+
112
+ if numbers.length < 1
113
+ fail ArgumentError, 'invalid value for "numbers", number of items must be greater than or equal to 1.'
114
+ end
115
+
116
+ @numbers = numbers
117
+ end
118
+
81
119
  # Checks equality by comparing each attribute.
82
120
  # @param [Object] Object to be compared
83
121
  def ==(o)
@@ -102,37 +140,33 @@ module MessenteApi
102
140
  # @param [Hash] attributes Model attributes in the form of hash
103
141
  # @return [Object] Returns the model itself
104
142
  def self.build_from_hash(attributes)
105
- new.build_from_hash(attributes)
106
- end
107
-
108
- # Builds the object from hash
109
- # @param [Hash] attributes Model attributes in the form of hash
110
- # @return [Object] Returns the model itself
111
- def build_from_hash(attributes)
112
143
  return nil unless attributes.is_a?(Hash)
113
- self.class.openapi_types.each_pair do |key, type|
114
- if type =~ /\AArray<(.*)>/i
144
+ attributes = attributes.transform_keys(&:to_sym)
145
+ transformed_hash = {}
146
+ openapi_types.each_pair do |key, type|
147
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
148
+ transformed_hash["#{key}"] = nil
149
+ elsif type =~ /\AArray<(.*)>/i
115
150
  # check to ensure the input is an array given that the attribute
116
151
  # is documented as an array but the input is not
117
- if attributes[self.class.attribute_map[key]].is_a?(Array)
118
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
152
+ if attributes[attribute_map[key]].is_a?(Array)
153
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
119
154
  end
120
- elsif !attributes[self.class.attribute_map[key]].nil?
121
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
122
- end # or else data not found in attributes(hash), not an issue as the data can be optional
155
+ elsif !attributes[attribute_map[key]].nil?
156
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
157
+ end
123
158
  end
124
-
125
- self
159
+ new(transformed_hash)
126
160
  end
127
161
 
128
162
  # Deserializes the data based on type
129
163
  # @param string type Data type
130
164
  # @param string value Value to be deserialized
131
165
  # @return [Object] Deserialized data
132
- def _deserialize(type, value)
166
+ def self._deserialize(type, value)
133
167
  case type.to_sym
134
- when :DateTime
135
- DateTime.parse(value)
168
+ when :Time
169
+ Time.parse(value)
136
170
  when :Date
137
171
  Date.parse(value)
138
172
  when :String
@@ -162,7 +196,9 @@ module MessenteApi
162
196
  end
163
197
  end
164
198
  else # model
165
- MessenteApi.const_get(type).build_from_hash(value)
199
+ # models (e.g. Pet) or oneOf
200
+ klass = MessenteApi.const_get(type)
201
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
166
202
  end
167
203
  end
168
204
 
@@ -188,7 +224,7 @@ module MessenteApi
188
224
  is_nullable = self.class.openapi_nullable.include?(attr)
189
225
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
190
226
  end
191
-
227
+
192
228
  hash[param] = _to_hash(value)
193
229
  end
194
230
  hash
@@ -211,5 +247,7 @@ module MessenteApi
211
247
  value
212
248
  end
213
249
  end
250
+
214
251
  end
252
+
215
253
  end