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
  # Viber message content
@@ -18,9 +19,12 @@ module MessenteApi
18
19
  # Phone number or alphanumeric sender name
19
20
  attr_accessor :sender
20
21
 
21
- # After how many minutes this channel is considered as failed and the next channel is attempted
22
+ # After how many minutes this channel is considered as failed and the next channel is attempted. Only one of \"ttl\" and \"validity\" can be used.
22
23
  attr_accessor :validity
23
24
 
25
+ # After how many seconds this channel is considered as failed and the next channel is attempted. Only one of \"ttl\" and \"validity\" can be used.
26
+ attr_accessor :ttl
27
+
24
28
  # Plaintext content for Viber
25
29
  attr_accessor :text
26
30
 
@@ -36,6 +40,8 @@ module MessenteApi
36
40
  # The channel used to deliver the message
37
41
  attr_accessor :channel
38
42
 
43
+ attr_accessor :video
44
+
39
45
  class EnumAttributeValidator
40
46
  attr_reader :datatype
41
47
  attr_reader :allowable_values
@@ -63,24 +69,33 @@ module MessenteApi
63
69
  {
64
70
  :'sender' => :'sender',
65
71
  :'validity' => :'validity',
72
+ :'ttl' => :'ttl',
66
73
  :'text' => :'text',
67
74
  :'image_url' => :'image_url',
68
75
  :'button_url' => :'button_url',
69
76
  :'button_text' => :'button_text',
70
- :'channel' => :'channel'
77
+ :'channel' => :'channel',
78
+ :'video' => :'video'
71
79
  }
72
80
  end
73
81
 
82
+ # Returns all the JSON keys this model knows about
83
+ def self.acceptable_attributes
84
+ attribute_map.values
85
+ end
86
+
74
87
  # Attribute type mapping.
75
88
  def self.openapi_types
76
89
  {
77
90
  :'sender' => :'String',
78
91
  :'validity' => :'Integer',
92
+ :'ttl' => :'Integer',
79
93
  :'text' => :'String',
80
94
  :'image_url' => :'String',
81
95
  :'button_url' => :'String',
82
96
  :'button_text' => :'String',
83
- :'channel' => :'String'
97
+ :'channel' => :'String',
98
+ :'video' => :'ViberVideo'
84
99
  }
85
100
  end
86
101
 
@@ -113,6 +128,10 @@ module MessenteApi
113
128
  self.validity = attributes[:'validity']
114
129
  end
115
130
 
131
+ if attributes.key?(:'ttl')
132
+ self.ttl = attributes[:'ttl']
133
+ end
134
+
116
135
  if attributes.key?(:'text')
117
136
  self.text = attributes[:'text']
118
137
  end
@@ -134,11 +153,16 @@ module MessenteApi
134
153
  else
135
154
  self.channel = 'viber'
136
155
  end
156
+
157
+ if attributes.key?(:'video')
158
+ self.video = attributes[:'video']
159
+ end
137
160
  end
138
161
 
139
162
  # Show invalid properties with the reasons. Usually used together with valid?
140
163
  # @return Array for valid properties with the reasons
141
164
  def list_invalid_properties
165
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
142
166
  invalid_properties = Array.new
143
167
  invalid_properties
144
168
  end
@@ -146,6 +170,7 @@ module MessenteApi
146
170
  # Check to see if the all the properties in the model are valid
147
171
  # @return true if the model is valid
148
172
  def valid?
173
+ warn '[DEPRECATED] the `valid?` method is obsolete'
149
174
  channel_validator = EnumAttributeValidator.new('String', ["viber"])
150
175
  return false unless channel_validator.valid?(@channel)
151
176
  true
@@ -168,11 +193,13 @@ module MessenteApi
168
193
  self.class == o.class &&
169
194
  sender == o.sender &&
170
195
  validity == o.validity &&
196
+ ttl == o.ttl &&
171
197
  text == o.text &&
172
198
  image_url == o.image_url &&
173
199
  button_url == o.button_url &&
174
200
  button_text == o.button_text &&
175
- channel == o.channel
201
+ channel == o.channel &&
202
+ video == o.video
176
203
  end
177
204
 
178
205
  # @see the `==` method
@@ -184,44 +211,40 @@ module MessenteApi
184
211
  # Calculates hash code according to all attributes.
185
212
  # @return [Integer] Hash code
186
213
  def hash
187
- [sender, validity, text, image_url, button_url, button_text, channel].hash
214
+ [sender, validity, ttl, text, image_url, button_url, button_text, channel, video].hash
188
215
  end
189
216
 
190
217
  # Builds the object from hash
191
218
  # @param [Hash] attributes Model attributes in the form of hash
192
219
  # @return [Object] Returns the model itself
193
220
  def self.build_from_hash(attributes)
194
- new.build_from_hash(attributes)
195
- end
196
-
197
- # Builds the object from hash
198
- # @param [Hash] attributes Model attributes in the form of hash
199
- # @return [Object] Returns the model itself
200
- def build_from_hash(attributes)
201
221
  return nil unless attributes.is_a?(Hash)
202
- self.class.openapi_types.each_pair do |key, type|
203
- if type =~ /\AArray<(.*)>/i
222
+ attributes = attributes.transform_keys(&:to_sym)
223
+ transformed_hash = {}
224
+ openapi_types.each_pair do |key, type|
225
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
226
+ transformed_hash["#{key}"] = nil
227
+ elsif type =~ /\AArray<(.*)>/i
204
228
  # check to ensure the input is an array given that the attribute
205
229
  # is documented as an array but the input is not
206
- if attributes[self.class.attribute_map[key]].is_a?(Array)
207
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
230
+ if attributes[attribute_map[key]].is_a?(Array)
231
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
208
232
  end
209
- elsif !attributes[self.class.attribute_map[key]].nil?
210
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
211
- end # or else data not found in attributes(hash), not an issue as the data can be optional
233
+ elsif !attributes[attribute_map[key]].nil?
234
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
235
+ end
212
236
  end
213
-
214
- self
237
+ new(transformed_hash)
215
238
  end
216
239
 
217
240
  # Deserializes the data based on type
218
241
  # @param string type Data type
219
242
  # @param string value Value to be deserialized
220
243
  # @return [Object] Deserialized data
221
- def _deserialize(type, value)
244
+ def self._deserialize(type, value)
222
245
  case type.to_sym
223
- when :DateTime
224
- DateTime.parse(value)
246
+ when :Time
247
+ Time.parse(value)
225
248
  when :Date
226
249
  Date.parse(value)
227
250
  when :String
@@ -251,7 +274,9 @@ module MessenteApi
251
274
  end
252
275
  end
253
276
  else # model
254
- MessenteApi.const_get(type).build_from_hash(value)
277
+ # models (e.g. Pet) or oneOf
278
+ klass = MessenteApi.const_get(type)
279
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
255
280
  end
256
281
  end
257
282
 
@@ -277,7 +302,7 @@ module MessenteApi
277
302
  is_nullable = self.class.openapi_nullable.include?(attr)
278
303
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
279
304
  end
280
-
305
+
281
306
  hash[param] = _to_hash(value)
282
307
  end
283
308
  hash
@@ -300,5 +325,7 @@ module MessenteApi
300
325
  value
301
326
  end
302
327
  end
328
+
303
329
  end
330
+
304
331
  end
@@ -0,0 +1,274 @@
1
+ =begin
2
+ #Messente API
3
+
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
+
6
+ The version of the OpenAPI document: 2.0.0
7
+ Contact: messente@messente.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.6.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module MessenteApi
17
+ # Viber video object
18
+ class ViberVideo
19
+ # URL pointing to the video resource.
20
+ attr_accessor :url
21
+
22
+ # URL pointing to the video thumbnail resource.
23
+ attr_accessor :thumbnail
24
+
25
+ # Size of the video file in bytes. Cannot be larger than 200MB.
26
+ attr_accessor :file_size
27
+
28
+ # Duration of the video in seconds. Cannot be longer than 600 seconds.
29
+ attr_accessor :duration
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'url' => :'url',
35
+ :'thumbnail' => :'thumbnail',
36
+ :'file_size' => :'file_size',
37
+ :'duration' => :'duration'
38
+ }
39
+ end
40
+
41
+ # Returns all the JSON keys this model knows about
42
+ def self.acceptable_attributes
43
+ attribute_map.values
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.openapi_types
48
+ {
49
+ :'url' => :'String',
50
+ :'thumbnail' => :'String',
51
+ :'file_size' => :'Integer',
52
+ :'duration' => :'Integer'
53
+ }
54
+ end
55
+
56
+ # List of attributes with nullable: true
57
+ def self.openapi_nullable
58
+ Set.new([
59
+ ])
60
+ end
61
+
62
+ # Initializes the object
63
+ # @param [Hash] attributes Model attributes in the form of hash
64
+ def initialize(attributes = {})
65
+ if (!attributes.is_a?(Hash))
66
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MessenteApi::ViberVideo` initialize method"
67
+ end
68
+
69
+ # check to see if the attribute exists and convert string to symbol for hash key
70
+ attributes = attributes.each_with_object({}) { |(k, v), h|
71
+ if (!self.class.attribute_map.key?(k.to_sym))
72
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MessenteApi::ViberVideo`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
73
+ end
74
+ h[k.to_sym] = v
75
+ }
76
+
77
+ if attributes.key?(:'url')
78
+ self.url = attributes[:'url']
79
+ else
80
+ self.url = nil
81
+ end
82
+
83
+ if attributes.key?(:'thumbnail')
84
+ self.thumbnail = attributes[:'thumbnail']
85
+ else
86
+ self.thumbnail = nil
87
+ end
88
+
89
+ if attributes.key?(:'file_size')
90
+ self.file_size = attributes[:'file_size']
91
+ else
92
+ self.file_size = nil
93
+ end
94
+
95
+ if attributes.key?(:'duration')
96
+ self.duration = attributes[:'duration']
97
+ else
98
+ self.duration = nil
99
+ end
100
+ end
101
+
102
+ # Show invalid properties with the reasons. Usually used together with valid?
103
+ # @return Array for valid properties with the reasons
104
+ def list_invalid_properties
105
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
106
+ invalid_properties = Array.new
107
+ if @url.nil?
108
+ invalid_properties.push('invalid value for "url", url cannot be nil.')
109
+ end
110
+
111
+ if @thumbnail.nil?
112
+ invalid_properties.push('invalid value for "thumbnail", thumbnail cannot be nil.')
113
+ end
114
+
115
+ if @file_size.nil?
116
+ invalid_properties.push('invalid value for "file_size", file_size cannot be nil.')
117
+ end
118
+
119
+ if @duration.nil?
120
+ invalid_properties.push('invalid value for "duration", duration cannot be nil.')
121
+ end
122
+
123
+ invalid_properties
124
+ end
125
+
126
+ # Check to see if the all the properties in the model are valid
127
+ # @return true if the model is valid
128
+ def valid?
129
+ warn '[DEPRECATED] the `valid?` method is obsolete'
130
+ return false if @url.nil?
131
+ return false if @thumbnail.nil?
132
+ return false if @file_size.nil?
133
+ return false if @duration.nil?
134
+ true
135
+ end
136
+
137
+ # Checks equality by comparing each attribute.
138
+ # @param [Object] Object to be compared
139
+ def ==(o)
140
+ return true if self.equal?(o)
141
+ self.class == o.class &&
142
+ url == o.url &&
143
+ thumbnail == o.thumbnail &&
144
+ file_size == o.file_size &&
145
+ duration == o.duration
146
+ end
147
+
148
+ # @see the `==` method
149
+ # @param [Object] Object to be compared
150
+ def eql?(o)
151
+ self == o
152
+ end
153
+
154
+ # Calculates hash code according to all attributes.
155
+ # @return [Integer] Hash code
156
+ def hash
157
+ [url, thumbnail, file_size, duration].hash
158
+ end
159
+
160
+ # Builds the object from hash
161
+ # @param [Hash] attributes Model attributes in the form of hash
162
+ # @return [Object] Returns the model itself
163
+ def self.build_from_hash(attributes)
164
+ return nil unless attributes.is_a?(Hash)
165
+ attributes = attributes.transform_keys(&:to_sym)
166
+ transformed_hash = {}
167
+ openapi_types.each_pair do |key, type|
168
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
169
+ transformed_hash["#{key}"] = nil
170
+ elsif type =~ /\AArray<(.*)>/i
171
+ # check to ensure the input is an array given that the attribute
172
+ # is documented as an array but the input is not
173
+ if attributes[attribute_map[key]].is_a?(Array)
174
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
175
+ end
176
+ elsif !attributes[attribute_map[key]].nil?
177
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
178
+ end
179
+ end
180
+ new(transformed_hash)
181
+ end
182
+
183
+ # Deserializes the data based on type
184
+ # @param string type Data type
185
+ # @param string value Value to be deserialized
186
+ # @return [Object] Deserialized data
187
+ def self._deserialize(type, value)
188
+ case type.to_sym
189
+ when :Time
190
+ Time.parse(value)
191
+ when :Date
192
+ Date.parse(value)
193
+ when :String
194
+ value.to_s
195
+ when :Integer
196
+ value.to_i
197
+ when :Float
198
+ value.to_f
199
+ when :Boolean
200
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
201
+ true
202
+ else
203
+ false
204
+ end
205
+ when :Object
206
+ # generic object (usually a Hash), return directly
207
+ value
208
+ when /\AArray<(?<inner_type>.+)>\z/
209
+ inner_type = Regexp.last_match[:inner_type]
210
+ value.map { |v| _deserialize(inner_type, v) }
211
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
212
+ k_type = Regexp.last_match[:k_type]
213
+ v_type = Regexp.last_match[:v_type]
214
+ {}.tap do |hash|
215
+ value.each do |k, v|
216
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
217
+ end
218
+ end
219
+ else # model
220
+ # models (e.g. Pet) or oneOf
221
+ klass = MessenteApi.const_get(type)
222
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
223
+ end
224
+ end
225
+
226
+ # Returns the string representation of the object
227
+ # @return [String] String presentation of the object
228
+ def to_s
229
+ to_hash.to_s
230
+ end
231
+
232
+ # to_body is an alias to to_hash (backward compatibility)
233
+ # @return [Hash] Returns the object in the form of hash
234
+ def to_body
235
+ to_hash
236
+ end
237
+
238
+ # Returns the object in the form of hash
239
+ # @return [Hash] Returns the object in the form of hash
240
+ def to_hash
241
+ hash = {}
242
+ self.class.attribute_map.each_pair do |attr, param|
243
+ value = self.send(attr)
244
+ if value.nil?
245
+ is_nullable = self.class.openapi_nullable.include?(attr)
246
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
247
+ end
248
+
249
+ hash[param] = _to_hash(value)
250
+ end
251
+ hash
252
+ end
253
+
254
+ # Outputs non-array value in the form of hash
255
+ # For object, use to_hash. Otherwise, just return the value
256
+ # @param [Object] value Any valid value
257
+ # @return [Hash] Returns the value in the form of hash
258
+ def _to_hash(value)
259
+ if value.is_a?(Array)
260
+ value.compact.map { |v| _to_hash(v) }
261
+ elsif value.is_a?(Hash)
262
+ {}.tap do |hash|
263
+ value.each { |k, v| hash[k] = _to_hash(v) }
264
+ end
265
+ elsif value.respond_to? :to_hash
266
+ value.to_hash
267
+ else
268
+ value
269
+ end
270
+ end
271
+
272
+ end
273
+
274
+ 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
  # WhatsApp message content. Only one of \"text\", \"image\", \"document\" or \"audio\" can be provided
@@ -21,13 +22,10 @@ module MessenteApi
21
22
  # After how many minutes this channel is considered as failed and the next channel is attempted
22
23
  attr_accessor :validity
23
24
 
24
- attr_accessor :text
25
+ # After how many seconds this channel is considered as failed and the next channel is attempted. Only one of \"ttl\" and \"validity\" can be used.
26
+ attr_accessor :ttl
25
27
 
26
- attr_accessor :image
27
-
28
- attr_accessor :document
29
-
30
- attr_accessor :audio
28
+ attr_accessor :template
31
29
 
32
30
  # The channel used to deliver the message
33
31
  attr_accessor :channel
@@ -59,23 +57,24 @@ module MessenteApi
59
57
  {
60
58
  :'sender' => :'sender',
61
59
  :'validity' => :'validity',
62
- :'text' => :'text',
63
- :'image' => :'image',
64
- :'document' => :'document',
65
- :'audio' => :'audio',
60
+ :'ttl' => :'ttl',
61
+ :'template' => :'template',
66
62
  :'channel' => :'channel'
67
63
  }
68
64
  end
69
65
 
66
+ # Returns all the JSON keys this model knows about
67
+ def self.acceptable_attributes
68
+ attribute_map.values
69
+ end
70
+
70
71
  # Attribute type mapping.
71
72
  def self.openapi_types
72
73
  {
73
74
  :'sender' => :'String',
74
75
  :'validity' => :'Integer',
75
- :'text' => :'WhatsAppText',
76
- :'image' => :'WhatsAppImage',
77
- :'document' => :'WhatsAppDocument',
78
- :'audio' => :'WhatsAppAudio',
76
+ :'ttl' => :'Integer',
77
+ :'template' => :'WhatsAppTemplate',
79
78
  :'channel' => :'String'
80
79
  }
81
80
  end
@@ -109,20 +108,12 @@ module MessenteApi
109
108
  self.validity = attributes[:'validity']
110
109
  end
111
110
 
112
- if attributes.key?(:'text')
113
- self.text = attributes[:'text']
111
+ if attributes.key?(:'ttl')
112
+ self.ttl = attributes[:'ttl']
114
113
  end
115
114
 
116
- if attributes.key?(:'image')
117
- self.image = attributes[:'image']
118
- end
119
-
120
- if attributes.key?(:'document')
121
- self.document = attributes[:'document']
122
- end
123
-
124
- if attributes.key?(:'audio')
125
- self.audio = attributes[:'audio']
115
+ if attributes.key?(:'template')
116
+ self.template = attributes[:'template']
126
117
  end
127
118
 
128
119
  if attributes.key?(:'channel')
@@ -135,6 +126,7 @@ module MessenteApi
135
126
  # Show invalid properties with the reasons. Usually used together with valid?
136
127
  # @return Array for valid properties with the reasons
137
128
  def list_invalid_properties
129
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
138
130
  invalid_properties = Array.new
139
131
  invalid_properties
140
132
  end
@@ -142,6 +134,7 @@ module MessenteApi
142
134
  # Check to see if the all the properties in the model are valid
143
135
  # @return true if the model is valid
144
136
  def valid?
137
+ warn '[DEPRECATED] the `valid?` method is obsolete'
145
138
  channel_validator = EnumAttributeValidator.new('String', ["whatsapp"])
146
139
  return false unless channel_validator.valid?(@channel)
147
140
  true
@@ -164,10 +157,8 @@ module MessenteApi
164
157
  self.class == o.class &&
165
158
  sender == o.sender &&
166
159
  validity == o.validity &&
167
- text == o.text &&
168
- image == o.image &&
169
- document == o.document &&
170
- audio == o.audio &&
160
+ ttl == o.ttl &&
161
+ template == o.template &&
171
162
  channel == o.channel
172
163
  end
173
164
 
@@ -180,44 +171,40 @@ module MessenteApi
180
171
  # Calculates hash code according to all attributes.
181
172
  # @return [Integer] Hash code
182
173
  def hash
183
- [sender, validity, text, image, document, audio, channel].hash
174
+ [sender, validity, ttl, template, channel].hash
184
175
  end
185
176
 
186
177
  # Builds the object from hash
187
178
  # @param [Hash] attributes Model attributes in the form of hash
188
179
  # @return [Object] Returns the model itself
189
180
  def self.build_from_hash(attributes)
190
- new.build_from_hash(attributes)
191
- end
192
-
193
- # Builds the object from hash
194
- # @param [Hash] attributes Model attributes in the form of hash
195
- # @return [Object] Returns the model itself
196
- def build_from_hash(attributes)
197
181
  return nil unless attributes.is_a?(Hash)
198
- self.class.openapi_types.each_pair do |key, type|
199
- if type =~ /\AArray<(.*)>/i
182
+ attributes = attributes.transform_keys(&:to_sym)
183
+ transformed_hash = {}
184
+ openapi_types.each_pair do |key, type|
185
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
186
+ transformed_hash["#{key}"] = nil
187
+ elsif type =~ /\AArray<(.*)>/i
200
188
  # check to ensure the input is an array given that the attribute
201
189
  # is documented as an array but the input is not
202
- if attributes[self.class.attribute_map[key]].is_a?(Array)
203
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
190
+ if attributes[attribute_map[key]].is_a?(Array)
191
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
204
192
  end
205
- elsif !attributes[self.class.attribute_map[key]].nil?
206
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
207
- end # or else data not found in attributes(hash), not an issue as the data can be optional
193
+ elsif !attributes[attribute_map[key]].nil?
194
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
195
+ end
208
196
  end
209
-
210
- self
197
+ new(transformed_hash)
211
198
  end
212
199
 
213
200
  # Deserializes the data based on type
214
201
  # @param string type Data type
215
202
  # @param string value Value to be deserialized
216
203
  # @return [Object] Deserialized data
217
- def _deserialize(type, value)
204
+ def self._deserialize(type, value)
218
205
  case type.to_sym
219
- when :DateTime
220
- DateTime.parse(value)
206
+ when :Time
207
+ Time.parse(value)
221
208
  when :Date
222
209
  Date.parse(value)
223
210
  when :String
@@ -247,7 +234,9 @@ module MessenteApi
247
234
  end
248
235
  end
249
236
  else # model
250
- MessenteApi.const_get(type).build_from_hash(value)
237
+ # models (e.g. Pet) or oneOf
238
+ klass = MessenteApi.const_get(type)
239
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
251
240
  end
252
241
  end
253
242
 
@@ -273,7 +262,7 @@ module MessenteApi
273
262
  is_nullable = self.class.openapi_nullable.include?(attr)
274
263
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
275
264
  end
276
-
265
+
277
266
  hash[param] = _to_hash(value)
278
267
  end
279
268
  hash
@@ -296,5 +285,7 @@ module MessenteApi
296
285
  value
297
286
  end
298
287
  end
288
+
299
289
  end
290
+
300
291
  end