bandwidth-sdk 2.2.2 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6a0d3a06b7e019a1602f4a796f096c7ac408e66395b10ff9088f26393c028acf
4
- data.tar.gz: 67d9cfdf43befba134e4dabc3abddc1317821db91d0ac18c9d2a92456da270d8
3
+ metadata.gz: 80138bdbd6672138cc92a5377acd770c7dcf06a327187c498111f207d27cb15c
4
+ data.tar.gz: db58f2a2dd4195dfcf9cd5d85209021157eb5d49df8c01d48028814839839959
5
5
  SHA512:
6
- metadata.gz: 94fef92c336e12b4c6bcfc29b51048fbd5f00493ce1868c4baaf539f58f89b5024bc65bc8426aac36eae1c0c04930234e4ed57878bd7d049a719a6b8c96f05e9
7
- data.tar.gz: 5d058ccd30dc7b4efa01397d346247a75d81101da1e981d011f00ec437c1e7d12e97651462111861880135e7c56e776a369a11fd7c6b90712038645dbf19f5b3
6
+ metadata.gz: c61848b0e1bbe13e31b813e87dd64e37588789b868785ae4f28ee9996abed6ea15d228290b1eb8e68099e0b9b02e1c75a60c06faf8f419ab4df3a527e6a4a6bb
7
+ data.tar.gz: 77a0d973247f2fc116eb15e637a05d48931a3b433c2362e35f7747787bd0522797710237fd65a7d4b15261fd449ebd2604bea4244af2d767d44badb433903456
@@ -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
  )
@@ -246,32 +193,32 @@ module Messaging
246
193
 
247
194
  # Validate response against endpoint and global error codes.
248
195
  if _response.status_code == 400
249
- raise GenericClientException.new(
196
+ raise MessagingException.new(
250
197
  '400 Request is malformed or invalid',
251
198
  _response
252
199
  )
253
200
  elsif _response.status_code == 401
254
- raise PathClientException.new(
201
+ raise MessagingException.new(
255
202
  '401 The specified user does not have access to the account',
256
203
  _response
257
204
  )
258
205
  elsif _response.status_code == 403
259
- raise PathClientException.new(
206
+ raise MessagingException.new(
260
207
  '403 The user does not have access to this API',
261
208
  _response
262
209
  )
263
210
  elsif _response.status_code == 404
264
- raise PathClientException.new(
211
+ raise MessagingException.new(
265
212
  '404 Path not found',
266
213
  _response
267
214
  )
268
215
  elsif _response.status_code == 415
269
- raise GenericClientException.new(
216
+ raise MessagingException.new(
270
217
  '415 The content-type of the request is incorrect',
271
218
  _response
272
219
  )
273
220
  elsif _response.status_code == 429
274
- raise GenericClientException.new(
221
+ raise MessagingException.new(
275
222
  '429 The rate limit has been reached',
276
223
  _response
277
224
  )
@@ -307,32 +254,32 @@ module Messaging
307
254
 
308
255
  # Validate response against endpoint and global error codes.
309
256
  if _response.status_code == 400
310
- raise GenericClientException.new(
257
+ raise MessagingException.new(
311
258
  '400 Request is malformed or invalid',
312
259
  _response
313
260
  )
314
261
  elsif _response.status_code == 401
315
- raise PathClientException.new(
262
+ raise MessagingException.new(
316
263
  '401 The specified user does not have access to the account',
317
264
  _response
318
265
  )
319
266
  elsif _response.status_code == 403
320
- raise PathClientException.new(
267
+ raise MessagingException.new(
321
268
  '403 The user does not have access to this API',
322
269
  _response
323
270
  )
324
271
  elsif _response.status_code == 404
325
- raise PathClientException.new(
272
+ raise MessagingException.new(
326
273
  '404 Path not found',
327
274
  _response
328
275
  )
329
276
  elsif _response.status_code == 415
330
- raise GenericClientException.new(
277
+ raise MessagingException.new(
331
278
  '415 The content-type of the request is incorrect',
332
279
  _response
333
280
  )
334
281
  elsif _response.status_code == 429
335
- raise GenericClientException.new(
282
+ raise MessagingException.new(
336
283
  '429 The rate limit has been reached',
337
284
  _response
338
285
  )
@@ -375,32 +322,32 @@ module Messaging
375
322
 
376
323
  # Validate response against endpoint and global error codes.
377
324
  if _response.status_code == 400
378
- raise GenericClientException.new(
325
+ raise MessagingException.new(
379
326
  '400 Request is malformed or invalid',
380
327
  _response
381
328
  )
382
329
  elsif _response.status_code == 401
383
- raise PathClientException.new(
330
+ raise MessagingException.new(
384
331
  '401 The specified user does not have access to the account',
385
332
  _response
386
333
  )
387
334
  elsif _response.status_code == 403
388
- raise PathClientException.new(
335
+ raise MessagingException.new(
389
336
  '403 The user does not have access to this API',
390
337
  _response
391
338
  )
392
339
  elsif _response.status_code == 404
393
- raise PathClientException.new(
340
+ raise MessagingException.new(
394
341
  '404 Path not found',
395
342
  _response
396
343
  )
397
344
  elsif _response.status_code == 415
398
- raise GenericClientException.new(
345
+ raise MessagingException.new(
399
346
  '415 The content-type of the request is incorrect',
400
347
  _response
401
348
  )
402
349
  elsif _response.status_code == 429
403
- raise GenericClientException.new(
350
+ raise MessagingException.new(
404
351
  '429 The rate limit has been reached',
405
352
  _response
406
353
  )
@@ -13,7 +13,7 @@ module Bandwidth
13
13
  @http_call_back = http_call_back
14
14
 
15
15
  @global_headers = {
16
- 'user-agent' => 'APIMATIC 2.0'
16
+ 'user-agent' => 'ruby-sdk-refs/tags/ruby3.0.0'
17
17
  }
18
18
  end
19
19
 
@@ -4,8 +4,8 @@
4
4
  # ( https://apimatic.io ).
5
5
 
6
6
  module Bandwidth
7
- # GenericClientException class.
8
- class GenericClientException < APIException
7
+ # MessagingException class.
8
+ class MessagingException < APIException
9
9
  # TODO: Write general description for this method
10
10
  # @return [String]
11
11
  attr_accessor :type
@@ -14,10 +14,6 @@ module Bandwidth
14
14
  # @return [String]
15
15
  attr_accessor :description
16
16
 
17
- # TODO: Write general description for this method
18
- # @return [List of FieldError]
19
- attr_accessor :field_errors
20
-
21
17
  # The constructor.
22
18
  # @param [String] The reason for raising an exception.
23
19
  # @param [HttpResponse] The HttpReponse of the API call.
@@ -33,14 +29,6 @@ module Bandwidth
33
29
  def unbox(hash)
34
30
  @type = hash['type']
35
31
  @description = hash['description']
36
- # Parameter is an array, so we need to iterate through it
37
- @field_errors = nil
38
- unless hash['fieldErrors'].nil?
39
- @field_errors = []
40
- hash['fieldErrors'].each do |structure|
41
- @field_errors << (FieldError.from_hash(structure) if structure)
42
- end
43
- end
44
32
  end
45
33
  end
46
34
  end
@@ -13,7 +13,7 @@ module Bandwidth
13
13
  @http_call_back = http_call_back
14
14
 
15
15
  @global_headers = {
16
- 'user-agent' => 'APIMATIC 2.0'
16
+ 'user-agent' => 'ruby-sdk-refs/tags/ruby3.0.0'
17
17
  }
18
18
  end
19
19
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bandwidth-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - APIMatic SDK Generator
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-16 00:00:00.000000000 Z
11
+ date: 2020-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logging
@@ -120,12 +120,10 @@ files:
120
120
  - lib/bandwidth/messaging_lib/messaging/client.rb
121
121
  - lib/bandwidth/messaging_lib/messaging/controllers/api_controller.rb
122
122
  - lib/bandwidth/messaging_lib/messaging/controllers/base_controller.rb
123
- - lib/bandwidth/messaging_lib/messaging/exceptions/generic_client_exception.rb
124
- - lib/bandwidth/messaging_lib/messaging/exceptions/path_client_exception.rb
123
+ - lib/bandwidth/messaging_lib/messaging/exceptions/messaging_exception.rb
125
124
  - lib/bandwidth/messaging_lib/messaging/models/bandwidth_callback_message.rb
126
125
  - lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb
127
126
  - lib/bandwidth/messaging_lib/messaging/models/deferred_result.rb
128
- - lib/bandwidth/messaging_lib/messaging/models/field_error.rb
129
127
  - lib/bandwidth/messaging_lib/messaging/models/media.rb
130
128
  - lib/bandwidth/messaging_lib/messaging/models/message_request.rb
131
129
  - lib/bandwidth/messaging_lib/messaging/models/tag.rb
@@ -1,49 +0,0 @@
1
- # bandwidth
2
- #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
5
-
6
- module Bandwidth
7
- # PathClientException class.
8
- class PathClientException < APIException
9
- # TODO: Write general description for this method
10
- # @return [String]
11
- attr_accessor :timestamp
12
-
13
- # TODO: Write general description for this method
14
- # @return [Integer]
15
- attr_accessor :status
16
-
17
- # TODO: Write general description for this method
18
- # @return [String]
19
- attr_accessor :error
20
-
21
- # TODO: Write general description for this method
22
- # @return [String]
23
- attr_accessor :message
24
-
25
- # TODO: Write general description for this method
26
- # @return [String]
27
- attr_accessor :path
28
-
29
- # The constructor.
30
- # @param [String] The reason for raising an exception.
31
- # @param [HttpResponse] The HttpReponse of the API call.
32
- def initialize(reason, response)
33
- super(reason, response)
34
- hash = APIHelper.json_deserialize(@response.raw_body)
35
- unbox(hash)
36
- end
37
-
38
- # Populates this object by extracting properties from a hash.
39
- # @param [Hash] The deserialized response sent by the server in the
40
- # response body.
41
- def unbox(hash)
42
- @timestamp = hash['timestamp']
43
- @status = hash['status']
44
- @error = hash['error']
45
- @message = hash['message']
46
- @path = hash['path']
47
- end
48
- end
49
- end
@@ -1,44 +0,0 @@
1
- # bandwidth
2
- #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
5
-
6
- module Bandwidth
7
- # FieldError Model.
8
- class FieldError < BaseModel
9
- # TODO: Write general description for this method
10
- # @return [String]
11
- attr_accessor :field_name
12
-
13
- # TODO: Write general description for this method
14
- # @return [String]
15
- attr_accessor :description
16
-
17
- # A mapping from model property names to API property names.
18
- def self.names
19
- @_hash = {} if @_hash.nil?
20
- @_hash['field_name'] = 'fieldName'
21
- @_hash['description'] = 'description'
22
- @_hash
23
- end
24
-
25
- def initialize(field_name = nil,
26
- description = nil)
27
- @field_name = field_name
28
- @description = description
29
- end
30
-
31
- # Creates an instance of the object from a hash.
32
- def self.from_hash(hash)
33
- return nil unless hash
34
-
35
- # Extract variables from the hash.
36
- field_name = hash['fieldName']
37
- description = hash['description']
38
-
39
- # Create object from extracted values.
40
- FieldError.new(field_name,
41
- description)
42
- end
43
- end
44
- end