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 Omnichannel API error
@@ -25,6 +26,28 @@ module MessenteApi
25
26
  # Describes which field is causing the issue in the payload, null for non 400 status code responses
26
27
  attr_accessor :source
27
28
 
29
+ class EnumAttributeValidator
30
+ attr_reader :datatype
31
+ attr_reader :allowable_values
32
+
33
+ def initialize(datatype, allowable_values)
34
+ @allowable_values = allowable_values.map do |value|
35
+ case datatype.to_s
36
+ when /Integer/i
37
+ value.to_i
38
+ when /Float/i
39
+ value.to_f
40
+ else
41
+ value
42
+ end
43
+ end
44
+ end
45
+
46
+ def valid?(value)
47
+ !value || allowable_values.include?(value)
48
+ end
49
+ end
50
+
28
51
  # Attribute mapping from ruby-style variable name to JSON key.
29
52
  def self.attribute_map
30
53
  {
@@ -35,6 +58,11 @@ module MessenteApi
35
58
  }
36
59
  end
37
60
 
61
+ # Returns all the JSON keys this model knows about
62
+ def self.acceptable_attributes
63
+ attribute_map.values
64
+ end
65
+
38
66
  # Attribute type mapping.
39
67
  def self.openapi_types
40
68
  {
@@ -69,24 +97,33 @@ module MessenteApi
69
97
 
70
98
  if attributes.key?(:'title')
71
99
  self.title = attributes[:'title']
100
+ else
101
+ self.title = nil
72
102
  end
73
103
 
74
104
  if attributes.key?(:'detail')
75
105
  self.detail = attributes[:'detail']
106
+ else
107
+ self.detail = nil
76
108
  end
77
109
 
78
110
  if attributes.key?(:'code')
79
111
  self.code = attributes[:'code']
112
+ else
113
+ self.code = nil
80
114
  end
81
115
 
82
116
  if attributes.key?(:'source')
83
117
  self.source = attributes[:'source']
118
+ else
119
+ self.source = nil
84
120
  end
85
121
  end
86
122
 
87
123
  # Show invalid properties with the reasons. Usually used together with valid?
88
124
  # @return Array for valid properties with the reasons
89
125
  def list_invalid_properties
126
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
90
127
  invalid_properties = Array.new
91
128
  if @title.nil?
92
129
  invalid_properties.push('invalid value for "title", title cannot be nil.')
@@ -106,6 +143,7 @@ module MessenteApi
106
143
  # Check to see if the all the properties in the model are valid
107
144
  # @return true if the model is valid
108
145
  def valid?
146
+ warn '[DEPRECATED] the `valid?` method is obsolete'
109
147
  return false if @title.nil?
110
148
  return false if @detail.nil?
111
149
  return false if @code.nil?
@@ -139,37 +177,33 @@ module MessenteApi
139
177
  # @param [Hash] attributes Model attributes in the form of hash
140
178
  # @return [Object] Returns the model itself
141
179
  def self.build_from_hash(attributes)
142
- new.build_from_hash(attributes)
143
- end
144
-
145
- # Builds the object from hash
146
- # @param [Hash] attributes Model attributes in the form of hash
147
- # @return [Object] Returns the model itself
148
- def build_from_hash(attributes)
149
180
  return nil unless attributes.is_a?(Hash)
150
- self.class.openapi_types.each_pair do |key, type|
151
- if type =~ /\AArray<(.*)>/i
181
+ attributes = attributes.transform_keys(&:to_sym)
182
+ transformed_hash = {}
183
+ openapi_types.each_pair do |key, type|
184
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
185
+ transformed_hash["#{key}"] = nil
186
+ elsif type =~ /\AArray<(.*)>/i
152
187
  # check to ensure the input is an array given that the attribute
153
188
  # is documented as an array but the input is not
154
- if attributes[self.class.attribute_map[key]].is_a?(Array)
155
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
189
+ if attributes[attribute_map[key]].is_a?(Array)
190
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
156
191
  end
157
- elsif !attributes[self.class.attribute_map[key]].nil?
158
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
159
- end # or else data not found in attributes(hash), not an issue as the data can be optional
192
+ elsif !attributes[attribute_map[key]].nil?
193
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
194
+ end
160
195
  end
161
-
162
- self
196
+ new(transformed_hash)
163
197
  end
164
198
 
165
199
  # Deserializes the data based on type
166
200
  # @param string type Data type
167
201
  # @param string value Value to be deserialized
168
202
  # @return [Object] Deserialized data
169
- def _deserialize(type, value)
203
+ def self._deserialize(type, value)
170
204
  case type.to_sym
171
- when :DateTime
172
- DateTime.parse(value)
205
+ when :Time
206
+ Time.parse(value)
173
207
  when :Date
174
208
  Date.parse(value)
175
209
  when :String
@@ -199,7 +233,9 @@ module MessenteApi
199
233
  end
200
234
  end
201
235
  else # model
202
- MessenteApi.const_get(type).build_from_hash(value)
236
+ # models (e.g. Pet) or oneOf
237
+ klass = MessenteApi.const_get(type)
238
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
203
239
  end
204
240
  end
205
241
 
@@ -225,7 +261,7 @@ module MessenteApi
225
261
  is_nullable = self.class.openapi_nullable.include?(attr)
226
262
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
227
263
  end
228
-
264
+
229
265
  hash[param] = _to_hash(value)
230
266
  end
231
267
  hash
@@ -248,5 +284,7 @@ module MessenteApi
248
284
  value
249
285
  end
250
286
  end
287
+
251
288
  end
289
+
252
290
  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 Phonebook API error
@@ -22,6 +23,28 @@ module MessenteApi
22
23
 
23
24
  attr_accessor :code
24
25
 
26
+ class EnumAttributeValidator
27
+ attr_reader :datatype
28
+ attr_reader :allowable_values
29
+
30
+ def initialize(datatype, allowable_values)
31
+ @allowable_values = allowable_values.map do |value|
32
+ case datatype.to_s
33
+ when /Integer/i
34
+ value.to_i
35
+ when /Float/i
36
+ value.to_f
37
+ else
38
+ value
39
+ end
40
+ end
41
+ end
42
+
43
+ def valid?(value)
44
+ !value || allowable_values.include?(value)
45
+ end
46
+ end
47
+
25
48
  # Attribute mapping from ruby-style variable name to JSON key.
26
49
  def self.attribute_map
27
50
  {
@@ -31,6 +54,11 @@ module MessenteApi
31
54
  }
32
55
  end
33
56
 
57
+ # Returns all the JSON keys this model knows about
58
+ def self.acceptable_attributes
59
+ attribute_map.values
60
+ end
61
+
34
62
  # Attribute type mapping.
35
63
  def self.openapi_types
36
64
  {
@@ -63,20 +91,27 @@ module MessenteApi
63
91
 
64
92
  if attributes.key?(:'title')
65
93
  self.title = attributes[:'title']
94
+ else
95
+ self.title = nil
66
96
  end
67
97
 
68
98
  if attributes.key?(:'detail')
69
99
  self.detail = attributes[:'detail']
100
+ else
101
+ self.detail = nil
70
102
  end
71
103
 
72
104
  if attributes.key?(:'code')
73
105
  self.code = attributes[:'code']
106
+ else
107
+ self.code = nil
74
108
  end
75
109
  end
76
110
 
77
111
  # Show invalid properties with the reasons. Usually used together with valid?
78
112
  # @return Array for valid properties with the reasons
79
113
  def list_invalid_properties
114
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
80
115
  invalid_properties = Array.new
81
116
  if @title.nil?
82
117
  invalid_properties.push('invalid value for "title", title cannot be nil.')
@@ -96,6 +131,7 @@ module MessenteApi
96
131
  # Check to see if the all the properties in the model are valid
97
132
  # @return true if the model is valid
98
133
  def valid?
134
+ warn '[DEPRECATED] the `valid?` method is obsolete'
99
135
  return false if @title.nil?
100
136
  return false if @detail.nil?
101
137
  return false if @code.nil?
@@ -128,37 +164,33 @@ module MessenteApi
128
164
  # @param [Hash] attributes Model attributes in the form of hash
129
165
  # @return [Object] Returns the model itself
130
166
  def self.build_from_hash(attributes)
131
- new.build_from_hash(attributes)
132
- end
133
-
134
- # Builds the object from hash
135
- # @param [Hash] attributes Model attributes in the form of hash
136
- # @return [Object] Returns the model itself
137
- def build_from_hash(attributes)
138
167
  return nil unless attributes.is_a?(Hash)
139
- self.class.openapi_types.each_pair do |key, type|
140
- if type =~ /\AArray<(.*)>/i
168
+ attributes = attributes.transform_keys(&:to_sym)
169
+ transformed_hash = {}
170
+ openapi_types.each_pair do |key, type|
171
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
172
+ transformed_hash["#{key}"] = nil
173
+ elsif type =~ /\AArray<(.*)>/i
141
174
  # check to ensure the input is an array given that the attribute
142
175
  # is documented as an array but the input is not
143
- if attributes[self.class.attribute_map[key]].is_a?(Array)
144
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
176
+ if attributes[attribute_map[key]].is_a?(Array)
177
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
145
178
  end
146
- elsif !attributes[self.class.attribute_map[key]].nil?
147
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
148
- end # or else data not found in attributes(hash), not an issue as the data can be optional
179
+ elsif !attributes[attribute_map[key]].nil?
180
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
181
+ end
149
182
  end
150
-
151
- self
183
+ new(transformed_hash)
152
184
  end
153
185
 
154
186
  # Deserializes the data based on type
155
187
  # @param string type Data type
156
188
  # @param string value Value to be deserialized
157
189
  # @return [Object] Deserialized data
158
- def _deserialize(type, value)
190
+ def self._deserialize(type, value)
159
191
  case type.to_sym
160
- when :DateTime
161
- DateTime.parse(value)
192
+ when :Time
193
+ Time.parse(value)
162
194
  when :Date
163
195
  Date.parse(value)
164
196
  when :String
@@ -188,7 +220,9 @@ module MessenteApi
188
220
  end
189
221
  end
190
222
  else # model
191
- MessenteApi.const_get(type).build_from_hash(value)
223
+ # models (e.g. Pet) or oneOf
224
+ klass = MessenteApi.const_get(type)
225
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
192
226
  end
193
227
  end
194
228
 
@@ -214,7 +248,7 @@ module MessenteApi
214
248
  is_nullable = self.class.openapi_nullable.include?(attr)
215
249
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
216
250
  end
217
-
251
+
218
252
  hash[param] = _to_hash(value)
219
253
  end
220
254
  hash
@@ -237,5 +271,7 @@ module MessenteApi
237
271
  value
238
272
  end
239
273
  end
274
+
240
275
  end
276
+
241
277
  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
  # Error fields container
@@ -23,6 +24,28 @@ module MessenteApi
23
24
 
24
25
  attr_accessor :code
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?(:'title')
66
94
  self.title = attributes[:'title']
95
+ else
96
+ self.title = nil
67
97
  end
68
98
 
69
99
  if attributes.key?(:'details')
70
100
  self.details = attributes[:'details']
101
+ else
102
+ self.details = nil
71
103
  end
72
104
 
73
105
  if attributes.key?(:'code')
74
106
  self.code = attributes[:'code']
107
+ else
108
+ self.code = 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 @title.nil?
83
118
  invalid_properties.push('invalid value for "title", title 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 @title.nil?
101
137
  return false if @details.nil?
102
138
  return false if @code.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.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 errors
@@ -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,12 +63,15 @@ module MessenteApi
57
63
  if (value = attributes[:'errors']).is_a?(Array)
58
64
  self.errors = value
59
65
  end
66
+ else
67
+ self.errors = 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 @errors.nil?
68
77
  invalid_properties.push('invalid value for "errors", errors cannot be nil.')
@@ -74,6 +83,7 @@ module MessenteApi
74
83
  # Check to see if the all the properties in the model are valid
75
84
  # @return true if the model is valid
76
85
  def valid?
86
+ warn '[DEPRECATED] the `valid?` method is obsolete'
77
87
  return false if @errors.nil?
78
88
  true
79
89
  end
@@ -102,37 +112,33 @@ module MessenteApi
102
112
  # @param [Hash] attributes Model attributes in the form of hash
103
113
  # @return [Object] Returns the model itself
104
114
  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
115
  return nil unless attributes.is_a?(Hash)
113
- self.class.openapi_types.each_pair do |key, type|
114
- if type =~ /\AArray<(.*)>/i
116
+ attributes = attributes.transform_keys(&:to_sym)
117
+ transformed_hash = {}
118
+ openapi_types.each_pair do |key, type|
119
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
120
+ transformed_hash["#{key}"] = nil
121
+ elsif type =~ /\AArray<(.*)>/i
115
122
  # check to ensure the input is an array given that the attribute
116
123
  # 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) })
124
+ if attributes[attribute_map[key]].is_a?(Array)
125
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
119
126
  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
127
+ elsif !attributes[attribute_map[key]].nil?
128
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
129
+ end
123
130
  end
124
-
125
- self
131
+ new(transformed_hash)
126
132
  end
127
133
 
128
134
  # Deserializes the data based on type
129
135
  # @param string type Data type
130
136
  # @param string value Value to be deserialized
131
137
  # @return [Object] Deserialized data
132
- def _deserialize(type, value)
138
+ def self._deserialize(type, value)
133
139
  case type.to_sym
134
- when :DateTime
135
- DateTime.parse(value)
140
+ when :Time
141
+ Time.parse(value)
136
142
  when :Date
137
143
  Date.parse(value)
138
144
  when :String
@@ -162,7 +168,9 @@ module MessenteApi
162
168
  end
163
169
  end
164
170
  else # model
165
- MessenteApi.const_get(type).build_from_hash(value)
171
+ # models (e.g. Pet) or oneOf
172
+ klass = MessenteApi.const_get(type)
173
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
166
174
  end
167
175
  end
168
176
 
@@ -188,7 +196,7 @@ module MessenteApi
188
196
  is_nullable = self.class.openapi_nullable.include?(attr)
189
197
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
190
198
  end
191
-
199
+
192
200
  hash[param] = _to_hash(value)
193
201
  end
194
202
  hash
@@ -211,5 +219,7 @@ module MessenteApi
211
219
  value
212
220
  end
213
221
  end
222
+
214
223
  end
224
+
215
225
  end