bandwidth-sdk 2.1.1 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +85 -70
  3. data/lib/bandwidth.rb +3 -1
  4. data/lib/bandwidth/configuration.rb +4 -4
  5. data/lib/bandwidth/http/faraday_client.rb +2 -6
  6. data/lib/bandwidth/messaging_lib/messaging.rb +1 -3
  7. data/lib/bandwidth/messaging_lib/messaging/controllers/api_controller.rb +45 -88
  8. data/lib/bandwidth/messaging_lib/messaging/controllers/base_controller.rb +1 -1
  9. data/lib/bandwidth/messaging_lib/messaging/exceptions/{generic_client_exception.rb → messaging_exception.rb} +2 -14
  10. data/lib/bandwidth/utilities/file_wrapper.rb +17 -0
  11. data/lib/bandwidth/voice_lib/bxml/verbs/phone_number.rb +2 -0
  12. data/lib/bandwidth/voice_lib/bxml/verbs/record.rb +5 -1
  13. data/lib/bandwidth/voice_lib/bxml/verbs/send_dtmf.rb +4 -1
  14. data/lib/bandwidth/voice_lib/bxml/verbs/start_recording.rb +4 -1
  15. data/lib/bandwidth/voice_lib/voice.rb +11 -4
  16. data/lib/bandwidth/voice_lib/voice/controllers/api_controller.rb +540 -90
  17. data/lib/bandwidth/voice_lib/voice/controllers/base_controller.rb +1 -1
  18. data/lib/bandwidth/voice_lib/voice/exceptions/{error_response_exception.rb → api_error_response_exception.rb} +3 -3
  19. data/lib/bandwidth/voice_lib/voice/models/api_call_response.rb +11 -2
  20. data/lib/bandwidth/voice_lib/voice/models/api_call_state_response.rb +164 -0
  21. data/lib/bandwidth/voice_lib/voice/models/api_modify_call_request.rb +1 -1
  22. data/lib/bandwidth/voice_lib/voice/models/api_transcribe_recording_request.rb +71 -0
  23. data/lib/bandwidth/voice_lib/voice/models/callback_method_enum.rb +35 -0
  24. data/lib/bandwidth/voice_lib/voice/models/disconnect_cause_enum.rb +44 -0
  25. data/lib/bandwidth/voice_lib/voice/models/modify_call_recording_state.rb +1 -1
  26. data/lib/bandwidth/voice_lib/voice/models/recording_metadata_response.rb +35 -25
  27. data/lib/bandwidth/voice_lib/voice/models/state1_enum.rb +4 -7
  28. data/lib/bandwidth/voice_lib/voice/models/state2_enum.rb +20 -0
  29. data/lib/bandwidth/voice_lib/voice/models/state_enum.rb +7 -4
  30. data/lib/bandwidth/voice_lib/voice/models/status1_enum.rb +32 -0
  31. data/lib/bandwidth/voice_lib/voice/models/status_enum.rb +26 -0
  32. data/lib/bandwidth/{messaging_lib/messaging/models/field_error.rb → voice_lib/voice/models/transcript.rb} +15 -15
  33. data/lib/bandwidth/voice_lib/voice/models/transcription.rb +62 -0
  34. data/lib/bandwidth/voice_lib/voice/models/transcription_response.rb +42 -0
  35. metadata +31 -11
  36. data/lib/bandwidth/messaging_lib/messaging/exceptions/path_client_exception.rb +0 -49
  37. data/lib/bandwidth/voice_lib/voice/models/api_get_account_recordings_metadata_request.rb +0 -65
  38. data/lib/bandwidth/voice_lib/voice/models/transcription_status_enum.rb +0 -20
  39. data/lib/bandwidth/voice_lib/voice/models/type_enum.rb +0 -32
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d875d4483cba8ab212869295640686010de4dfe22fc576c9ab76fcea68d270b
4
- data.tar.gz: 0aeb54d8f7b3f17a723059d9e7fc823b1e717d749f4e76319f6f07690be1ac66
3
+ metadata.gz: 07e5fe50a991db2fb94f074067e8288020c363c5aef6640f9e56d7e5f2ddc0c6
4
+ data.tar.gz: 7d726b1e2b912c334bc376d1851f087fc609f1c0ab20ad478dfd9c297f35b59e
5
5
  SHA512:
6
- metadata.gz: 741d727da5bf655ae535c62a4a0eb8479a95ac6e5464550d5bbda26f504df0b1ccc51ff1e15e6f60881a22957a81406295a20eec3a8f98145a23f4a617364ccb
7
- data.tar.gz: 8ef95f432381be68a58135bd354d181790db79aebb8e04a822abbf7ecfcb1b4183c6157b73b6f46dd213e590be79bedc86794d80f6c8045eb0479cc9be2af083
6
+ metadata.gz: 525fd5027e01ea00e4912d5f8f02f5f89442a794558f79d3df37065c6bb3a8fd567e3bf3e11713771a166965a5e532abcbf15d8a99d6ace7120d868eb6877dbc
7
+ data.tar.gz: eccbe5576ad3f247f8e24b0e7708f1caf04339e0ed6741e649bb9e1344f85f662b76016af062735a8965375f4786ea55c1a0120b246e0d3edf9e32c48e6ba510
data/README.md CHANGED
@@ -1,70 +1,85 @@
1
- # Getting Started with bandwidth
2
-
3
- Bandwidth's set of APIs
4
-
5
- ## Install the Package
6
-
7
- Install the gem from the command line:
8
-
9
- ```ruby
10
- gem install bandwidth-sdk -v 2.1.1
11
- ```
12
-
13
- Or add the gem to your Gemfile and run `bundle`:
14
-
15
- ```ruby
16
- gem 'bandwidth-sdk', '2.1.1'
17
- ```
18
-
19
- For additional gem details, see the [RubyGems page for the bandwidth-sdk gem](https://rubygems.org/gems/bandwidth-sdk/versions/2.1.1).
20
-
21
- ## Initialize the API Client
22
-
23
- The following parameters are configurable for the API Client.
24
-
25
- | Parameter | Type | Description |
26
- | --- | --- | --- |
27
- | `messaging_basic_auth_user_name` | `String` | The username to use with basic authentication |
28
- | `messaging_basic_auth_password` | `String` | The password to use with basic authentication |
29
- | `voice_basic_auth_user_name` | `String` | The username to use with basic authentication |
30
- | `voice_basic_auth_password` | `String` | The password to use with basic authentication |
31
- | `environment` | Environment | The API environment. <br> **Default: `Environment.PRODUCTION`** |
32
- | `timeout` | `Float` | The value to use for connection timeout. <br> **Default: 60** |
33
- | `max_retries` | `Integer` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
34
- | `retry_interval` | `Float` | Pause in seconds between retries. <br> **Default: 1** |
35
- | `backoff_factor` | `Float` | The amount to multiply each successive retry's interval amount by in order to provide backoff. <br> **Default: 1** |
36
-
37
- The API client can be initialized as following.
38
-
39
- ```ruby
40
- client = Bandwidth::Client.new(
41
- messaging_basic_auth_user_name: 'MessagingBasicAuthUserName',
42
- messaging_basic_auth_password: 'MessagingBasicAuthPassword',
43
- voice_basic_auth_user_name: 'VoiceBasicAuthUserName',
44
- voice_basic_auth_password: 'VoiceBasicAuthPassword',
45
- environment: Environment::PRODUCTION,
46
- )
47
- ```
48
-
49
- API calls return an `ApiResponse` object that includes the following fields:
50
-
51
- | Field | Description |
52
- | --- | --- |
53
- | `status_code` | Status code of the HTTP response |
54
- | `reason_phrase` | Reason phrase of the HTTP response |
55
- | `headers` | Headers of the HTTP response as a Hash |
56
- | `raw_body` | The body of the HTTP response as a String |
57
- | `request` | HTTP request info |
58
- | `errors` | Errors, if they exist |
59
- | `data` | The deserialized body of the HTTP response |
60
-
61
- ## Authorization
62
-
63
- This API does not require authentication.
64
-
65
- ## API Reference
66
-
67
- ### List of APIs
68
-
69
- *
70
-
1
+ # Bandwidth Ruby SDK
2
+
3
+ Bandwidth's API docs can be found at https://dev.bandwidth.com
4
+
5
+ Ruby specific docs can be found at https://dev.bandwidth.com/sdks/ruby.html
6
+
7
+ ## Download & Install
8
+
9
+ ```
10
+ gem install bandwidth-sdk
11
+ ```
12
+
13
+ ## Initialize Bandwidth Client
14
+
15
+ ```ruby
16
+ require 'bandwidth'
17
+
18
+ include Bandwidth
19
+ include Bandwidth::Voice
20
+ include Bandwidth::Messaging
21
+
22
+ bandwidth_client = Bandwidth::Client.new(
23
+ voice_basic_auth_user_name: 'username',
24
+ voice_basic_auth_password: 'password',
25
+ messaging_basic_auth_user_name: 'token',
26
+ messaging_basic_auth_password: 'secret',
27
+ )
28
+ ```
29
+
30
+ ## Create Phone Call
31
+
32
+ ```ruby
33
+ voice_client = bandwidth_client.voice_client.client
34
+
35
+ account_id = '1'
36
+ body = ApiCreateCallRequest.new
37
+ body.from = '+16666666666'
38
+ body.to = '+17777777777'
39
+ body.answer_url = 'https://test.com'
40
+ body.application_id = '3-d-4-b-5'
41
+
42
+ begin
43
+ response = voice_client.create_call(account_id,:body => body)
44
+ puts response.data.call_id #c-d45a41e5-bcb12581-b18e-4bdc-9874-6r3235dfweao
45
+ puts response.status_code #201
46
+ rescue Bandwidth::ErrorResponseException => e
47
+ puts e.description #Invalid to: must be an E164 telephone number
48
+ puts e.response_code #400
49
+ end
50
+ ```
51
+
52
+ ## Generate BXML
53
+
54
+ ```ruby
55
+ response = Bandwidth::Voice::Response.new()
56
+ hangup = Bandwidth::Voice::Hangup.new()
57
+
58
+ response.push(hangup)
59
+ puts response.to_bxml()
60
+ ```
61
+
62
+ ## Send Text Message
63
+
64
+ ```ruby
65
+ messaging_client = bandwidth_client.messaging_client.client
66
+
67
+ account_id = '1'
68
+ body = MessageRequest.new
69
+ body.application_id = '1-2-3'
70
+ body.to = ['+17777777777']
71
+ body.from = '+18888888888'
72
+ body.text = 'Hello from Bandwidth'
73
+
74
+ begin
75
+ response = messaging_client.create_message(account_id, :body => body)
76
+ puts response.data.id #1570740275373xbn7mbhsfewasdr
77
+ puts response.status_code #202
78
+ rescue Bandwidth::GenericClientException => e
79
+ puts e.description #Access is denied
80
+ puts e.response_code #403
81
+ rescue Bandwidth::PathClientException => e
82
+ puts e.message #Your request could not be accepted.
83
+ puts e.response_code #400
84
+ end
85
+ ```
data/lib/bandwidth.rb CHANGED
@@ -12,6 +12,9 @@ require 'logging'
12
12
  require_relative 'bandwidth/api_helper.rb'
13
13
  require_relative 'bandwidth/client.rb'
14
14
 
15
+ # Utilities
16
+ require_relative 'bandwidth/utilities/file_wrapper.rb'
17
+
15
18
  # Http
16
19
  require_relative 'bandwidth/http/api_response.rb'
17
20
  require_relative 'bandwidth/http/http_call_back.rb'
@@ -35,5 +38,4 @@ require_relative 'bandwidth/http/auth/messaging_basic_auth.rb'
35
38
  require_relative 'bandwidth/voice_lib/voice'
36
39
  require_relative 'bandwidth/http/auth/voice_basic_auth.rb'
37
40
 
38
-
39
41
  # Controllers
@@ -59,7 +59,7 @@ module Bandwidth
59
59
  @backoff_factor = backoff_factor
60
60
 
61
61
  # Current API environment
62
- @environment = environment
62
+ @environment = String(environment)
63
63
 
64
64
  # The username to use with basic authentication
65
65
  @messaging_basic_auth_user_name = messaging_basic_auth_user_name
@@ -111,20 +111,20 @@ module Bandwidth
111
111
  end
112
112
 
113
113
  # All the environments the SDK can run in.
114
- @environments = {
114
+ ENVIRONMENTS = {
115
115
  Environment::PRODUCTION => {
116
116
  Server::DEFAULT => 'api.bandwidth.com',
117
117
  Server::MESSAGINGDEFAULT => 'https://messaging.bandwidth.com/api/v2',
118
118
  Server::VOICEDEFAULT => 'https://voice.bandwidth.com'
119
119
  }
120
- }
120
+ }.freeze
121
121
 
122
122
  # Generates the appropriate base URI for the environment and the server.
123
123
  # @param [Configuration::Server] The server enum for which the base URI is
124
124
  # required.
125
125
  # @return [String] The base URI.
126
126
  def get_base_uri(server = Server::DEFAULT)
127
- self.class.environments[environment][server].clone
127
+ ENVIRONMENTS[environment][server].clone
128
128
  end
129
129
  end
130
130
  end
@@ -34,9 +34,7 @@ module Bandwidth
34
34
  http_request.query_url
35
35
  ) do |request|
36
36
  request.headers = http_request.headers
37
- unless http_request.parameters.empty?
38
- request.body = http_request.parameters
39
- end
37
+ request.body = http_request.parameters
40
38
  end
41
39
  convert_response(response, http_request)
42
40
  end
@@ -48,9 +46,7 @@ module Bandwidth
48
46
  http_request.query_url
49
47
  ) do |request|
50
48
  request.headers = http_request.headers
51
- unless http_request.parameters.empty?
52
- request.body = http_request.parameters
53
- end
49
+ request.body = http_request.parameters
54
50
  end
55
51
  convert_response(response, http_request)
56
52
  end
@@ -7,7 +7,6 @@
7
7
  require_relative 'messaging/client.rb'
8
8
 
9
9
  # Models
10
- require_relative 'messaging/models/field_error.rb'
11
10
  require_relative 'messaging/models/media.rb'
12
11
  require_relative 'messaging/models/tag.rb'
13
12
  require_relative 'messaging/models/deferred_result.rb'
@@ -16,8 +15,7 @@ require_relative 'messaging/models/bandwidth_message.rb'
16
15
  require_relative 'messaging/models/message_request.rb'
17
16
 
18
17
  # Exceptions
19
- require_relative 'messaging/exceptions/generic_client_exception.rb'
20
- require_relative 'messaging/exceptions/path_client_exception.rb'
18
+ require_relative 'messaging/exceptions/messaging_exception.rb'
21
19
  # Controllers
22
20
  require_relative 'messaging/controllers/base_controller.rb'
23
21
  require_relative 'messaging/controllers/api_controller.rb'
@@ -11,59 +11,6 @@ module Messaging
11
11
  super(config, http_call_back: http_call_back)
12
12
  end
13
13
 
14
- # getMessage
15
- # @return [void] response from the API call
16
- def get_message
17
- # Prepare query url.
18
- _query_builder = config.get_base_uri(Server::MESSAGINGDEFAULT)
19
- _query_builder << '/ping'
20
- _query_url = APIHelper.clean_url _query_builder
21
-
22
- # Prepare and execute HttpRequest.
23
- _request = config.http_client.get(
24
- _query_url
25
- )
26
- MessagingBasicAuth.apply(config, _request)
27
- _response = execute_request(_request)
28
-
29
- # Validate response against endpoint and global error codes.
30
- if _response.status_code == 400
31
- raise GenericClientException.new(
32
- '400 Request is malformed or invalid',
33
- _response
34
- )
35
- elsif _response.status_code == 401
36
- raise PathClientException.new(
37
- '401 The specified user does not have access to the account',
38
- _response
39
- )
40
- elsif _response.status_code == 403
41
- raise PathClientException.new(
42
- '403 The user does not have access to this API',
43
- _response
44
- )
45
- elsif _response.status_code == 404
46
- raise PathClientException.new(
47
- '404 Path not found',
48
- _response
49
- )
50
- elsif _response.status_code == 415
51
- raise GenericClientException.new(
52
- '415 The content-type of the request is incorrect',
53
- _response
54
- )
55
- elsif _response.status_code == 429
56
- raise GenericClientException.new(
57
- '429 The rate limit has been reached',
58
- _response
59
- )
60
- end
61
- validate_response(_response)
62
-
63
- # Return appropriate response type.
64
- ApiResponse.new(_response)
65
- end
66
-
67
14
  # listMedia
68
15
  # @param [String] user_id Required parameter: Example:
69
16
  # @param [String] continuation_token Optional parameter: Example:
@@ -95,32 +42,32 @@ module Messaging
95
42
 
96
43
  # Validate response against endpoint and global error codes.
97
44
  if _response.status_code == 400
98
- raise GenericClientException.new(
45
+ raise MessagingException.new(
99
46
  '400 Request is malformed or invalid',
100
47
  _response
101
48
  )
102
49
  elsif _response.status_code == 401
103
- raise PathClientException.new(
50
+ raise MessagingException.new(
104
51
  '401 The specified user does not have access to the account',
105
52
  _response
106
53
  )
107
54
  elsif _response.status_code == 403
108
- raise PathClientException.new(
55
+ raise MessagingException.new(
109
56
  '403 The user does not have access to this API',
110
57
  _response
111
58
  )
112
59
  elsif _response.status_code == 404
113
- raise PathClientException.new(
60
+ raise MessagingException.new(
114
61
  '404 Path not found',
115
62
  _response
116
63
  )
117
64
  elsif _response.status_code == 415
118
- raise GenericClientException.new(
65
+ raise MessagingException.new(
119
66
  '415 The content-type of the request is incorrect',
120
67
  _response
121
68
  )
122
69
  elsif _response.status_code == 429
123
- raise GenericClientException.new(
70
+ raise MessagingException.new(
124
71
  '429 The rate limit has been reached',
125
72
  _response
126
73
  )
@@ -158,32 +105,32 @@ module Messaging
158
105
 
159
106
  # Validate response against endpoint and global error codes.
160
107
  if _response.status_code == 400
161
- raise GenericClientException.new(
108
+ raise MessagingException.new(
162
109
  '400 Request is malformed or invalid',
163
110
  _response
164
111
  )
165
112
  elsif _response.status_code == 401
166
- raise PathClientException.new(
113
+ raise MessagingException.new(
167
114
  '401 The specified user does not have access to the account',
168
115
  _response
169
116
  )
170
117
  elsif _response.status_code == 403
171
- raise PathClientException.new(
118
+ raise MessagingException.new(
172
119
  '403 The user does not have access to this API',
173
120
  _response
174
121
  )
175
122
  elsif _response.status_code == 404
176
- raise PathClientException.new(
123
+ raise MessagingException.new(
177
124
  '404 Path not found',
178
125
  _response
179
126
  )
180
127
  elsif _response.status_code == 415
181
- raise GenericClientException.new(
128
+ raise MessagingException.new(
182
129
  '415 The content-type of the request is incorrect',
183
130
  _response
184
131
  )
185
132
  elsif _response.status_code == 429
186
- raise GenericClientException.new(
133
+ raise MessagingException.new(
187
134
  '429 The rate limit has been reached',
188
135
  _response
189
136
  )
@@ -198,15 +145,16 @@ module Messaging
198
145
  # @param [String] user_id Required parameter: Example:
199
146
  # @param [String] media_id Required parameter: Example:
200
147
  # @param [Long] content_length Required parameter: Example:
201
- # @param [String] body Required parameter: Example:
202
- # @param [String] content_type Optional parameter: Example:
148
+ # @param [File | UploadIO] body Required parameter: Example:
149
+ # @param [String] content_type Optional parameter:
150
+ # Example:application/octet-stream
203
151
  # @param [String] cache_control Optional parameter: Example:
204
152
  # @return [void] response from the API call
205
153
  def upload_media(user_id,
206
154
  media_id,
207
155
  content_length,
208
156
  body,
209
- content_type: nil,
157
+ content_type: 'application/octet-stream',
210
158
  cache_control: nil)
211
159
  # Prepare query url.
212
160
  _query_builder = config.get_base_uri(Server::MESSAGINGDEFAULT)
@@ -218,10 +166,19 @@ module Messaging
218
166
  )
219
167
  _query_url = APIHelper.clean_url _query_builder
220
168
 
169
+ if body.is_a? FileWrapper
170
+ body_wrapper = body.file
171
+ body_content_type = body.content_type
172
+ else
173
+ body_wrapper = body
174
+ body_content_type = content_type
175
+ end
176
+
221
177
  # Prepare headers.
222
178
  _headers = {
179
+ 'content-type' => body_content_type,
180
+ 'content-length' => body_wrapper.size.to_s,
223
181
  'Content-Length' => content_length,
224
- 'Content-Type' => content_type,
225
182
  'Cache-Control' => cache_control
226
183
  }
227
184
 
@@ -229,39 +186,39 @@ module Messaging
229
186
  _request = config.http_client.put(
230
187
  _query_url,
231
188
  headers: _headers,
232
- parameters: body
189
+ parameters: body_wrapper
233
190
  )
234
191
  MessagingBasicAuth.apply(config, _request)
235
192
  _response = execute_request(_request)
236
193
 
237
194
  # Validate response against endpoint and global error codes.
238
195
  if _response.status_code == 400
239
- raise GenericClientException.new(
196
+ raise MessagingException.new(
240
197
  '400 Request is malformed or invalid',
241
198
  _response
242
199
  )
243
200
  elsif _response.status_code == 401
244
- raise PathClientException.new(
201
+ raise MessagingException.new(
245
202
  '401 The specified user does not have access to the account',
246
203
  _response
247
204
  )
248
205
  elsif _response.status_code == 403
249
- raise PathClientException.new(
206
+ raise MessagingException.new(
250
207
  '403 The user does not have access to this API',
251
208
  _response
252
209
  )
253
210
  elsif _response.status_code == 404
254
- raise PathClientException.new(
211
+ raise MessagingException.new(
255
212
  '404 Path not found',
256
213
  _response
257
214
  )
258
215
  elsif _response.status_code == 415
259
- raise GenericClientException.new(
216
+ raise MessagingException.new(
260
217
  '415 The content-type of the request is incorrect',
261
218
  _response
262
219
  )
263
220
  elsif _response.status_code == 429
264
- raise GenericClientException.new(
221
+ raise MessagingException.new(
265
222
  '429 The rate limit has been reached',
266
223
  _response
267
224
  )
@@ -297,32 +254,32 @@ module Messaging
297
254
 
298
255
  # Validate response against endpoint and global error codes.
299
256
  if _response.status_code == 400
300
- raise GenericClientException.new(
257
+ raise MessagingException.new(
301
258
  '400 Request is malformed or invalid',
302
259
  _response
303
260
  )
304
261
  elsif _response.status_code == 401
305
- raise PathClientException.new(
262
+ raise MessagingException.new(
306
263
  '401 The specified user does not have access to the account',
307
264
  _response
308
265
  )
309
266
  elsif _response.status_code == 403
310
- raise PathClientException.new(
267
+ raise MessagingException.new(
311
268
  '403 The user does not have access to this API',
312
269
  _response
313
270
  )
314
271
  elsif _response.status_code == 404
315
- raise PathClientException.new(
272
+ raise MessagingException.new(
316
273
  '404 Path not found',
317
274
  _response
318
275
  )
319
276
  elsif _response.status_code == 415
320
- raise GenericClientException.new(
277
+ raise MessagingException.new(
321
278
  '415 The content-type of the request is incorrect',
322
279
  _response
323
280
  )
324
281
  elsif _response.status_code == 429
325
- raise GenericClientException.new(
282
+ raise MessagingException.new(
326
283
  '429 The rate limit has been reached',
327
284
  _response
328
285
  )
@@ -365,32 +322,32 @@ module Messaging
365
322
 
366
323
  # Validate response against endpoint and global error codes.
367
324
  if _response.status_code == 400
368
- raise GenericClientException.new(
325
+ raise MessagingException.new(
369
326
  '400 Request is malformed or invalid',
370
327
  _response
371
328
  )
372
329
  elsif _response.status_code == 401
373
- raise PathClientException.new(
330
+ raise MessagingException.new(
374
331
  '401 The specified user does not have access to the account',
375
332
  _response
376
333
  )
377
334
  elsif _response.status_code == 403
378
- raise PathClientException.new(
335
+ raise MessagingException.new(
379
336
  '403 The user does not have access to this API',
380
337
  _response
381
338
  )
382
339
  elsif _response.status_code == 404
383
- raise PathClientException.new(
340
+ raise MessagingException.new(
384
341
  '404 Path not found',
385
342
  _response
386
343
  )
387
344
  elsif _response.status_code == 415
388
- raise GenericClientException.new(
345
+ raise MessagingException.new(
389
346
  '415 The content-type of the request is incorrect',
390
347
  _response
391
348
  )
392
349
  elsif _response.status_code == 429
393
- raise GenericClientException.new(
350
+ raise MessagingException.new(
394
351
  '429 The rate limit has been reached',
395
352
  _response
396
353
  )