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.
- checksums.yaml +4 -4
- data/README.md +33 -30
- data/docs/BlacklistApi.md +105 -37
- data/docs/BulkMessagingApi.md +76 -0
- data/docs/BulkOmniMessageCreateSuccessResponse.md +18 -0
- data/docs/BulkOmniMessageCreateSuccessResponseMessagesInner.md +49 -0
- data/docs/BulkOmnimessage.md +18 -0
- data/docs/Channel.md +4 -5
- data/docs/ContactEnvelope.md +8 -7
- data/docs/ContactFields.md +26 -25
- data/docs/ContactListEnvelope.md +8 -7
- data/docs/ContactResponseFields.md +28 -27
- data/docs/ContactUpdateFields.md +24 -23
- data/docs/ContactsApi.md +221 -86
- data/docs/DeliveryReportApi.md +29 -13
- data/docs/DeliveryReportResponse.md +12 -11
- data/docs/DeliveryResult.md +22 -17
- data/docs/ErrorCodeOmnichannel.md +4 -5
- data/docs/ErrorCodeOmnichannelMachine.md +4 -5
- data/docs/ErrorCodePhonebook.md +4 -5
- data/docs/ErrorCodeStatistics.md +4 -5
- data/docs/ErrorItemNumberLookup.md +8 -7
- data/docs/ErrorItemNumberLookupError.md +10 -9
- data/docs/ErrorItemOmnichannel.md +14 -13
- data/docs/ErrorItemPhonebook.md +12 -11
- data/docs/ErrorItemStatistics.md +12 -11
- data/docs/ErrorNumberLookup.md +8 -7
- data/docs/ErrorOmnichannel.md +8 -7
- data/docs/ErrorPhonebook.md +8 -7
- data/docs/ErrorStatistics.md +8 -7
- data/docs/ErrorTitleOmnichannel.md +4 -5
- data/docs/ErrorTitlePhonebook.md +4 -5
- data/docs/FetchBlacklistSuccess.md +8 -7
- data/docs/GroupEnvelope.md +8 -7
- data/docs/GroupListEnvelope.md +8 -7
- data/docs/GroupName.md +8 -7
- data/docs/GroupResponseFields.md +14 -13
- data/docs/GroupsApi.md +136 -51
- data/docs/MessageResult.md +12 -11
- data/docs/MobileNetwork.md +16 -15
- data/docs/NumberLookupApi.md +30 -14
- data/docs/NumberToBlacklist.md +8 -7
- data/docs/NumbersToInvestigate.md +8 -7
- data/docs/OmniMessageCreateSuccessResponse.md +12 -11
- data/docs/Omnimessage.md +18 -17
- data/docs/OmnimessageApi.md +56 -23
- data/docs/OmnimessageMessagesInner.md +53 -0
- data/docs/PriceInfo.md +22 -0
- data/docs/Priority.md +4 -5
- data/docs/SMS.md +20 -17
- data/docs/StatisticsApi.md +30 -14
- data/docs/StatisticsReport.md +12 -11
- data/docs/StatisticsReportSettings.md +12 -11
- data/docs/StatisticsReportSuccess.md +8 -7
- data/docs/Status.md +4 -5
- data/docs/SyncNumberLookupResult.md +24 -23
- data/docs/SyncNumberLookupSuccess.md +10 -9
- data/docs/Telegram.md +20 -19
- data/docs/TextStore.md +4 -5
- data/docs/Viber.md +24 -19
- data/docs/ViberVideo.md +24 -0
- data/docs/WhatsApp.md +16 -19
- data/docs/WhatsAppComponent.md +24 -0
- data/docs/WhatsAppCurrency.md +22 -0
- data/docs/WhatsAppDatetime.md +18 -0
- data/docs/WhatsAppLanguage.md +20 -0
- data/docs/WhatsAppMedia.md +24 -0
- data/docs/WhatsAppParameter.md +30 -0
- data/docs/WhatsAppTemplate.md +22 -0
- data/git_push.sh +3 -4
- data/lib/messente_api/api/blacklist_api.rb +22 -15
- data/lib/messente_api/api/bulk_messaging_api.rb +88 -0
- data/lib/messente_api/api/contacts_api.rb +42 -28
- data/lib/messente_api/api/delivery_report_api.rb +6 -5
- data/lib/messente_api/api/groups_api.rb +30 -19
- data/lib/messente_api/api/number_lookup_api.rb +10 -6
- data/lib/messente_api/api/omnimessage_api.rb +14 -9
- data/lib/messente_api/api/statistics_api.rb +10 -6
- data/lib/messente_api/api_client.rb +72 -66
- data/lib/messente_api/api_error.rb +3 -2
- data/lib/messente_api/configuration.rb +64 -14
- data/lib/messente_api/models/{whats_app_audio.rb → bulk_omni_message_create_success_response.rb} +50 -38
- data/lib/messente_api/models/bulk_omni_message_create_success_response_messages_inner.rb +105 -0
- data/lib/messente_api/models/{whats_app_text.rb → bulk_omnimessage.rb} +49 -49
- data/lib/messente_api/models/channel.rb +9 -5
- data/lib/messente_api/models/contact_envelope.rb +31 -23
- data/lib/messente_api/models/contact_fields.rb +33 -23
- data/lib/messente_api/models/contact_list_envelope.rb +41 -23
- data/lib/messente_api/models/contact_response_fields.rb +31 -23
- data/lib/messente_api/models/contact_update_fields.rb +31 -23
- data/lib/messente_api/models/delivery_report_response.rb +37 -23
- data/lib/messente_api/models/delivery_result.rb +77 -27
- data/lib/messente_api/models/error_code_omnichannel.rb +9 -5
- data/lib/messente_api/models/error_code_omnichannel_machine.rb +9 -5
- data/lib/messente_api/models/error_code_phonebook.rb +9 -5
- data/lib/messente_api/models/error_code_statistics.rb +9 -5
- data/lib/messente_api/models/error_item_number_lookup.rb +33 -23
- data/lib/messente_api/models/error_item_number_lookup_error.rb +35 -23
- data/lib/messente_api/models/error_item_omnichannel.rb +61 -23
- data/lib/messente_api/models/error_item_phonebook.rb +59 -23
- data/lib/messente_api/models/error_item_statistics.rb +59 -23
- data/lib/messente_api/models/error_number_lookup.rb +33 -23
- data/lib/messente_api/models/error_omnichannel.rb +33 -23
- data/lib/messente_api/models/error_phonebook.rb +33 -23
- data/lib/messente_api/models/error_statistics.rb +33 -23
- data/lib/messente_api/models/error_title_omnichannel.rb +9 -5
- data/lib/messente_api/models/error_title_phonebook.rb +9 -5
- data/lib/messente_api/models/fetch_blacklist_success.rb +41 -23
- data/lib/messente_api/models/group_envelope.rb +31 -23
- data/lib/messente_api/models/group_list_envelope.rb +41 -23
- data/lib/messente_api/models/group_name.rb +33 -23
- data/lib/messente_api/models/group_response_fields.rb +37 -23
- data/lib/messente_api/models/message_result.rb +59 -23
- data/lib/messente_api/models/mobile_network.rb +31 -23
- data/lib/messente_api/models/number_to_blacklist.rb +33 -23
- data/lib/messente_api/models/numbers_to_investigate.rb +62 -24
- data/lib/messente_api/models/omni_message_create_success_response.rb +37 -23
- data/lib/messente_api/models/omnimessage.rb +59 -25
- data/lib/messente_api/models/omnimessage_messages_inner.rb +107 -0
- data/lib/messente_api/models/price_info.rb +257 -0
- data/lib/messente_api/models/priority.rb +9 -5
- data/lib/messente_api/models/sms.rb +45 -25
- data/lib/messente_api/models/statistics_report.rb +37 -23
- data/lib/messente_api/models/statistics_report_settings.rb +35 -23
- data/lib/messente_api/models/statistics_report_success.rb +33 -23
- data/lib/messente_api/models/status.rb +9 -5
- data/lib/messente_api/models/sync_number_lookup_result.rb +35 -24
- data/lib/messente_api/models/sync_number_lookup_success.rb +35 -23
- data/lib/messente_api/models/telegram.rb +31 -23
- data/lib/messente_api/models/text_store.rb +9 -5
- data/lib/messente_api/models/viber.rb +55 -28
- data/lib/messente_api/models/viber_video.rb +274 -0
- data/lib/messente_api/models/whats_app.rb +45 -54
- data/lib/messente_api/models/whats_app_component.rb +255 -0
- data/lib/messente_api/models/whats_app_currency.rb +257 -0
- data/lib/messente_api/models/{whats_app_document.rb → whats_app_datetime.rb} +48 -48
- data/lib/messente_api/models/{whats_app_image.rb → whats_app_language.rb} +55 -45
- data/lib/messente_api/models/whats_app_media.rb +246 -0
- data/lib/messente_api/models/whats_app_parameter.rb +278 -0
- data/lib/messente_api/models/whats_app_template.rb +251 -0
- data/lib/messente_api/version.rb +3 -3
- data/lib/messente_api.rb +16 -6
- data/messente_api.gemspec +5 -5
- data/spec/spec_helper.rb +2 -2
- metadata +35 -39
- data/docs/WhatsAppAudio.md +0 -17
- data/docs/WhatsAppDocument.md +0 -19
- data/docs/WhatsAppImage.md +0 -19
- data/docs/WhatsAppText.md +0 -19
- data/spec/api_client_spec.rb +0 -226
- data/spec/configuration_spec.rb +0 -42
@@ -3,10 +3,10 @@
|
|
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:
|
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
|
-
|
9
|
+
Generator version: 7.6.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -14,8 +14,10 @@ require 'date'
|
|
14
14
|
require 'json'
|
15
15
|
require 'logger'
|
16
16
|
require 'tempfile'
|
17
|
+
require 'time'
|
17
18
|
require 'typhoeus'
|
18
19
|
|
20
|
+
|
19
21
|
module MessenteApi
|
20
22
|
class ApiClient
|
21
23
|
# The Configuration object holding settings to be used in the API client.
|
@@ -44,9 +46,10 @@ module MessenteApi
|
|
44
46
|
# Call an API with given options.
|
45
47
|
#
|
46
48
|
# @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
|
47
|
-
# the data deserialized from response body (
|
49
|
+
# the data deserialized from response body (may be a Tempfile or nil), response status code and response headers.
|
48
50
|
def call_api(http_method, path, opts = {})
|
49
51
|
request = build_request(http_method, path, opts)
|
52
|
+
tempfile = download_file(request) if opts[:return_type] == 'File'
|
50
53
|
response = request.run
|
51
54
|
|
52
55
|
if @config.debugging
|
@@ -68,7 +71,9 @@ module MessenteApi
|
|
68
71
|
end
|
69
72
|
end
|
70
73
|
|
71
|
-
if opts[:return_type]
|
74
|
+
if opts[:return_type] == 'File'
|
75
|
+
data = tempfile
|
76
|
+
elsif opts[:return_type]
|
72
77
|
data = deserialize(response, opts[:return_type])
|
73
78
|
else
|
74
79
|
data = nil
|
@@ -86,12 +91,13 @@ module MessenteApi
|
|
86
91
|
# @option opts [Object] :body HTTP body (JSON/XML)
|
87
92
|
# @return [Typhoeus::Request] A Typhoeus Request
|
88
93
|
def build_request(http_method, path, opts = {})
|
89
|
-
url = build_request_url(path)
|
94
|
+
url = build_request_url(path, opts)
|
90
95
|
http_method = http_method.to_sym.downcase
|
91
96
|
|
92
97
|
header_params = @default_headers.merge(opts[:header_params] || {})
|
93
98
|
query_params = opts[:query_params] || {}
|
94
99
|
form_params = opts[:form_params] || {}
|
100
|
+
follow_location = opts[:follow_location] || true
|
95
101
|
|
96
102
|
update_params_for_auth! header_params, query_params, opts[:auth_names]
|
97
103
|
|
@@ -108,7 +114,8 @@ module MessenteApi
|
|
108
114
|
:ssl_verifyhost => _verify_ssl_host,
|
109
115
|
:sslcert => @config.cert_file,
|
110
116
|
:sslkey => @config.key_file,
|
111
|
-
:verbose => @config.debugging
|
117
|
+
:verbose => @config.debugging,
|
118
|
+
:followlocation => follow_location
|
112
119
|
}
|
113
120
|
|
114
121
|
# set custom cert, if provided
|
@@ -122,9 +129,7 @@ module MessenteApi
|
|
122
129
|
end
|
123
130
|
end
|
124
131
|
|
125
|
-
|
126
|
-
download_file(request) if opts[:return_type] == 'File'
|
127
|
-
request
|
132
|
+
Typhoeus::Request.new(url, req_opts)
|
128
133
|
end
|
129
134
|
|
130
135
|
# Builds the HTTP request body
|
@@ -155,6 +160,49 @@ module MessenteApi
|
|
155
160
|
data
|
156
161
|
end
|
157
162
|
|
163
|
+
# Save response body into a file in (the defined) temporary folder, using the filename
|
164
|
+
# from the "Content-Disposition" header if provided, otherwise a random filename.
|
165
|
+
# The response body is written to the file in chunks in order to handle files which
|
166
|
+
# size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
|
167
|
+
# process can use.
|
168
|
+
#
|
169
|
+
# @see Configuration#temp_folder_path
|
170
|
+
#
|
171
|
+
# @return [Tempfile] the tempfile generated
|
172
|
+
def download_file(request)
|
173
|
+
tempfile = nil
|
174
|
+
encoding = nil
|
175
|
+
request.on_headers do |response|
|
176
|
+
content_disposition = response.headers['Content-Disposition']
|
177
|
+
if content_disposition && content_disposition =~ /filename=/i
|
178
|
+
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
179
|
+
prefix = sanitize_filename(filename)
|
180
|
+
else
|
181
|
+
prefix = 'download-'
|
182
|
+
end
|
183
|
+
prefix = prefix + '-' unless prefix.end_with?('-')
|
184
|
+
encoding = response.body.encoding
|
185
|
+
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
186
|
+
end
|
187
|
+
request.on_body do |chunk|
|
188
|
+
chunk.force_encoding(encoding)
|
189
|
+
tempfile.write(chunk)
|
190
|
+
end
|
191
|
+
# run the request to ensure the tempfile is created successfully before returning it
|
192
|
+
request.run
|
193
|
+
if tempfile
|
194
|
+
tempfile.close
|
195
|
+
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
196
|
+
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
197
|
+
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
198
|
+
"explicitly with `tempfile.delete`"
|
199
|
+
else
|
200
|
+
fail ApiError.new("Failed to create the tempfile based on the HTTP response from the server: #{request.inspect}")
|
201
|
+
end
|
202
|
+
|
203
|
+
tempfile
|
204
|
+
end
|
205
|
+
|
158
206
|
# Check if the given MIME is a JSON MIME.
|
159
207
|
# JSON MIME examples:
|
160
208
|
# application/json
|
@@ -164,7 +212,7 @@ module MessenteApi
|
|
164
212
|
# @param [String] mime MIME
|
165
213
|
# @return [Boolean] True if the MIME is application/json
|
166
214
|
def json_mime?(mime)
|
167
|
-
(mime == '*/*') || !(mime =~
|
215
|
+
(mime == '*/*') || !(mime =~ /^Application\/.*json(?!p)(;.*)?/i).nil?
|
168
216
|
end
|
169
217
|
|
170
218
|
# Deserialize the response to the given return type.
|
@@ -173,15 +221,10 @@ module MessenteApi
|
|
173
221
|
# @param [String] return_type some examples: "User", "Array<User>", "Hash<String, Integer>"
|
174
222
|
def deserialize(response, return_type)
|
175
223
|
body = response.body
|
176
|
-
|
177
|
-
# handle file downloading - return the File instance processed in request callbacks
|
178
|
-
# note that response body is empty when the file is written in chunks in request on_body callback
|
179
|
-
return @tempfile if return_type == 'File'
|
180
|
-
|
181
224
|
return nil if body.nil? || body.empty?
|
182
225
|
|
183
226
|
# return response body directly for String return type
|
184
|
-
return body if return_type == 'String'
|
227
|
+
return body.to_s if return_type == 'String'
|
185
228
|
|
186
229
|
# ensuring a default content type
|
187
230
|
content_type = response.headers['Content-Type'] || 'application/json'
|
@@ -191,7 +234,7 @@ module MessenteApi
|
|
191
234
|
begin
|
192
235
|
data = JSON.parse("[#{body}]", :symbolize_names => true)[0]
|
193
236
|
rescue JSON::ParserError => e
|
194
|
-
if %w(String Date
|
237
|
+
if %w(String Date Time).include?(return_type)
|
195
238
|
data = body
|
196
239
|
else
|
197
240
|
raise e
|
@@ -216,9 +259,9 @@ module MessenteApi
|
|
216
259
|
data.to_f
|
217
260
|
when 'Boolean'
|
218
261
|
data == true
|
219
|
-
when '
|
262
|
+
when 'Time'
|
220
263
|
# parse date time (expecting ISO 8601 format)
|
221
|
-
|
264
|
+
Time.parse data
|
222
265
|
when 'Date'
|
223
266
|
# parse date time (expecting ISO 8601 format)
|
224
267
|
Date.parse data
|
@@ -236,46 +279,9 @@ module MessenteApi
|
|
236
279
|
data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
|
237
280
|
end
|
238
281
|
else
|
239
|
-
# models
|
240
|
-
MessenteApi.const_get(return_type)
|
241
|
-
|
242
|
-
end
|
243
|
-
|
244
|
-
# Save response body into a file in (the defined) temporary folder, using the filename
|
245
|
-
# from the "Content-Disposition" header if provided, otherwise a random filename.
|
246
|
-
# The response body is written to the file in chunks in order to handle files which
|
247
|
-
# size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
|
248
|
-
# process can use.
|
249
|
-
#
|
250
|
-
# @see Configuration#temp_folder_path
|
251
|
-
def download_file(request)
|
252
|
-
tempfile = nil
|
253
|
-
encoding = nil
|
254
|
-
request.on_headers do |response|
|
255
|
-
content_disposition = response.headers['Content-Disposition']
|
256
|
-
if content_disposition && content_disposition =~ /filename=/i
|
257
|
-
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
258
|
-
prefix = sanitize_filename(filename)
|
259
|
-
else
|
260
|
-
prefix = 'download-'
|
261
|
-
end
|
262
|
-
prefix = prefix + '-' unless prefix.end_with?('-')
|
263
|
-
encoding = response.body.encoding
|
264
|
-
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
265
|
-
@tempfile = tempfile
|
266
|
-
end
|
267
|
-
request.on_body do |chunk|
|
268
|
-
chunk.force_encoding(encoding)
|
269
|
-
tempfile.write(chunk)
|
270
|
-
end
|
271
|
-
request.on_complete do |response|
|
272
|
-
if tempfile
|
273
|
-
tempfile.close
|
274
|
-
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
275
|
-
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
276
|
-
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
277
|
-
"explicitly with `tempfile.delete`"
|
278
|
-
end
|
282
|
+
# models (e.g. Pet) or oneOf
|
283
|
+
klass = MessenteApi.const_get(return_type)
|
284
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data)
|
279
285
|
end
|
280
286
|
end
|
281
287
|
|
@@ -285,16 +291,16 @@ module MessenteApi
|
|
285
291
|
# @param [String] filename the filename to be sanitized
|
286
292
|
# @return [String] the sanitized filename
|
287
293
|
def sanitize_filename(filename)
|
288
|
-
filename.
|
294
|
+
filename.split(/[\/\\]/).last
|
289
295
|
end
|
290
296
|
|
291
|
-
def build_request_url(path)
|
297
|
+
def build_request_url(path, opts = {})
|
292
298
|
# Add leading and trailing slashes to path
|
293
299
|
path = "/#{path}".gsub(/\/+/, '/')
|
294
|
-
@config.base_url + path
|
300
|
+
@config.base_url(opts[:operation]) + path
|
295
301
|
end
|
296
302
|
|
297
|
-
# Update
|
303
|
+
# Update header and query params based on authentication settings.
|
298
304
|
#
|
299
305
|
# @param [Hash] header_params Header parameters
|
300
306
|
# @param [Hash] query_params Query parameters
|
@@ -306,7 +312,7 @@ module MessenteApi
|
|
306
312
|
case auth_setting[:in]
|
307
313
|
when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
|
308
314
|
when 'query' then query_params[auth_setting[:key]] = auth_setting[:value]
|
309
|
-
else fail ArgumentError, 'Authentication token must be in `query`
|
315
|
+
else fail ArgumentError, 'Authentication token must be in `query` or `header`'
|
310
316
|
end
|
311
317
|
end
|
312
318
|
end
|
@@ -333,8 +339,8 @@ module MessenteApi
|
|
333
339
|
# @param [Array] content_types array for Content-Type
|
334
340
|
# @return [String] the Content-Type header (e.g. application/json)
|
335
341
|
def select_header_content_type(content_types)
|
336
|
-
#
|
337
|
-
return
|
342
|
+
# return nil by default
|
343
|
+
return if content_types.nil? || content_types.empty?
|
338
344
|
# use JSON when present, otherwise use the first one
|
339
345
|
json_content_type = content_types.find { |s| json_mime?(s) }
|
340
346
|
json_content_type || content_types.first
|
@@ -3,10 +3,10 @@
|
|
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:
|
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
|
-
|
9
|
+
Generator version: 7.6.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -32,6 +32,7 @@ module MessenteApi
|
|
32
32
|
end
|
33
33
|
else
|
34
34
|
super arg
|
35
|
+
@message = arg
|
35
36
|
end
|
36
37
|
end
|
37
38
|
|
@@ -3,10 +3,10 @@
|
|
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:
|
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
|
-
|
9
|
+
Generator version: 7.6.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -21,6 +21,18 @@ module MessenteApi
|
|
21
21
|
# Defines url base path
|
22
22
|
attr_accessor :base_path
|
23
23
|
|
24
|
+
# Define server configuration index
|
25
|
+
attr_accessor :server_index
|
26
|
+
|
27
|
+
# Define server operation configuration index
|
28
|
+
attr_accessor :server_operation_index
|
29
|
+
|
30
|
+
# Default server variables
|
31
|
+
attr_accessor :server_variables
|
32
|
+
|
33
|
+
# Default server operation variables
|
34
|
+
attr_accessor :server_operation_variables
|
35
|
+
|
24
36
|
# Defines API keys used with API Key authentications.
|
25
37
|
#
|
26
38
|
# @return [Hash] key: parameter name, value: parameter value (API key)
|
@@ -50,6 +62,16 @@ module MessenteApi
|
|
50
62
|
# Defines the access token (Bearer) used with OAuth2.
|
51
63
|
attr_accessor :access_token
|
52
64
|
|
65
|
+
# Defines a Proc used to fetch or refresh access tokens (Bearer) used with OAuth2.
|
66
|
+
# Overrides the access_token if set
|
67
|
+
# @return [Proc]
|
68
|
+
attr_accessor :access_token_getter
|
69
|
+
|
70
|
+
# Set this to return data as binary instead of downloading a temp file. When enabled (set to true)
|
71
|
+
# HTTP responses with return type `File` will be returned as a stream of binary data.
|
72
|
+
# Default to false.
|
73
|
+
attr_accessor :return_binary_data
|
74
|
+
|
53
75
|
# Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
|
54
76
|
# details will be logged with `logger.debug` (see the `logger` attribute).
|
55
77
|
# Default to false.
|
@@ -121,6 +143,7 @@ module MessenteApi
|
|
121
143
|
# https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
|
122
144
|
attr_accessor :params_encoding
|
123
145
|
|
146
|
+
|
124
147
|
attr_accessor :inject_format
|
125
148
|
|
126
149
|
attr_accessor :force_ending_format
|
@@ -129,15 +152,19 @@ module MessenteApi
|
|
129
152
|
@scheme = 'https'
|
130
153
|
@host = 'api.messente.com'
|
131
154
|
@base_path = '/v1'
|
155
|
+
@server_index = nil
|
156
|
+
@server_operation_index = {}
|
157
|
+
@server_variables = {}
|
158
|
+
@server_operation_variables = {}
|
132
159
|
@api_key = {}
|
133
160
|
@api_key_prefix = {}
|
134
|
-
@timeout = 0
|
135
161
|
@client_side_validation = true
|
136
162
|
@verify_ssl = true
|
137
163
|
@verify_ssl_host = true
|
138
|
-
@params_encoding = nil
|
139
164
|
@cert_file = nil
|
140
165
|
@key_file = nil
|
166
|
+
@timeout = 0
|
167
|
+
@params_encoding = nil
|
141
168
|
@debugging = false
|
142
169
|
@inject_format = false
|
143
170
|
@force_ending_format = false
|
@@ -171,20 +198,34 @@ module MessenteApi
|
|
171
198
|
@base_path = '' if @base_path == '/'
|
172
199
|
end
|
173
200
|
|
174
|
-
|
175
|
-
|
201
|
+
# Returns base URL for specified operation based on server settings
|
202
|
+
def base_url(operation = nil)
|
203
|
+
if operation_server_settings.key?(operation) then
|
204
|
+
index = server_operation_index.fetch(operation, server_index)
|
205
|
+
server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
|
206
|
+
else
|
207
|
+
server_index.nil? ? "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') : server_url(server_index, server_variables, nil)
|
208
|
+
end
|
176
209
|
end
|
177
210
|
|
178
211
|
# Gets API key (with prefix if set).
|
179
212
|
# @param [String] param_name the parameter name of API key auth
|
180
|
-
def api_key_with_prefix(param_name)
|
213
|
+
def api_key_with_prefix(param_name, param_alias = nil)
|
214
|
+
key = @api_key[param_name]
|
215
|
+
key = @api_key.fetch(param_alias, key) unless param_alias.nil?
|
181
216
|
if @api_key_prefix[param_name]
|
182
|
-
"#{@api_key_prefix[param_name]} #{
|
217
|
+
"#{@api_key_prefix[param_name]} #{key}"
|
183
218
|
else
|
184
|
-
|
219
|
+
key
|
185
220
|
end
|
186
221
|
end
|
187
222
|
|
223
|
+
# Gets access_token using access_token_getter or uses the static access_token
|
224
|
+
def access_token_with_refresh
|
225
|
+
return access_token if access_token_getter.nil?
|
226
|
+
access_token_getter.call
|
227
|
+
end
|
228
|
+
|
188
229
|
# Gets Basic Auth token string
|
189
230
|
def basic_auth_token
|
190
231
|
'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
|
@@ -213,25 +254,32 @@ module MessenteApi
|
|
213
254
|
]
|
214
255
|
end
|
215
256
|
|
257
|
+
def operation_server_settings
|
258
|
+
{
|
259
|
+
}
|
260
|
+
end
|
261
|
+
|
216
262
|
# Returns URL based on server settings
|
217
263
|
#
|
218
264
|
# @param index array index of the server settings
|
219
265
|
# @param variables hash of variable and the corresponding value
|
220
|
-
def server_url(index, variables = {})
|
221
|
-
servers = server_settings
|
266
|
+
def server_url(index, variables = {}, servers = nil)
|
267
|
+
servers = server_settings if servers == nil
|
222
268
|
|
223
269
|
# check array index out of bound
|
224
|
-
if (index < 0 || index >= servers.size)
|
225
|
-
fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
|
270
|
+
if (index.nil? || index < 0 || index >= servers.size)
|
271
|
+
fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}"
|
226
272
|
end
|
227
273
|
|
228
274
|
server = servers[index]
|
229
275
|
url = server[:url]
|
230
276
|
|
277
|
+
return url unless server.key? :variables
|
278
|
+
|
231
279
|
# go through variable and assign a value
|
232
280
|
server[:variables].each do |name, variable|
|
233
281
|
if variables.key?(name)
|
234
|
-
if (server[:variables][name][:enum_values].include?
|
282
|
+
if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name]))
|
235
283
|
url.gsub! "{" + name.to_s + "}", variables[name]
|
236
284
|
else
|
237
285
|
fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
|
@@ -244,5 +292,7 @@ module MessenteApi
|
|
244
292
|
|
245
293
|
url
|
246
294
|
end
|
295
|
+
|
296
|
+
|
247
297
|
end
|
248
298
|
end
|
data/lib/messente_api/models/{whats_app_audio.rb → bulk_omni_message_create_success_response.rb}
RENAMED
@@ -3,32 +3,38 @@
|
|
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:
|
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
|
-
|
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
|
-
class
|
18
|
-
#
|
19
|
-
attr_accessor :
|
17
|
+
# Response received after successfully created bulk omnimessage.
|
18
|
+
class BulkOmniMessageCreateSuccessResponse
|
19
|
+
# List of responses for each Omnimessage in the bulk. These can be errors or successful responses
|
20
|
+
attr_accessor :messages
|
20
21
|
|
21
22
|
# Attribute mapping from ruby-style variable name to JSON key.
|
22
23
|
def self.attribute_map
|
23
24
|
{
|
24
|
-
:'
|
25
|
+
:'messages' => :'messages'
|
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
|
{
|
31
|
-
:'
|
37
|
+
:'messages' => :'Array<BulkOmniMessageCreateSuccessResponseMessagesInner>'
|
32
38
|
}
|
33
39
|
end
|
34
40
|
|
@@ -42,28 +48,33 @@ module MessenteApi
|
|
42
48
|
# @param [Hash] attributes Model attributes in the form of hash
|
43
49
|
def initialize(attributes = {})
|
44
50
|
if (!attributes.is_a?(Hash))
|
45
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `MessenteApi::
|
51
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `MessenteApi::BulkOmniMessageCreateSuccessResponse` initialize method"
|
46
52
|
end
|
47
53
|
|
48
54
|
# check to see if the attribute exists and convert string to symbol for hash key
|
49
55
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
50
56
|
if (!self.class.attribute_map.key?(k.to_sym))
|
51
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `MessenteApi::
|
57
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `MessenteApi::BulkOmniMessageCreateSuccessResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
52
58
|
end
|
53
59
|
h[k.to_sym] = v
|
54
60
|
}
|
55
61
|
|
56
|
-
if attributes.key?(:'
|
57
|
-
|
62
|
+
if attributes.key?(:'messages')
|
63
|
+
if (value = attributes[:'messages']).is_a?(Array)
|
64
|
+
self.messages = value
|
65
|
+
end
|
66
|
+
else
|
67
|
+
self.messages = nil
|
58
68
|
end
|
59
69
|
end
|
60
70
|
|
61
71
|
# Show invalid properties with the reasons. Usually used together with valid?
|
62
72
|
# @return Array for valid properties with the reasons
|
63
73
|
def list_invalid_properties
|
74
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
64
75
|
invalid_properties = Array.new
|
65
|
-
if @
|
66
|
-
invalid_properties.push('invalid value for "
|
76
|
+
if @messages.nil?
|
77
|
+
invalid_properties.push('invalid value for "messages", messages cannot be nil.')
|
67
78
|
end
|
68
79
|
|
69
80
|
invalid_properties
|
@@ -72,7 +83,8 @@ module MessenteApi
|
|
72
83
|
# Check to see if the all the properties in the model are valid
|
73
84
|
# @return true if the model is valid
|
74
85
|
def valid?
|
75
|
-
|
86
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
87
|
+
return false if @messages.nil?
|
76
88
|
true
|
77
89
|
end
|
78
90
|
|
@@ -81,7 +93,7 @@ module MessenteApi
|
|
81
93
|
def ==(o)
|
82
94
|
return true if self.equal?(o)
|
83
95
|
self.class == o.class &&
|
84
|
-
|
96
|
+
messages == o.messages
|
85
97
|
end
|
86
98
|
|
87
99
|
# @see the `==` method
|
@@ -93,44 +105,40 @@ module MessenteApi
|
|
93
105
|
# Calculates hash code according to all attributes.
|
94
106
|
# @return [Integer] Hash code
|
95
107
|
def hash
|
96
|
-
[
|
108
|
+
[messages].hash
|
97
109
|
end
|
98
110
|
|
99
111
|
# Builds the object from hash
|
100
112
|
# @param [Hash] attributes Model attributes in the form of hash
|
101
113
|
# @return [Object] Returns the model itself
|
102
114
|
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
115
|
return nil unless attributes.is_a?(Hash)
|
111
|
-
|
112
|
-
|
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
|
113
122
|
# check to ensure the input is an array given that the attribute
|
114
123
|
# is documented as an array but the input is not
|
115
|
-
if attributes[
|
116
|
-
|
124
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
125
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
117
126
|
end
|
118
|
-
elsif !attributes[
|
119
|
-
|
120
|
-
end
|
127
|
+
elsif !attributes[attribute_map[key]].nil?
|
128
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
129
|
+
end
|
121
130
|
end
|
122
|
-
|
123
|
-
self
|
131
|
+
new(transformed_hash)
|
124
132
|
end
|
125
133
|
|
126
134
|
# Deserializes the data based on type
|
127
135
|
# @param string type Data type
|
128
136
|
# @param string value Value to be deserialized
|
129
137
|
# @return [Object] Deserialized data
|
130
|
-
def _deserialize(type, value)
|
138
|
+
def self._deserialize(type, value)
|
131
139
|
case type.to_sym
|
132
|
-
when :
|
133
|
-
|
140
|
+
when :Time
|
141
|
+
Time.parse(value)
|
134
142
|
when :Date
|
135
143
|
Date.parse(value)
|
136
144
|
when :String
|
@@ -160,7 +168,9 @@ module MessenteApi
|
|
160
168
|
end
|
161
169
|
end
|
162
170
|
else # model
|
163
|
-
|
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)
|
164
174
|
end
|
165
175
|
end
|
166
176
|
|
@@ -186,7 +196,7 @@ module MessenteApi
|
|
186
196
|
is_nullable = self.class.openapi_nullable.include?(attr)
|
187
197
|
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
188
198
|
end
|
189
|
-
|
199
|
+
|
190
200
|
hash[param] = _to_hash(value)
|
191
201
|
end
|
192
202
|
hash
|
@@ -209,5 +219,7 @@ module MessenteApi
|
|
209
219
|
value
|
210
220
|
end
|
211
221
|
end
|
222
|
+
|
212
223
|
end
|
224
|
+
|
213
225
|
end
|