bandwidth-sdk 5.0.0 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +90 -13
  3. data/lib/bandwidth.rb +5 -2
  4. data/lib/bandwidth/api_helper.rb +5 -17
  5. data/lib/bandwidth/client.rb +23 -9
  6. data/lib/bandwidth/configuration.rb +54 -18
  7. data/lib/bandwidth/http/auth/{two_factor_auth_basic_auth.rb → multi_factor_auth_basic_auth.rb} +3 -3
  8. data/lib/bandwidth/http/auth/phone_number_lookup_basic_auth.rb +22 -0
  9. data/lib/bandwidth/http/faraday_client.rb +5 -2
  10. data/lib/bandwidth/messaging_lib/messaging.rb +1 -0
  11. data/lib/bandwidth/messaging_lib/messaging/client.rb +14 -5
  12. data/lib/bandwidth/messaging_lib/messaging/controllers/api_controller.rb +25 -29
  13. data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb +11 -2
  14. data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_message_item.rb +47 -2
  15. data/lib/bandwidth/messaging_lib/messaging/models/media.rb +5 -75
  16. data/lib/bandwidth/messaging_lib/messaging/models/message_request.rb +13 -2
  17. data/lib/bandwidth/messaging_lib/messaging/models/priority_enum.rb +19 -0
  18. data/lib/bandwidth/models/base_model.rb +19 -8
  19. data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth.rb +23 -0
  20. data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/client.rb +60 -0
  21. data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/controllers/base_controller.rb +0 -0
  22. data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth/controllers/api_controller.rb → multi_factor_auth_lib/multi_factor_auth/controllers/mfa_controller.rb} +69 -18
  23. data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/exceptions/error_with_request_exception.rb +34 -0
  24. data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/exceptions/forbidden_request_exception.rb +29 -0
  25. data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth/exceptions/unauthorized_request_exception.rb +29 -0
  26. data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/models/two_factor_code_request_schema.rb +0 -0
  27. data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/models/two_factor_messaging_response.rb +0 -0
  28. data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/models/two_factor_verify_code_response.rb +0 -0
  29. data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/models/two_factor_verify_request_schema.rb +0 -0
  30. data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/models/two_factor_voice_response.rb +0 -0
  31. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup.rb +20 -0
  32. data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → phone_number_lookup_lib/phone_number_lookup}/client.rb +15 -6
  33. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/controllers/api_controller.rb +1551 -0
  34. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/controllers/base_controller.rb +49 -0
  35. data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth/exceptions/invalid_request_exception.rb → phone_number_lookup_lib/phone_number_lookup/exceptions/accounts_tnlookup400_error_exception.rb} +5 -5
  36. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_request.rb +35 -0
  37. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_response.rb +45 -0
  38. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_status.rb +74 -0
  39. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb +107 -0
  40. data/lib/bandwidth/utilities/date_time_helper.rb +156 -0
  41. data/lib/bandwidth/voice_lib/voice.rb +14 -18
  42. data/lib/bandwidth/voice_lib/voice/client.rb +14 -5
  43. data/lib/bandwidth/voice_lib/voice/controllers/api_controller.rb +248 -230
  44. data/lib/bandwidth/voice_lib/voice/exceptions/{api_error_response_exception.rb → api_error_exception.rb} +2 -2
  45. data/lib/bandwidth/voice_lib/voice/models/{recording_metadata_response.rb → call_recording_metadata.rb} +47 -28
  46. data/lib/bandwidth/voice_lib/voice/models/call_state.rb +232 -0
  47. data/lib/bandwidth/voice_lib/voice/models/callback_method_enum.rb +2 -20
  48. data/lib/bandwidth/voice_lib/voice/models/conference_event_method_enum.rb +2 -20
  49. data/lib/bandwidth/voice_lib/voice/models/{conference_member_detail.rb → conference_member_state.rb} +8 -8
  50. data/lib/bandwidth/voice_lib/voice/models/{conference_recording_metadata_response.rb → conference_recording_metadata.rb} +34 -18
  51. data/lib/bandwidth/voice_lib/voice/models/{conference_detail.rb → conference_state.rb} +22 -14
  52. data/lib/bandwidth/voice_lib/voice/models/{api_create_call_request.rb → create_call_request.rb} +35 -59
  53. data/lib/bandwidth/voice_lib/voice/models/{api_call_response.rb → create_call_response.rb} +28 -23
  54. data/lib/bandwidth/voice_lib/voice/models/{modify_call_recording_state.rb → modify_call_recording_request.rb} +4 -4
  55. data/lib/bandwidth/voice_lib/voice/models/{api_modify_call_request.rb → modify_call_request.rb} +25 -25
  56. data/lib/bandwidth/voice_lib/voice/models/{api_modify_conference_request.rb → modify_conference_request.rb} +11 -11
  57. data/lib/bandwidth/voice_lib/voice/models/state1_enum.rb +7 -4
  58. data/lib/bandwidth/voice_lib/voice/models/state_enum.rb +4 -7
  59. data/lib/bandwidth/voice_lib/voice/models/{api_transcribe_recording_request.rb → transcribe_recording_request.rb} +8 -8
  60. data/lib/bandwidth/voice_lib/voice/models/{transcription.rb → transcription_metadata.rb} +19 -10
  61. data/lib/bandwidth/web_rtc_lib/web_rtc.rb +1 -0
  62. data/lib/bandwidth/web_rtc_lib/web_rtc/client.rb +14 -5
  63. data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/api_controller.rb +14 -14
  64. data/lib/bandwidth/web_rtc_lib/web_rtc/models/device_api_version_enum.rb +17 -0
  65. data/lib/bandwidth/web_rtc_lib/web_rtc/models/participant.rb +11 -2
  66. data/test/integration/test_integration.rb +583 -0
  67. metadata +47 -35
  68. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth.rb +0 -20
  69. data/lib/bandwidth/voice_lib/voice/models/api_call_state_response.rb +0 -164
  70. data/lib/bandwidth/voice_lib/voice/models/disconnect_cause_enum.rb +0 -47
  71. data/lib/bandwidth/voice_lib/voice/models/state2_enum.rb +0 -20
  72. data/lib/bandwidth/voice_lib/voice/models/status1_enum.rb +0 -29
  73. data/lib/bandwidth/voice_lib/voice/models/status3_enum.rb +0 -32
@@ -0,0 +1,20 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+
7
+ require_relative 'phone_number_lookup/client.rb'
8
+
9
+ # Models
10
+ require_relative 'phone_number_lookup/models/order_request.rb'
11
+ require_relative 'phone_number_lookup/models/order_response.rb'
12
+ require_relative 'phone_number_lookup/models/order_status.rb'
13
+ require_relative 'phone_number_lookup/models/result.rb'
14
+
15
+ # Exceptions
16
+ require_relative 'phone_number_lookup/exceptions/accounts_tnlookup400_error' \
17
+ '_exception.rb'
18
+ # Controllers
19
+ require_relative 'phone_number_lookup/controllers/base_controller.rb'
20
+ require_relative 'phone_number_lookup/controllers/api_controller.rb'
@@ -4,7 +4,7 @@
4
4
  # ( https://apimatic.io ).
5
5
 
6
6
  module Bandwidth
7
- module TwoFactorAuth
7
+ module PhoneNumberLookup
8
8
  # bandwidth client class.
9
9
  class Client
10
10
  attr_reader :config
@@ -16,12 +16,17 @@ module Bandwidth
16
16
  end
17
17
 
18
18
  def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
19
- backoff_factor: 1, environment: Environment::PRODUCTION,
19
+ backoff_factor: 2,
20
+ retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524, 408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
21
+ retry_methods: %i[get put get put],
22
+ environment: Environment::PRODUCTION,
20
23
  base_url: 'https://www.example.com',
21
24
  messaging_basic_auth_user_name: 'TODO: Replace',
22
25
  messaging_basic_auth_password: 'TODO: Replace',
23
- two_factor_auth_basic_auth_user_name: 'TODO: Replace',
24
- two_factor_auth_basic_auth_password: 'TODO: Replace',
26
+ multi_factor_auth_basic_auth_user_name: 'TODO: Replace',
27
+ multi_factor_auth_basic_auth_password: 'TODO: Replace',
28
+ phone_number_lookup_basic_auth_user_name: 'TODO: Replace',
29
+ phone_number_lookup_basic_auth_password: 'TODO: Replace',
25
30
  voice_basic_auth_user_name: 'TODO: Replace',
26
31
  voice_basic_auth_password: 'TODO: Replace',
27
32
  web_rtc_basic_auth_user_name: 'TODO: Replace',
@@ -32,12 +37,16 @@ module Bandwidth
32
37
  max_retries: max_retries,
33
38
  retry_interval: retry_interval,
34
39
  backoff_factor: backoff_factor,
40
+ retry_statuses: retry_statuses,
41
+ retry_methods: retry_methods,
35
42
  environment: environment,
36
43
  base_url: base_url,
37
44
  messaging_basic_auth_user_name: messaging_basic_auth_user_name,
38
45
  messaging_basic_auth_password: messaging_basic_auth_password,
39
- two_factor_auth_basic_auth_user_name: two_factor_auth_basic_auth_user_name,
40
- two_factor_auth_basic_auth_password: two_factor_auth_basic_auth_password,
46
+ multi_factor_auth_basic_auth_user_name: multi_factor_auth_basic_auth_user_name,
47
+ multi_factor_auth_basic_auth_password: multi_factor_auth_basic_auth_password,
48
+ phone_number_lookup_basic_auth_user_name: phone_number_lookup_basic_auth_user_name,
49
+ phone_number_lookup_basic_auth_password: phone_number_lookup_basic_auth_password,
41
50
  voice_basic_auth_user_name: voice_basic_auth_user_name,
42
51
  voice_basic_auth_password: voice_basic_auth_password,
43
52
  web_rtc_basic_auth_user_name: web_rtc_basic_auth_user_name,
@@ -0,0 +1,1551 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ module PhoneNumberLookup
8
+ # APIController
9
+ class APIController < BaseController
10
+ def initialize(config, http_call_back: nil)
11
+ super(config, http_call_back: http_call_back)
12
+ end
13
+
14
+ # Create a TN Lookup Order
15
+ # @param [String] account_id Required parameter: The ID of the Bandwidth
16
+ # account that the user belongs to.
17
+ # @param [OrderRequest] body Required parameter: Example:
18
+ # @return [OrderResponse] response from the API call
19
+ def create_lookup_request(account_id,
20
+ body)
21
+ # Prepare query url.
22
+ _query_builder = config.get_base_uri(Server::PHONENUMBERLOOKUPDEFAULT)
23
+ _query_builder << '/accounts/{accountId}/tnlookup'
24
+ _query_builder = APIHelper.append_url_with_template_parameters(
25
+ _query_builder,
26
+ 'accountId' => { 'value' => account_id, 'encode' => false }
27
+ )
28
+ _query_url = APIHelper.clean_url _query_builder
29
+
30
+ # Prepare headers.
31
+ _headers = {
32
+ 'accept' => 'application/json',
33
+ 'content-type' => 'application/json; charset=utf-8'
34
+ }
35
+
36
+ # Prepare and execute HttpRequest.
37
+ _request = config.http_client.post(
38
+ _query_url,
39
+ headers: _headers,
40
+ parameters: body.to_json
41
+ )
42
+ PhoneNumberLookupBasicAuth.apply(config, _request)
43
+ _response = execute_request(_request)
44
+
45
+ # Validate response against endpoint and global error codes.
46
+ if _response.status_code == 400
47
+ raise AccountsTnlookup400ErrorException.new(
48
+ 'Bad Request. Ensure that your request payload is properly' \
49
+ ' formatted and that the telephone numbers used are valid.',
50
+ _response
51
+ )
52
+ elsif _response.status_code == 401
53
+ raise APIException.new(
54
+ 'Unauthorized. Ensure that you are using the proper credentials' \
55
+ ' for the environment you are accessing, your user has' \
56
+ ' the proper role assigned to it, and that your' \
57
+ ' Bandwidth account is enabled for TN Lookup access.',
58
+ _response
59
+ )
60
+ elsif _response.status_code == 415
61
+ raise APIException.new(
62
+ 'Invalid content-type. Ensure that your content-type header is set' \
63
+ ' to application/json.',
64
+ _response
65
+ )
66
+ elsif _response.status_code == 429
67
+ raise APIException.new(
68
+ 'Too Many Requests. Reduce the amount of requests that you are' \
69
+ ' sending in order to avoid receiving this status code.',
70
+ _response
71
+ )
72
+ elsif _response.status_code == 500
73
+ raise APIException.new(
74
+ 'Unexpected error. Please contact Bandwidth Support if your' \
75
+ ' requests are receiving this status code for an' \
76
+ ' extended period of time.',
77
+ _response
78
+ )
79
+ elsif _response.status_code == 501
80
+ raise APIException.new(
81
+ 'Unexpected error. Please contact Bandwidth Support if your' \
82
+ ' requests are receiving this status code for an' \
83
+ ' extended period of time.',
84
+ _response
85
+ )
86
+ elsif _response.status_code == 502
87
+ raise APIException.new(
88
+ 'Unexpected error. Please contact Bandwidth Support if your' \
89
+ ' requests are receiving this status code for an' \
90
+ ' extended period of time.',
91
+ _response
92
+ )
93
+ elsif _response.status_code == 503
94
+ raise APIException.new(
95
+ 'Unexpected error. Please contact Bandwidth Support if your' \
96
+ ' requests are receiving this status code for an' \
97
+ ' extended period of time.',
98
+ _response
99
+ )
100
+ elsif _response.status_code == 504
101
+ raise APIException.new(
102
+ 'Unexpected error. Please contact Bandwidth Support if your' \
103
+ ' requests are receiving this status code for an' \
104
+ ' extended period of time.',
105
+ _response
106
+ )
107
+ elsif _response.status_code == 505
108
+ raise APIException.new(
109
+ 'Unexpected error. Please contact Bandwidth Support if your' \
110
+ ' requests are receiving this status code for an' \
111
+ ' extended period of time.',
112
+ _response
113
+ )
114
+ elsif _response.status_code == 506
115
+ raise APIException.new(
116
+ 'Unexpected error. Please contact Bandwidth Support if your' \
117
+ ' requests are receiving this status code for an' \
118
+ ' extended period of time.',
119
+ _response
120
+ )
121
+ elsif _response.status_code == 507
122
+ raise APIException.new(
123
+ 'Unexpected error. Please contact Bandwidth Support if your' \
124
+ ' requests are receiving this status code for an' \
125
+ ' extended period of time.',
126
+ _response
127
+ )
128
+ elsif _response.status_code == 508
129
+ raise APIException.new(
130
+ 'Unexpected error. Please contact Bandwidth Support if your' \
131
+ ' requests are receiving this status code for an' \
132
+ ' extended period of time.',
133
+ _response
134
+ )
135
+ elsif _response.status_code == 509
136
+ raise APIException.new(
137
+ 'Unexpected error. Please contact Bandwidth Support if your' \
138
+ ' requests are receiving this status code for an' \
139
+ ' extended period of time.',
140
+ _response
141
+ )
142
+ elsif _response.status_code == 510
143
+ raise APIException.new(
144
+ 'Unexpected error. Please contact Bandwidth Support if your' \
145
+ ' requests are receiving this status code for an' \
146
+ ' extended period of time.',
147
+ _response
148
+ )
149
+ elsif _response.status_code == 511
150
+ raise APIException.new(
151
+ 'Unexpected error. Please contact Bandwidth Support if your' \
152
+ ' requests are receiving this status code for an' \
153
+ ' extended period of time.',
154
+ _response
155
+ )
156
+ elsif _response.status_code == 512
157
+ raise APIException.new(
158
+ 'Unexpected error. Please contact Bandwidth Support if your' \
159
+ ' requests are receiving this status code for an' \
160
+ ' extended period of time.',
161
+ _response
162
+ )
163
+ elsif _response.status_code == 513
164
+ raise APIException.new(
165
+ 'Unexpected error. Please contact Bandwidth Support if your' \
166
+ ' requests are receiving this status code for an' \
167
+ ' extended period of time.',
168
+ _response
169
+ )
170
+ elsif _response.status_code == 514
171
+ raise APIException.new(
172
+ 'Unexpected error. Please contact Bandwidth Support if your' \
173
+ ' requests are receiving this status code for an' \
174
+ ' extended period of time.',
175
+ _response
176
+ )
177
+ elsif _response.status_code == 515
178
+ raise APIException.new(
179
+ 'Unexpected error. Please contact Bandwidth Support if your' \
180
+ ' requests are receiving this status code for an' \
181
+ ' extended period of time.',
182
+ _response
183
+ )
184
+ elsif _response.status_code == 516
185
+ raise APIException.new(
186
+ 'Unexpected error. Please contact Bandwidth Support if your' \
187
+ ' requests are receiving this status code for an' \
188
+ ' extended period of time.',
189
+ _response
190
+ )
191
+ elsif _response.status_code == 517
192
+ raise APIException.new(
193
+ 'Unexpected error. Please contact Bandwidth Support if your' \
194
+ ' requests are receiving this status code for an' \
195
+ ' extended period of time.',
196
+ _response
197
+ )
198
+ elsif _response.status_code == 518
199
+ raise APIException.new(
200
+ 'Unexpected error. Please contact Bandwidth Support if your' \
201
+ ' requests are receiving this status code for an' \
202
+ ' extended period of time.',
203
+ _response
204
+ )
205
+ elsif _response.status_code == 519
206
+ raise APIException.new(
207
+ 'Unexpected error. Please contact Bandwidth Support if your' \
208
+ ' requests are receiving this status code for an' \
209
+ ' extended period of time.',
210
+ _response
211
+ )
212
+ elsif _response.status_code == 520
213
+ raise APIException.new(
214
+ 'Unexpected error. Please contact Bandwidth Support if your' \
215
+ ' requests are receiving this status code for an' \
216
+ ' extended period of time.',
217
+ _response
218
+ )
219
+ elsif _response.status_code == 521
220
+ raise APIException.new(
221
+ 'Unexpected error. Please contact Bandwidth Support if your' \
222
+ ' requests are receiving this status code for an' \
223
+ ' extended period of time.',
224
+ _response
225
+ )
226
+ elsif _response.status_code == 522
227
+ raise APIException.new(
228
+ 'Unexpected error. Please contact Bandwidth Support if your' \
229
+ ' requests are receiving this status code for an' \
230
+ ' extended period of time.',
231
+ _response
232
+ )
233
+ elsif _response.status_code == 523
234
+ raise APIException.new(
235
+ 'Unexpected error. Please contact Bandwidth Support if your' \
236
+ ' requests are receiving this status code for an' \
237
+ ' extended period of time.',
238
+ _response
239
+ )
240
+ elsif _response.status_code == 524
241
+ raise APIException.new(
242
+ 'Unexpected error. Please contact Bandwidth Support if your' \
243
+ ' requests are receiving this status code for an' \
244
+ ' extended period of time.',
245
+ _response
246
+ )
247
+ elsif _response.status_code == 525
248
+ raise APIException.new(
249
+ 'Unexpected error. Please contact Bandwidth Support if your' \
250
+ ' requests are receiving this status code for an' \
251
+ ' extended period of time.',
252
+ _response
253
+ )
254
+ elsif _response.status_code == 526
255
+ raise APIException.new(
256
+ 'Unexpected error. Please contact Bandwidth Support if your' \
257
+ ' requests are receiving this status code for an' \
258
+ ' extended period of time.',
259
+ _response
260
+ )
261
+ elsif _response.status_code == 527
262
+ raise APIException.new(
263
+ 'Unexpected error. Please contact Bandwidth Support if your' \
264
+ ' requests are receiving this status code for an' \
265
+ ' extended period of time.',
266
+ _response
267
+ )
268
+ elsif _response.status_code == 528
269
+ raise APIException.new(
270
+ 'Unexpected error. Please contact Bandwidth Support if your' \
271
+ ' requests are receiving this status code for an' \
272
+ ' extended period of time.',
273
+ _response
274
+ )
275
+ elsif _response.status_code == 529
276
+ raise APIException.new(
277
+ 'Unexpected error. Please contact Bandwidth Support if your' \
278
+ ' requests are receiving this status code for an' \
279
+ ' extended period of time.',
280
+ _response
281
+ )
282
+ elsif _response.status_code == 530
283
+ raise APIException.new(
284
+ 'Unexpected error. Please contact Bandwidth Support if your' \
285
+ ' requests are receiving this status code for an' \
286
+ ' extended period of time.',
287
+ _response
288
+ )
289
+ elsif _response.status_code == 531
290
+ raise APIException.new(
291
+ 'Unexpected error. Please contact Bandwidth Support if your' \
292
+ ' requests are receiving this status code for an' \
293
+ ' extended period of time.',
294
+ _response
295
+ )
296
+ elsif _response.status_code == 532
297
+ raise APIException.new(
298
+ 'Unexpected error. Please contact Bandwidth Support if your' \
299
+ ' requests are receiving this status code for an' \
300
+ ' extended period of time.',
301
+ _response
302
+ )
303
+ elsif _response.status_code == 533
304
+ raise APIException.new(
305
+ 'Unexpected error. Please contact Bandwidth Support if your' \
306
+ ' requests are receiving this status code for an' \
307
+ ' extended period of time.',
308
+ _response
309
+ )
310
+ elsif _response.status_code == 534
311
+ raise APIException.new(
312
+ 'Unexpected error. Please contact Bandwidth Support if your' \
313
+ ' requests are receiving this status code for an' \
314
+ ' extended period of time.',
315
+ _response
316
+ )
317
+ elsif _response.status_code == 535
318
+ raise APIException.new(
319
+ 'Unexpected error. Please contact Bandwidth Support if your' \
320
+ ' requests are receiving this status code for an' \
321
+ ' extended period of time.',
322
+ _response
323
+ )
324
+ elsif _response.status_code == 536
325
+ raise APIException.new(
326
+ 'Unexpected error. Please contact Bandwidth Support if your' \
327
+ ' requests are receiving this status code for an' \
328
+ ' extended period of time.',
329
+ _response
330
+ )
331
+ elsif _response.status_code == 537
332
+ raise APIException.new(
333
+ 'Unexpected error. Please contact Bandwidth Support if your' \
334
+ ' requests are receiving this status code for an' \
335
+ ' extended period of time.',
336
+ _response
337
+ )
338
+ elsif _response.status_code == 538
339
+ raise APIException.new(
340
+ 'Unexpected error. Please contact Bandwidth Support if your' \
341
+ ' requests are receiving this status code for an' \
342
+ ' extended period of time.',
343
+ _response
344
+ )
345
+ elsif _response.status_code == 539
346
+ raise APIException.new(
347
+ 'Unexpected error. Please contact Bandwidth Support if your' \
348
+ ' requests are receiving this status code for an' \
349
+ ' extended period of time.',
350
+ _response
351
+ )
352
+ elsif _response.status_code == 540
353
+ raise APIException.new(
354
+ 'Unexpected error. Please contact Bandwidth Support if your' \
355
+ ' requests are receiving this status code for an' \
356
+ ' extended period of time.',
357
+ _response
358
+ )
359
+ elsif _response.status_code == 541
360
+ raise APIException.new(
361
+ 'Unexpected error. Please contact Bandwidth Support if your' \
362
+ ' requests are receiving this status code for an' \
363
+ ' extended period of time.',
364
+ _response
365
+ )
366
+ elsif _response.status_code == 542
367
+ raise APIException.new(
368
+ 'Unexpected error. Please contact Bandwidth Support if your' \
369
+ ' requests are receiving this status code for an' \
370
+ ' extended period of time.',
371
+ _response
372
+ )
373
+ elsif _response.status_code == 543
374
+ raise APIException.new(
375
+ 'Unexpected error. Please contact Bandwidth Support if your' \
376
+ ' requests are receiving this status code for an' \
377
+ ' extended period of time.',
378
+ _response
379
+ )
380
+ elsif _response.status_code == 544
381
+ raise APIException.new(
382
+ 'Unexpected error. Please contact Bandwidth Support if your' \
383
+ ' requests are receiving this status code for an' \
384
+ ' extended period of time.',
385
+ _response
386
+ )
387
+ elsif _response.status_code == 545
388
+ raise APIException.new(
389
+ 'Unexpected error. Please contact Bandwidth Support if your' \
390
+ ' requests are receiving this status code for an' \
391
+ ' extended period of time.',
392
+ _response
393
+ )
394
+ elsif _response.status_code == 546
395
+ raise APIException.new(
396
+ 'Unexpected error. Please contact Bandwidth Support if your' \
397
+ ' requests are receiving this status code for an' \
398
+ ' extended period of time.',
399
+ _response
400
+ )
401
+ elsif _response.status_code == 547
402
+ raise APIException.new(
403
+ 'Unexpected error. Please contact Bandwidth Support if your' \
404
+ ' requests are receiving this status code for an' \
405
+ ' extended period of time.',
406
+ _response
407
+ )
408
+ elsif _response.status_code == 548
409
+ raise APIException.new(
410
+ 'Unexpected error. Please contact Bandwidth Support if your' \
411
+ ' requests are receiving this status code for an' \
412
+ ' extended period of time.',
413
+ _response
414
+ )
415
+ elsif _response.status_code == 549
416
+ raise APIException.new(
417
+ 'Unexpected error. Please contact Bandwidth Support if your' \
418
+ ' requests are receiving this status code for an' \
419
+ ' extended period of time.',
420
+ _response
421
+ )
422
+ elsif _response.status_code == 550
423
+ raise APIException.new(
424
+ 'Unexpected error. Please contact Bandwidth Support if your' \
425
+ ' requests are receiving this status code for an' \
426
+ ' extended period of time.',
427
+ _response
428
+ )
429
+ elsif _response.status_code == 551
430
+ raise APIException.new(
431
+ 'Unexpected error. Please contact Bandwidth Support if your' \
432
+ ' requests are receiving this status code for an' \
433
+ ' extended period of time.',
434
+ _response
435
+ )
436
+ elsif _response.status_code == 552
437
+ raise APIException.new(
438
+ 'Unexpected error. Please contact Bandwidth Support if your' \
439
+ ' requests are receiving this status code for an' \
440
+ ' extended period of time.',
441
+ _response
442
+ )
443
+ elsif _response.status_code == 553
444
+ raise APIException.new(
445
+ 'Unexpected error. Please contact Bandwidth Support if your' \
446
+ ' requests are receiving this status code for an' \
447
+ ' extended period of time.',
448
+ _response
449
+ )
450
+ elsif _response.status_code == 554
451
+ raise APIException.new(
452
+ 'Unexpected error. Please contact Bandwidth Support if your' \
453
+ ' requests are receiving this status code for an' \
454
+ ' extended period of time.',
455
+ _response
456
+ )
457
+ elsif _response.status_code == 555
458
+ raise APIException.new(
459
+ 'Unexpected error. Please contact Bandwidth Support if your' \
460
+ ' requests are receiving this status code for an' \
461
+ ' extended period of time.',
462
+ _response
463
+ )
464
+ elsif _response.status_code == 556
465
+ raise APIException.new(
466
+ 'Unexpected error. Please contact Bandwidth Support if your' \
467
+ ' requests are receiving this status code for an' \
468
+ ' extended period of time.',
469
+ _response
470
+ )
471
+ elsif _response.status_code == 557
472
+ raise APIException.new(
473
+ 'Unexpected error. Please contact Bandwidth Support if your' \
474
+ ' requests are receiving this status code for an' \
475
+ ' extended period of time.',
476
+ _response
477
+ )
478
+ elsif _response.status_code == 558
479
+ raise APIException.new(
480
+ 'Unexpected error. Please contact Bandwidth Support if your' \
481
+ ' requests are receiving this status code for an' \
482
+ ' extended period of time.',
483
+ _response
484
+ )
485
+ elsif _response.status_code == 559
486
+ raise APIException.new(
487
+ 'Unexpected error. Please contact Bandwidth Support if your' \
488
+ ' requests are receiving this status code for an' \
489
+ ' extended period of time.',
490
+ _response
491
+ )
492
+ elsif _response.status_code == 560
493
+ raise APIException.new(
494
+ 'Unexpected error. Please contact Bandwidth Support if your' \
495
+ ' requests are receiving this status code for an' \
496
+ ' extended period of time.',
497
+ _response
498
+ )
499
+ elsif _response.status_code == 561
500
+ raise APIException.new(
501
+ 'Unexpected error. Please contact Bandwidth Support if your' \
502
+ ' requests are receiving this status code for an' \
503
+ ' extended period of time.',
504
+ _response
505
+ )
506
+ elsif _response.status_code == 562
507
+ raise APIException.new(
508
+ 'Unexpected error. Please contact Bandwidth Support if your' \
509
+ ' requests are receiving this status code for an' \
510
+ ' extended period of time.',
511
+ _response
512
+ )
513
+ elsif _response.status_code == 563
514
+ raise APIException.new(
515
+ 'Unexpected error. Please contact Bandwidth Support if your' \
516
+ ' requests are receiving this status code for an' \
517
+ ' extended period of time.',
518
+ _response
519
+ )
520
+ elsif _response.status_code == 564
521
+ raise APIException.new(
522
+ 'Unexpected error. Please contact Bandwidth Support if your' \
523
+ ' requests are receiving this status code for an' \
524
+ ' extended period of time.',
525
+ _response
526
+ )
527
+ elsif _response.status_code == 565
528
+ raise APIException.new(
529
+ 'Unexpected error. Please contact Bandwidth Support if your' \
530
+ ' requests are receiving this status code for an' \
531
+ ' extended period of time.',
532
+ _response
533
+ )
534
+ elsif _response.status_code == 566
535
+ raise APIException.new(
536
+ 'Unexpected error. Please contact Bandwidth Support if your' \
537
+ ' requests are receiving this status code for an' \
538
+ ' extended period of time.',
539
+ _response
540
+ )
541
+ elsif _response.status_code == 567
542
+ raise APIException.new(
543
+ 'Unexpected error. Please contact Bandwidth Support if your' \
544
+ ' requests are receiving this status code for an' \
545
+ ' extended period of time.',
546
+ _response
547
+ )
548
+ elsif _response.status_code == 568
549
+ raise APIException.new(
550
+ 'Unexpected error. Please contact Bandwidth Support if your' \
551
+ ' requests are receiving this status code for an' \
552
+ ' extended period of time.',
553
+ _response
554
+ )
555
+ elsif _response.status_code == 569
556
+ raise APIException.new(
557
+ 'Unexpected error. Please contact Bandwidth Support if your' \
558
+ ' requests are receiving this status code for an' \
559
+ ' extended period of time.',
560
+ _response
561
+ )
562
+ elsif _response.status_code == 570
563
+ raise APIException.new(
564
+ 'Unexpected error. Please contact Bandwidth Support if your' \
565
+ ' requests are receiving this status code for an' \
566
+ ' extended period of time.',
567
+ _response
568
+ )
569
+ elsif _response.status_code == 571
570
+ raise APIException.new(
571
+ 'Unexpected error. Please contact Bandwidth Support if your' \
572
+ ' requests are receiving this status code for an' \
573
+ ' extended period of time.',
574
+ _response
575
+ )
576
+ elsif _response.status_code == 572
577
+ raise APIException.new(
578
+ 'Unexpected error. Please contact Bandwidth Support if your' \
579
+ ' requests are receiving this status code for an' \
580
+ ' extended period of time.',
581
+ _response
582
+ )
583
+ elsif _response.status_code == 573
584
+ raise APIException.new(
585
+ 'Unexpected error. Please contact Bandwidth Support if your' \
586
+ ' requests are receiving this status code for an' \
587
+ ' extended period of time.',
588
+ _response
589
+ )
590
+ elsif _response.status_code == 574
591
+ raise APIException.new(
592
+ 'Unexpected error. Please contact Bandwidth Support if your' \
593
+ ' requests are receiving this status code for an' \
594
+ ' extended period of time.',
595
+ _response
596
+ )
597
+ elsif _response.status_code == 575
598
+ raise APIException.new(
599
+ 'Unexpected error. Please contact Bandwidth Support if your' \
600
+ ' requests are receiving this status code for an' \
601
+ ' extended period of time.',
602
+ _response
603
+ )
604
+ elsif _response.status_code == 576
605
+ raise APIException.new(
606
+ 'Unexpected error. Please contact Bandwidth Support if your' \
607
+ ' requests are receiving this status code for an' \
608
+ ' extended period of time.',
609
+ _response
610
+ )
611
+ elsif _response.status_code == 577
612
+ raise APIException.new(
613
+ 'Unexpected error. Please contact Bandwidth Support if your' \
614
+ ' requests are receiving this status code for an' \
615
+ ' extended period of time.',
616
+ _response
617
+ )
618
+ elsif _response.status_code == 578
619
+ raise APIException.new(
620
+ 'Unexpected error. Please contact Bandwidth Support if your' \
621
+ ' requests are receiving this status code for an' \
622
+ ' extended period of time.',
623
+ _response
624
+ )
625
+ elsif _response.status_code == 579
626
+ raise APIException.new(
627
+ 'Unexpected error. Please contact Bandwidth Support if your' \
628
+ ' requests are receiving this status code for an' \
629
+ ' extended period of time.',
630
+ _response
631
+ )
632
+ elsif _response.status_code == 580
633
+ raise APIException.new(
634
+ 'Unexpected error. Please contact Bandwidth Support if your' \
635
+ ' requests are receiving this status code for an' \
636
+ ' extended period of time.',
637
+ _response
638
+ )
639
+ elsif _response.status_code == 581
640
+ raise APIException.new(
641
+ 'Unexpected error. Please contact Bandwidth Support if your' \
642
+ ' requests are receiving this status code for an' \
643
+ ' extended period of time.',
644
+ _response
645
+ )
646
+ elsif _response.status_code == 582
647
+ raise APIException.new(
648
+ 'Unexpected error. Please contact Bandwidth Support if your' \
649
+ ' requests are receiving this status code for an' \
650
+ ' extended period of time.',
651
+ _response
652
+ )
653
+ elsif _response.status_code == 583
654
+ raise APIException.new(
655
+ 'Unexpected error. Please contact Bandwidth Support if your' \
656
+ ' requests are receiving this status code for an' \
657
+ ' extended period of time.',
658
+ _response
659
+ )
660
+ elsif _response.status_code == 584
661
+ raise APIException.new(
662
+ 'Unexpected error. Please contact Bandwidth Support if your' \
663
+ ' requests are receiving this status code for an' \
664
+ ' extended period of time.',
665
+ _response
666
+ )
667
+ elsif _response.status_code == 585
668
+ raise APIException.new(
669
+ 'Unexpected error. Please contact Bandwidth Support if your' \
670
+ ' requests are receiving this status code for an' \
671
+ ' extended period of time.',
672
+ _response
673
+ )
674
+ elsif _response.status_code == 586
675
+ raise APIException.new(
676
+ 'Unexpected error. Please contact Bandwidth Support if your' \
677
+ ' requests are receiving this status code for an' \
678
+ ' extended period of time.',
679
+ _response
680
+ )
681
+ elsif _response.status_code == 587
682
+ raise APIException.new(
683
+ 'Unexpected error. Please contact Bandwidth Support if your' \
684
+ ' requests are receiving this status code for an' \
685
+ ' extended period of time.',
686
+ _response
687
+ )
688
+ elsif _response.status_code == 588
689
+ raise APIException.new(
690
+ 'Unexpected error. Please contact Bandwidth Support if your' \
691
+ ' requests are receiving this status code for an' \
692
+ ' extended period of time.',
693
+ _response
694
+ )
695
+ elsif _response.status_code == 589
696
+ raise APIException.new(
697
+ 'Unexpected error. Please contact Bandwidth Support if your' \
698
+ ' requests are receiving this status code for an' \
699
+ ' extended period of time.',
700
+ _response
701
+ )
702
+ elsif _response.status_code == 590
703
+ raise APIException.new(
704
+ 'Unexpected error. Please contact Bandwidth Support if your' \
705
+ ' requests are receiving this status code for an' \
706
+ ' extended period of time.',
707
+ _response
708
+ )
709
+ elsif _response.status_code == 591
710
+ raise APIException.new(
711
+ 'Unexpected error. Please contact Bandwidth Support if your' \
712
+ ' requests are receiving this status code for an' \
713
+ ' extended period of time.',
714
+ _response
715
+ )
716
+ elsif _response.status_code == 592
717
+ raise APIException.new(
718
+ 'Unexpected error. Please contact Bandwidth Support if your' \
719
+ ' requests are receiving this status code for an' \
720
+ ' extended period of time.',
721
+ _response
722
+ )
723
+ elsif _response.status_code == 593
724
+ raise APIException.new(
725
+ 'Unexpected error. Please contact Bandwidth Support if your' \
726
+ ' requests are receiving this status code for an' \
727
+ ' extended period of time.',
728
+ _response
729
+ )
730
+ elsif _response.status_code == 594
731
+ raise APIException.new(
732
+ 'Unexpected error. Please contact Bandwidth Support if your' \
733
+ ' requests are receiving this status code for an' \
734
+ ' extended period of time.',
735
+ _response
736
+ )
737
+ elsif _response.status_code == 595
738
+ raise APIException.new(
739
+ 'Unexpected error. Please contact Bandwidth Support if your' \
740
+ ' requests are receiving this status code for an' \
741
+ ' extended period of time.',
742
+ _response
743
+ )
744
+ elsif _response.status_code == 596
745
+ raise APIException.new(
746
+ 'Unexpected error. Please contact Bandwidth Support if your' \
747
+ ' requests are receiving this status code for an' \
748
+ ' extended period of time.',
749
+ _response
750
+ )
751
+ elsif _response.status_code == 597
752
+ raise APIException.new(
753
+ 'Unexpected error. Please contact Bandwidth Support if your' \
754
+ ' requests are receiving this status code for an' \
755
+ ' extended period of time.',
756
+ _response
757
+ )
758
+ elsif _response.status_code == 598
759
+ raise APIException.new(
760
+ 'Unexpected error. Please contact Bandwidth Support if your' \
761
+ ' requests are receiving this status code for an' \
762
+ ' extended period of time.',
763
+ _response
764
+ )
765
+ elsif _response.status_code == 599
766
+ raise APIException.new(
767
+ 'Unexpected error. Please contact Bandwidth Support if your' \
768
+ ' requests are receiving this status code for an' \
769
+ ' extended period of time.',
770
+ _response
771
+ )
772
+ end
773
+ validate_response(_response)
774
+
775
+ # Return appropriate response type.
776
+ decoded = APIHelper.json_deserialize(_response.raw_body)
777
+ ApiResponse.new(
778
+ _response, data: OrderResponse.from_hash(decoded)
779
+ )
780
+ end
781
+
782
+ # Query an existing TN Lookup Order
783
+ # @param [String] account_id Required parameter: The ID of the Bandwidth
784
+ # account that the user belongs to.
785
+ # @param [String] request_id Required parameter: Example:
786
+ # @return [OrderStatus] response from the API call
787
+ def get_lookup_request_status(account_id,
788
+ request_id)
789
+ # Prepare query url.
790
+ _query_builder = config.get_base_uri(Server::PHONENUMBERLOOKUPDEFAULT)
791
+ _query_builder << '/accounts/{accountId}/tnlookup/{requestId}'
792
+ _query_builder = APIHelper.append_url_with_template_parameters(
793
+ _query_builder,
794
+ 'accountId' => { 'value' => account_id, 'encode' => false },
795
+ 'requestId' => { 'value' => request_id, 'encode' => false }
796
+ )
797
+ _query_url = APIHelper.clean_url _query_builder
798
+
799
+ # Prepare headers.
800
+ _headers = {
801
+ 'accept' => 'application/json'
802
+ }
803
+
804
+ # Prepare and execute HttpRequest.
805
+ _request = config.http_client.get(
806
+ _query_url,
807
+ headers: _headers
808
+ )
809
+ PhoneNumberLookupBasicAuth.apply(config, _request)
810
+ _response = execute_request(_request)
811
+
812
+ # Validate response against endpoint and global error codes.
813
+ if _response.status_code == 400
814
+ raise APIException.new(
815
+ 'Bad Request. Ensure that you have set the requestId as a URL path' \
816
+ ' parameter.',
817
+ _response
818
+ )
819
+ elsif _response.status_code == 401
820
+ raise APIException.new(
821
+ 'Unauthorized. Ensure that you are using the proper credentials' \
822
+ ' for the environment you are accessing, your user has' \
823
+ ' the proper role assigned to it, and that your' \
824
+ ' Bandwidth account is enabled for TN Lookup access.',
825
+ _response
826
+ )
827
+ elsif _response.status_code == 404
828
+ raise APIException.new(
829
+ 'RequestId not found. Ensure that the requestId used in the URL' \
830
+ ' path is valid and maps to a previous request that was' \
831
+ ' submitted.',
832
+ _response
833
+ )
834
+ elsif _response.status_code == 429
835
+ raise APIException.new(
836
+ 'Too Many Requests. Reduce the amount of requests that you are' \
837
+ ' sending in order to avoid receiving this status code.',
838
+ _response
839
+ )
840
+ elsif _response.status_code == 500
841
+ raise APIException.new(
842
+ 'Unexpected error. Please contact Bandwidth Support if your' \
843
+ ' requests are receiving this status code for an' \
844
+ ' extended period of time.',
845
+ _response
846
+ )
847
+ elsif _response.status_code == 501
848
+ raise APIException.new(
849
+ 'Unexpected error. Please contact Bandwidth Support if your' \
850
+ ' requests are receiving this status code for an' \
851
+ ' extended period of time.',
852
+ _response
853
+ )
854
+ elsif _response.status_code == 502
855
+ raise APIException.new(
856
+ 'Unexpected error. Please contact Bandwidth Support if your' \
857
+ ' requests are receiving this status code for an' \
858
+ ' extended period of time.',
859
+ _response
860
+ )
861
+ elsif _response.status_code == 503
862
+ raise APIException.new(
863
+ 'Unexpected error. Please contact Bandwidth Support if your' \
864
+ ' requests are receiving this status code for an' \
865
+ ' extended period of time.',
866
+ _response
867
+ )
868
+ elsif _response.status_code == 504
869
+ raise APIException.new(
870
+ 'Unexpected error. Please contact Bandwidth Support if your' \
871
+ ' requests are receiving this status code for an' \
872
+ ' extended period of time.',
873
+ _response
874
+ )
875
+ elsif _response.status_code == 505
876
+ raise APIException.new(
877
+ 'Unexpected error. Please contact Bandwidth Support if your' \
878
+ ' requests are receiving this status code for an' \
879
+ ' extended period of time.',
880
+ _response
881
+ )
882
+ elsif _response.status_code == 506
883
+ raise APIException.new(
884
+ 'Unexpected error. Please contact Bandwidth Support if your' \
885
+ ' requests are receiving this status code for an' \
886
+ ' extended period of time.',
887
+ _response
888
+ )
889
+ elsif _response.status_code == 507
890
+ raise APIException.new(
891
+ 'Unexpected error. Please contact Bandwidth Support if your' \
892
+ ' requests are receiving this status code for an' \
893
+ ' extended period of time.',
894
+ _response
895
+ )
896
+ elsif _response.status_code == 508
897
+ raise APIException.new(
898
+ 'Unexpected error. Please contact Bandwidth Support if your' \
899
+ ' requests are receiving this status code for an' \
900
+ ' extended period of time.',
901
+ _response
902
+ )
903
+ elsif _response.status_code == 509
904
+ raise APIException.new(
905
+ 'Unexpected error. Please contact Bandwidth Support if your' \
906
+ ' requests are receiving this status code for an' \
907
+ ' extended period of time.',
908
+ _response
909
+ )
910
+ elsif _response.status_code == 510
911
+ raise APIException.new(
912
+ 'Unexpected error. Please contact Bandwidth Support if your' \
913
+ ' requests are receiving this status code for an' \
914
+ ' extended period of time.',
915
+ _response
916
+ )
917
+ elsif _response.status_code == 511
918
+ raise APIException.new(
919
+ 'Unexpected error. Please contact Bandwidth Support if your' \
920
+ ' requests are receiving this status code for an' \
921
+ ' extended period of time.',
922
+ _response
923
+ )
924
+ elsif _response.status_code == 512
925
+ raise APIException.new(
926
+ 'Unexpected error. Please contact Bandwidth Support if your' \
927
+ ' requests are receiving this status code for an' \
928
+ ' extended period of time.',
929
+ _response
930
+ )
931
+ elsif _response.status_code == 513
932
+ raise APIException.new(
933
+ 'Unexpected error. Please contact Bandwidth Support if your' \
934
+ ' requests are receiving this status code for an' \
935
+ ' extended period of time.',
936
+ _response
937
+ )
938
+ elsif _response.status_code == 514
939
+ raise APIException.new(
940
+ 'Unexpected error. Please contact Bandwidth Support if your' \
941
+ ' requests are receiving this status code for an' \
942
+ ' extended period of time.',
943
+ _response
944
+ )
945
+ elsif _response.status_code == 515
946
+ raise APIException.new(
947
+ 'Unexpected error. Please contact Bandwidth Support if your' \
948
+ ' requests are receiving this status code for an' \
949
+ ' extended period of time.',
950
+ _response
951
+ )
952
+ elsif _response.status_code == 516
953
+ raise APIException.new(
954
+ 'Unexpected error. Please contact Bandwidth Support if your' \
955
+ ' requests are receiving this status code for an' \
956
+ ' extended period of time.',
957
+ _response
958
+ )
959
+ elsif _response.status_code == 517
960
+ raise APIException.new(
961
+ 'Unexpected error. Please contact Bandwidth Support if your' \
962
+ ' requests are receiving this status code for an' \
963
+ ' extended period of time.',
964
+ _response
965
+ )
966
+ elsif _response.status_code == 518
967
+ raise APIException.new(
968
+ 'Unexpected error. Please contact Bandwidth Support if your' \
969
+ ' requests are receiving this status code for an' \
970
+ ' extended period of time.',
971
+ _response
972
+ )
973
+ elsif _response.status_code == 519
974
+ raise APIException.new(
975
+ 'Unexpected error. Please contact Bandwidth Support if your' \
976
+ ' requests are receiving this status code for an' \
977
+ ' extended period of time.',
978
+ _response
979
+ )
980
+ elsif _response.status_code == 520
981
+ raise APIException.new(
982
+ 'Unexpected error. Please contact Bandwidth Support if your' \
983
+ ' requests are receiving this status code for an' \
984
+ ' extended period of time.',
985
+ _response
986
+ )
987
+ elsif _response.status_code == 521
988
+ raise APIException.new(
989
+ 'Unexpected error. Please contact Bandwidth Support if your' \
990
+ ' requests are receiving this status code for an' \
991
+ ' extended period of time.',
992
+ _response
993
+ )
994
+ elsif _response.status_code == 522
995
+ raise APIException.new(
996
+ 'Unexpected error. Please contact Bandwidth Support if your' \
997
+ ' requests are receiving this status code for an' \
998
+ ' extended period of time.',
999
+ _response
1000
+ )
1001
+ elsif _response.status_code == 523
1002
+ raise APIException.new(
1003
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1004
+ ' requests are receiving this status code for an' \
1005
+ ' extended period of time.',
1006
+ _response
1007
+ )
1008
+ elsif _response.status_code == 524
1009
+ raise APIException.new(
1010
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1011
+ ' requests are receiving this status code for an' \
1012
+ ' extended period of time.',
1013
+ _response
1014
+ )
1015
+ elsif _response.status_code == 525
1016
+ raise APIException.new(
1017
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1018
+ ' requests are receiving this status code for an' \
1019
+ ' extended period of time.',
1020
+ _response
1021
+ )
1022
+ elsif _response.status_code == 526
1023
+ raise APIException.new(
1024
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1025
+ ' requests are receiving this status code for an' \
1026
+ ' extended period of time.',
1027
+ _response
1028
+ )
1029
+ elsif _response.status_code == 527
1030
+ raise APIException.new(
1031
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1032
+ ' requests are receiving this status code for an' \
1033
+ ' extended period of time.',
1034
+ _response
1035
+ )
1036
+ elsif _response.status_code == 528
1037
+ raise APIException.new(
1038
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1039
+ ' requests are receiving this status code for an' \
1040
+ ' extended period of time.',
1041
+ _response
1042
+ )
1043
+ elsif _response.status_code == 529
1044
+ raise APIException.new(
1045
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1046
+ ' requests are receiving this status code for an' \
1047
+ ' extended period of time.',
1048
+ _response
1049
+ )
1050
+ elsif _response.status_code == 530
1051
+ raise APIException.new(
1052
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1053
+ ' requests are receiving this status code for an' \
1054
+ ' extended period of time.',
1055
+ _response
1056
+ )
1057
+ elsif _response.status_code == 531
1058
+ raise APIException.new(
1059
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1060
+ ' requests are receiving this status code for an' \
1061
+ ' extended period of time.',
1062
+ _response
1063
+ )
1064
+ elsif _response.status_code == 532
1065
+ raise APIException.new(
1066
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1067
+ ' requests are receiving this status code for an' \
1068
+ ' extended period of time.',
1069
+ _response
1070
+ )
1071
+ elsif _response.status_code == 533
1072
+ raise APIException.new(
1073
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1074
+ ' requests are receiving this status code for an' \
1075
+ ' extended period of time.',
1076
+ _response
1077
+ )
1078
+ elsif _response.status_code == 534
1079
+ raise APIException.new(
1080
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1081
+ ' requests are receiving this status code for an' \
1082
+ ' extended period of time.',
1083
+ _response
1084
+ )
1085
+ elsif _response.status_code == 535
1086
+ raise APIException.new(
1087
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1088
+ ' requests are receiving this status code for an' \
1089
+ ' extended period of time.',
1090
+ _response
1091
+ )
1092
+ elsif _response.status_code == 536
1093
+ raise APIException.new(
1094
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1095
+ ' requests are receiving this status code for an' \
1096
+ ' extended period of time.',
1097
+ _response
1098
+ )
1099
+ elsif _response.status_code == 537
1100
+ raise APIException.new(
1101
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1102
+ ' requests are receiving this status code for an' \
1103
+ ' extended period of time.',
1104
+ _response
1105
+ )
1106
+ elsif _response.status_code == 538
1107
+ raise APIException.new(
1108
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1109
+ ' requests are receiving this status code for an' \
1110
+ ' extended period of time.',
1111
+ _response
1112
+ )
1113
+ elsif _response.status_code == 539
1114
+ raise APIException.new(
1115
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1116
+ ' requests are receiving this status code for an' \
1117
+ ' extended period of time.',
1118
+ _response
1119
+ )
1120
+ elsif _response.status_code == 540
1121
+ raise APIException.new(
1122
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1123
+ ' requests are receiving this status code for an' \
1124
+ ' extended period of time.',
1125
+ _response
1126
+ )
1127
+ elsif _response.status_code == 541
1128
+ raise APIException.new(
1129
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1130
+ ' requests are receiving this status code for an' \
1131
+ ' extended period of time.',
1132
+ _response
1133
+ )
1134
+ elsif _response.status_code == 542
1135
+ raise APIException.new(
1136
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1137
+ ' requests are receiving this status code for an' \
1138
+ ' extended period of time.',
1139
+ _response
1140
+ )
1141
+ elsif _response.status_code == 543
1142
+ raise APIException.new(
1143
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1144
+ ' requests are receiving this status code for an' \
1145
+ ' extended period of time.',
1146
+ _response
1147
+ )
1148
+ elsif _response.status_code == 544
1149
+ raise APIException.new(
1150
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1151
+ ' requests are receiving this status code for an' \
1152
+ ' extended period of time.',
1153
+ _response
1154
+ )
1155
+ elsif _response.status_code == 545
1156
+ raise APIException.new(
1157
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1158
+ ' requests are receiving this status code for an' \
1159
+ ' extended period of time.',
1160
+ _response
1161
+ )
1162
+ elsif _response.status_code == 546
1163
+ raise APIException.new(
1164
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1165
+ ' requests are receiving this status code for an' \
1166
+ ' extended period of time.',
1167
+ _response
1168
+ )
1169
+ elsif _response.status_code == 547
1170
+ raise APIException.new(
1171
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1172
+ ' requests are receiving this status code for an' \
1173
+ ' extended period of time.',
1174
+ _response
1175
+ )
1176
+ elsif _response.status_code == 548
1177
+ raise APIException.new(
1178
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1179
+ ' requests are receiving this status code for an' \
1180
+ ' extended period of time.',
1181
+ _response
1182
+ )
1183
+ elsif _response.status_code == 549
1184
+ raise APIException.new(
1185
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1186
+ ' requests are receiving this status code for an' \
1187
+ ' extended period of time.',
1188
+ _response
1189
+ )
1190
+ elsif _response.status_code == 550
1191
+ raise APIException.new(
1192
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1193
+ ' requests are receiving this status code for an' \
1194
+ ' extended period of time.',
1195
+ _response
1196
+ )
1197
+ elsif _response.status_code == 551
1198
+ raise APIException.new(
1199
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1200
+ ' requests are receiving this status code for an' \
1201
+ ' extended period of time.',
1202
+ _response
1203
+ )
1204
+ elsif _response.status_code == 552
1205
+ raise APIException.new(
1206
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1207
+ ' requests are receiving this status code for an' \
1208
+ ' extended period of time.',
1209
+ _response
1210
+ )
1211
+ elsif _response.status_code == 553
1212
+ raise APIException.new(
1213
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1214
+ ' requests are receiving this status code for an' \
1215
+ ' extended period of time.',
1216
+ _response
1217
+ )
1218
+ elsif _response.status_code == 554
1219
+ raise APIException.new(
1220
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1221
+ ' requests are receiving this status code for an' \
1222
+ ' extended period of time.',
1223
+ _response
1224
+ )
1225
+ elsif _response.status_code == 555
1226
+ raise APIException.new(
1227
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1228
+ ' requests are receiving this status code for an' \
1229
+ ' extended period of time.',
1230
+ _response
1231
+ )
1232
+ elsif _response.status_code == 556
1233
+ raise APIException.new(
1234
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1235
+ ' requests are receiving this status code for an' \
1236
+ ' extended period of time.',
1237
+ _response
1238
+ )
1239
+ elsif _response.status_code == 557
1240
+ raise APIException.new(
1241
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1242
+ ' requests are receiving this status code for an' \
1243
+ ' extended period of time.',
1244
+ _response
1245
+ )
1246
+ elsif _response.status_code == 558
1247
+ raise APIException.new(
1248
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1249
+ ' requests are receiving this status code for an' \
1250
+ ' extended period of time.',
1251
+ _response
1252
+ )
1253
+ elsif _response.status_code == 559
1254
+ raise APIException.new(
1255
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1256
+ ' requests are receiving this status code for an' \
1257
+ ' extended period of time.',
1258
+ _response
1259
+ )
1260
+ elsif _response.status_code == 560
1261
+ raise APIException.new(
1262
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1263
+ ' requests are receiving this status code for an' \
1264
+ ' extended period of time.',
1265
+ _response
1266
+ )
1267
+ elsif _response.status_code == 561
1268
+ raise APIException.new(
1269
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1270
+ ' requests are receiving this status code for an' \
1271
+ ' extended period of time.',
1272
+ _response
1273
+ )
1274
+ elsif _response.status_code == 562
1275
+ raise APIException.new(
1276
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1277
+ ' requests are receiving this status code for an' \
1278
+ ' extended period of time.',
1279
+ _response
1280
+ )
1281
+ elsif _response.status_code == 563
1282
+ raise APIException.new(
1283
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1284
+ ' requests are receiving this status code for an' \
1285
+ ' extended period of time.',
1286
+ _response
1287
+ )
1288
+ elsif _response.status_code == 564
1289
+ raise APIException.new(
1290
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1291
+ ' requests are receiving this status code for an' \
1292
+ ' extended period of time.',
1293
+ _response
1294
+ )
1295
+ elsif _response.status_code == 565
1296
+ raise APIException.new(
1297
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1298
+ ' requests are receiving this status code for an' \
1299
+ ' extended period of time.',
1300
+ _response
1301
+ )
1302
+ elsif _response.status_code == 566
1303
+ raise APIException.new(
1304
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1305
+ ' requests are receiving this status code for an' \
1306
+ ' extended period of time.',
1307
+ _response
1308
+ )
1309
+ elsif _response.status_code == 567
1310
+ raise APIException.new(
1311
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1312
+ ' requests are receiving this status code for an' \
1313
+ ' extended period of time.',
1314
+ _response
1315
+ )
1316
+ elsif _response.status_code == 568
1317
+ raise APIException.new(
1318
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1319
+ ' requests are receiving this status code for an' \
1320
+ ' extended period of time.',
1321
+ _response
1322
+ )
1323
+ elsif _response.status_code == 569
1324
+ raise APIException.new(
1325
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1326
+ ' requests are receiving this status code for an' \
1327
+ ' extended period of time.',
1328
+ _response
1329
+ )
1330
+ elsif _response.status_code == 570
1331
+ raise APIException.new(
1332
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1333
+ ' requests are receiving this status code for an' \
1334
+ ' extended period of time.',
1335
+ _response
1336
+ )
1337
+ elsif _response.status_code == 571
1338
+ raise APIException.new(
1339
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1340
+ ' requests are receiving this status code for an' \
1341
+ ' extended period of time.',
1342
+ _response
1343
+ )
1344
+ elsif _response.status_code == 572
1345
+ raise APIException.new(
1346
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1347
+ ' requests are receiving this status code for an' \
1348
+ ' extended period of time.',
1349
+ _response
1350
+ )
1351
+ elsif _response.status_code == 573
1352
+ raise APIException.new(
1353
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1354
+ ' requests are receiving this status code for an' \
1355
+ ' extended period of time.',
1356
+ _response
1357
+ )
1358
+ elsif _response.status_code == 574
1359
+ raise APIException.new(
1360
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1361
+ ' requests are receiving this status code for an' \
1362
+ ' extended period of time.',
1363
+ _response
1364
+ )
1365
+ elsif _response.status_code == 575
1366
+ raise APIException.new(
1367
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1368
+ ' requests are receiving this status code for an' \
1369
+ ' extended period of time.',
1370
+ _response
1371
+ )
1372
+ elsif _response.status_code == 576
1373
+ raise APIException.new(
1374
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1375
+ ' requests are receiving this status code for an' \
1376
+ ' extended period of time.',
1377
+ _response
1378
+ )
1379
+ elsif _response.status_code == 577
1380
+ raise APIException.new(
1381
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1382
+ ' requests are receiving this status code for an' \
1383
+ ' extended period of time.',
1384
+ _response
1385
+ )
1386
+ elsif _response.status_code == 578
1387
+ raise APIException.new(
1388
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1389
+ ' requests are receiving this status code for an' \
1390
+ ' extended period of time.',
1391
+ _response
1392
+ )
1393
+ elsif _response.status_code == 579
1394
+ raise APIException.new(
1395
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1396
+ ' requests are receiving this status code for an' \
1397
+ ' extended period of time.',
1398
+ _response
1399
+ )
1400
+ elsif _response.status_code == 580
1401
+ raise APIException.new(
1402
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1403
+ ' requests are receiving this status code for an' \
1404
+ ' extended period of time.',
1405
+ _response
1406
+ )
1407
+ elsif _response.status_code == 581
1408
+ raise APIException.new(
1409
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1410
+ ' requests are receiving this status code for an' \
1411
+ ' extended period of time.',
1412
+ _response
1413
+ )
1414
+ elsif _response.status_code == 582
1415
+ raise APIException.new(
1416
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1417
+ ' requests are receiving this status code for an' \
1418
+ ' extended period of time.',
1419
+ _response
1420
+ )
1421
+ elsif _response.status_code == 583
1422
+ raise APIException.new(
1423
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1424
+ ' requests are receiving this status code for an' \
1425
+ ' extended period of time.',
1426
+ _response
1427
+ )
1428
+ elsif _response.status_code == 584
1429
+ raise APIException.new(
1430
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1431
+ ' requests are receiving this status code for an' \
1432
+ ' extended period of time.',
1433
+ _response
1434
+ )
1435
+ elsif _response.status_code == 585
1436
+ raise APIException.new(
1437
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1438
+ ' requests are receiving this status code for an' \
1439
+ ' extended period of time.',
1440
+ _response
1441
+ )
1442
+ elsif _response.status_code == 586
1443
+ raise APIException.new(
1444
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1445
+ ' requests are receiving this status code for an' \
1446
+ ' extended period of time.',
1447
+ _response
1448
+ )
1449
+ elsif _response.status_code == 587
1450
+ raise APIException.new(
1451
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1452
+ ' requests are receiving this status code for an' \
1453
+ ' extended period of time.',
1454
+ _response
1455
+ )
1456
+ elsif _response.status_code == 588
1457
+ raise APIException.new(
1458
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1459
+ ' requests are receiving this status code for an' \
1460
+ ' extended period of time.',
1461
+ _response
1462
+ )
1463
+ elsif _response.status_code == 589
1464
+ raise APIException.new(
1465
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1466
+ ' requests are receiving this status code for an' \
1467
+ ' extended period of time.',
1468
+ _response
1469
+ )
1470
+ elsif _response.status_code == 590
1471
+ raise APIException.new(
1472
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1473
+ ' requests are receiving this status code for an' \
1474
+ ' extended period of time.',
1475
+ _response
1476
+ )
1477
+ elsif _response.status_code == 591
1478
+ raise APIException.new(
1479
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1480
+ ' requests are receiving this status code for an' \
1481
+ ' extended period of time.',
1482
+ _response
1483
+ )
1484
+ elsif _response.status_code == 592
1485
+ raise APIException.new(
1486
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1487
+ ' requests are receiving this status code for an' \
1488
+ ' extended period of time.',
1489
+ _response
1490
+ )
1491
+ elsif _response.status_code == 593
1492
+ raise APIException.new(
1493
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1494
+ ' requests are receiving this status code for an' \
1495
+ ' extended period of time.',
1496
+ _response
1497
+ )
1498
+ elsif _response.status_code == 594
1499
+ raise APIException.new(
1500
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1501
+ ' requests are receiving this status code for an' \
1502
+ ' extended period of time.',
1503
+ _response
1504
+ )
1505
+ elsif _response.status_code == 595
1506
+ raise APIException.new(
1507
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1508
+ ' requests are receiving this status code for an' \
1509
+ ' extended period of time.',
1510
+ _response
1511
+ )
1512
+ elsif _response.status_code == 596
1513
+ raise APIException.new(
1514
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1515
+ ' requests are receiving this status code for an' \
1516
+ ' extended period of time.',
1517
+ _response
1518
+ )
1519
+ elsif _response.status_code == 597
1520
+ raise APIException.new(
1521
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1522
+ ' requests are receiving this status code for an' \
1523
+ ' extended period of time.',
1524
+ _response
1525
+ )
1526
+ elsif _response.status_code == 598
1527
+ raise APIException.new(
1528
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1529
+ ' requests are receiving this status code for an' \
1530
+ ' extended period of time.',
1531
+ _response
1532
+ )
1533
+ elsif _response.status_code == 599
1534
+ raise APIException.new(
1535
+ 'Unexpected error. Please contact Bandwidth Support if your' \
1536
+ ' requests are receiving this status code for an' \
1537
+ ' extended period of time.',
1538
+ _response
1539
+ )
1540
+ end
1541
+ validate_response(_response)
1542
+
1543
+ # Return appropriate response type.
1544
+ decoded = APIHelper.json_deserialize(_response.raw_body)
1545
+ ApiResponse.new(
1546
+ _response, data: OrderStatus.from_hash(decoded)
1547
+ )
1548
+ end
1549
+ end
1550
+ end
1551
+ end