bandwidth-sdk 5.0.0 → 6.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: bc4d4b047d53e1e8c3f34b37696455d916a753aa3566dad6d6fb666fc2b3fa61
4
- data.tar.gz: b5cdf37c09788e890f36ef3c78ccf41f0ba18a69291f1424be7f798f207881f9
3
+ metadata.gz: e18aadfe51bc80e15e60e4bc4d67b175f10a6c5675c25eadccd4f8a878253dbb
4
+ data.tar.gz: 10f37b0a59cb13126b410b549372a54ab7aac33ae3bd236ecb058692a981bbe4
5
5
  SHA512:
6
- metadata.gz: 59761140cdddf9f6cda37d7aeeaeff6341a5c0bcc357cf577ae29e8fff0a6cf347f1070536f99db3b2f3f6baae3c2b93edbefb2e94468036c57ffd7a65c279b0
7
- data.tar.gz: bdf68653a8640403d2bc5402c9f5af06055079640ab9229b16ac12cf48290ccffbe2ac38e40c11c3e6b518b1ebaad05344779249d0f79c940d32c3a57b36f5ed
6
+ metadata.gz: 52c78cc210f261df7338ef3fea73c6a1ac7e1b15ed247fc7631db68ea9caaf7b9b09465e9694dfd4de83fd5d4ed53d9a57d421a0dfc66da71109911024d01490
7
+ data.tar.gz: 06404ecbc6c77c435ccb96b56369916120d25d7124ef57850231f59f92ee16d8b7520042d838614a126bca4fec1829f21d5d05d57f9fe28066126060a911b71f
@@ -156,7 +156,7 @@ module Bandwidth
156
156
  Environment::PRODUCTION => {
157
157
  Server::DEFAULT => 'api.bandwidth.com',
158
158
  Server::MESSAGINGDEFAULT => 'https://messaging.bandwidth.com/api/v2',
159
- Server::TWOFACTORAUTHDEFAULT => 'https://mfa.bandwidth.com/api/v1/',
159
+ Server::TWOFACTORAUTHDEFAULT => 'https://mfa.bandwidth.com/api/v1',
160
160
  Server::VOICEDEFAULT => 'https://voice.bandwidth.com',
161
161
  Server::WEBRTCDEFAULT => 'https://api.webrtc.bandwidth.com/v1'
162
162
  },
@@ -16,6 +16,7 @@ require_relative 'messaging/models/deferred_result.rb'
16
16
  require_relative 'messaging/models/bandwidth_callback_message.rb'
17
17
  require_relative 'messaging/models/bandwidth_message.rb'
18
18
  require_relative 'messaging/models/message_request.rb'
19
+ require_relative 'messaging/models/priority_enum.rb'
19
20
 
20
21
  # Exceptions
21
22
  require_relative 'messaging/exceptions/messaging_exception.rb'
@@ -51,6 +51,10 @@ module Bandwidth
51
51
  # @return [String]
52
52
  attr_accessor :tag
53
53
 
54
+ # The priority specified by the user
55
+ # @return [String]
56
+ attr_accessor :priority
57
+
54
58
  # A mapping from model property names to API property names.
55
59
  def self.names
56
60
  @_hash = {} if @_hash.nil?
@@ -65,6 +69,7 @@ module Bandwidth
65
69
  @_hash['media'] = 'media'
66
70
  @_hash['text'] = 'text'
67
71
  @_hash['tag'] = 'tag'
72
+ @_hash['priority'] = 'priority'
68
73
  @_hash
69
74
  end
70
75
 
@@ -78,7 +83,8 @@ module Bandwidth
78
83
  from = nil,
79
84
  media = nil,
80
85
  text = nil,
81
- tag = nil)
86
+ tag = nil,
87
+ priority = nil)
82
88
  @id = id
83
89
  @owner = owner
84
90
  @application_id = application_id
@@ -90,6 +96,7 @@ module Bandwidth
90
96
  @media = media
91
97
  @text = text
92
98
  @tag = tag
99
+ @priority = priority
93
100
  end
94
101
 
95
102
  # Creates an instance of the object from a hash.
@@ -108,6 +115,7 @@ module Bandwidth
108
115
  media = hash['media']
109
116
  text = hash['text']
110
117
  tag = hash['tag']
118
+ priority = hash['priority']
111
119
 
112
120
  # Create object from extracted values.
113
121
  BandwidthMessage.new(id,
@@ -120,7 +128,8 @@ module Bandwidth
120
128
  from,
121
129
  media,
122
130
  text,
123
- tag)
131
+ tag,
132
+ priority)
124
133
  end
125
134
  end
126
135
  end
@@ -32,6 +32,12 @@ module Bandwidth
32
32
  # @return [String]
33
33
  attr_accessor :tag
34
34
 
35
+ # The message's priority, currently for toll-free or short code SMS only.
36
+ # Messages with a priority value of `"high"` are given preference over your
37
+ # other traffic.
38
+ # @return [PriorityEnum]
39
+ attr_accessor :priority
40
+
35
41
  # A mapping from model property names to API property names.
36
42
  def self.names
37
43
  @_hash = {} if @_hash.nil?
@@ -41,6 +47,7 @@ module Bandwidth
41
47
  @_hash['text'] = 'text'
42
48
  @_hash['media'] = 'media'
43
49
  @_hash['tag'] = 'tag'
50
+ @_hash['priority'] = 'priority'
44
51
  @_hash
45
52
  end
46
53
 
@@ -49,13 +56,15 @@ module Bandwidth
49
56
  from = nil,
50
57
  text = nil,
51
58
  media = nil,
52
- tag = nil)
59
+ tag = nil,
60
+ priority = nil)
53
61
  @application_id = application_id
54
62
  @to = to
55
63
  @from = from
56
64
  @text = text
57
65
  @media = media
58
66
  @tag = tag
67
+ @priority = priority
59
68
  end
60
69
 
61
70
  # Creates an instance of the object from a hash.
@@ -69,6 +78,7 @@ module Bandwidth
69
78
  text = hash['text']
70
79
  media = hash['media']
71
80
  tag = hash['tag']
81
+ priority = hash['priority']
72
82
 
73
83
  # Create object from extracted values.
74
84
  MessageRequest.new(application_id,
@@ -76,7 +86,8 @@ module Bandwidth
76
86
  from,
77
87
  text,
78
88
  media,
79
- tag)
89
+ tag,
90
+ priority)
80
91
  end
81
92
  end
82
93
  end
@@ -0,0 +1,19 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # The message's priority, currently for toll-free or short code SMS only.
8
+ # Messages with a priority value of `"high"` are given preference over your
9
+ # other traffic.
10
+ class PriorityEnum
11
+ PRIORITY_ENUM = [
12
+ # TODO: Write general description for DEFAULT
13
+ DEFAULT = 'default'.freeze,
14
+
15
+ # TODO: Write general description for HIGH
16
+ HIGH = 'high'.freeze
17
+ ].freeze
18
+ end
19
+ end
@@ -14,7 +14,9 @@ require_relative 'two_factor_auth/models/two_factor_verify_request_schema.rb'
14
14
  require_relative 'two_factor_auth/models/two_factor_verify_code_response.rb'
15
15
 
16
16
  # Exceptions
17
- require_relative 'two_factor_auth/exceptions/invalid_request_exception.rb'
17
+ require_relative 'two_factor_auth/exceptions/error_with_request_exception.rb'
18
+ require_relative 'two_factor_auth/exceptions/unauthorized_request_exception.rb'
19
+ require_relative 'two_factor_auth/exceptions/forbidden_request_exception.rb'
18
20
  # Controllers
19
21
  require_relative 'two_factor_auth/controllers/base_controller.rb'
20
- require_relative 'two_factor_auth/controllers/api_controller.rb'
22
+ require_relative 'two_factor_auth/controllers/mfa_controller.rb'
@@ -9,10 +9,10 @@ module Bandwidth
9
9
  class Client
10
10
  attr_reader :config
11
11
 
12
- # Access to client controller.
13
- # @return [APIController] Returns the controller instance.
14
- def client
15
- @client ||= APIController.new config
12
+ # Access to mfa controller.
13
+ # @return [MFAController] Returns the controller instance.
14
+ def mfa
15
+ @mfa ||= MFAController.new config
16
16
  end
17
17
 
18
18
  def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
@@ -5,13 +5,13 @@
5
5
 
6
6
  module Bandwidth
7
7
  module TwoFactorAuth
8
- # APIController
9
- class APIController < BaseController
8
+ # MFAController
9
+ class MFAController < BaseController
10
10
  def initialize(config, http_call_back: nil)
11
11
  super(config, http_call_back: http_call_back)
12
12
  end
13
13
 
14
- # Two-Factor authentication with Bandwidth Voice services
14
+ # Allows a user to send a MFA code through a phone call
15
15
  # @param [String] account_id Required parameter: Bandwidth Account ID with
16
16
  # Voice service enabled
17
17
  # @param [TwoFactorCodeRequestSchema] body Required parameter: Example:
@@ -44,8 +44,23 @@ module TwoFactorAuth
44
44
 
45
45
  # Validate response against endpoint and global error codes.
46
46
  if _response.status_code == 400
47
- raise InvalidRequestException.new(
48
- 'client request error',
47
+ raise ErrorWithRequestException.new(
48
+ 'If there is any issue with values passed in by the user',
49
+ _response
50
+ )
51
+ elsif _response.status_code == 401
52
+ raise UnauthorizedRequestException.new(
53
+ 'Authentication is either incorrect or not present',
54
+ _response
55
+ )
56
+ elsif _response.status_code == 403
57
+ raise ForbiddenRequestException.new(
58
+ 'The user is not authorized to access this resource',
59
+ _response
60
+ )
61
+ elsif _response.status_code == 500
62
+ raise ErrorWithRequestException.new(
63
+ 'An internal server error occurred',
49
64
  _response
50
65
  )
51
66
  end
@@ -58,7 +73,7 @@ module TwoFactorAuth
58
73
  )
59
74
  end
60
75
 
61
- # Two-Factor authentication with Bandwidth messaging services
76
+ # Allows a user to send a MFA code through a text message (SMS)
62
77
  # @param [String] account_id Required parameter: Bandwidth Account ID with
63
78
  # Messaging service enabled
64
79
  # @param [TwoFactorCodeRequestSchema] body Required parameter: Example:
@@ -91,8 +106,23 @@ module TwoFactorAuth
91
106
 
92
107
  # Validate response against endpoint and global error codes.
93
108
  if _response.status_code == 400
94
- raise InvalidRequestException.new(
95
- 'client request error',
109
+ raise ErrorWithRequestException.new(
110
+ 'If there is any issue with values passed in by the user',
111
+ _response
112
+ )
113
+ elsif _response.status_code == 401
114
+ raise UnauthorizedRequestException.new(
115
+ 'Authentication is either incorrect or not present',
116
+ _response
117
+ )
118
+ elsif _response.status_code == 403
119
+ raise ForbiddenRequestException.new(
120
+ 'The user is not authorized to access this resource',
121
+ _response
122
+ )
123
+ elsif _response.status_code == 500
124
+ raise ErrorWithRequestException.new(
125
+ 'An internal server error occurred',
96
126
  _response
97
127
  )
98
128
  end
@@ -106,7 +136,7 @@ module TwoFactorAuth
106
136
  )
107
137
  end
108
138
 
109
- # Verify a previously sent two-factor authentication code
139
+ # Allows a user to verify an MFA code
110
140
  # @param [String] account_id Required parameter: Bandwidth Account ID with
111
141
  # Two-Factor enabled
112
142
  # @param [TwoFactorVerifyRequestSchema] body Required parameter: Example:
@@ -139,8 +169,29 @@ module TwoFactorAuth
139
169
 
140
170
  # Validate response against endpoint and global error codes.
141
171
  if _response.status_code == 400
142
- raise InvalidRequestException.new(
143
- 'client request error',
172
+ raise ErrorWithRequestException.new(
173
+ 'If there is any issue with values passed in by the user',
174
+ _response
175
+ )
176
+ elsif _response.status_code == 401
177
+ raise UnauthorizedRequestException.new(
178
+ 'Authentication is either incorrect or not present',
179
+ _response
180
+ )
181
+ elsif _response.status_code == 403
182
+ raise ForbiddenRequestException.new(
183
+ 'The user is not authorized to access this resource',
184
+ _response
185
+ )
186
+ elsif _response.status_code == 429
187
+ raise ErrorWithRequestException.new(
188
+ 'The user has made too many bad requests and is temporarily locked' \
189
+ ' out',
190
+ _response
191
+ )
192
+ elsif _response.status_code == 500
193
+ raise ErrorWithRequestException.new(
194
+ 'An internal server error occurred',
144
195
  _response
145
196
  )
146
197
  end
@@ -0,0 +1,34 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # ErrorWithRequest class.
8
+ class ErrorWithRequestException < APIException
9
+ # An error message pertaining to what the issue could be
10
+ # @return [String]
11
+ attr_accessor :error
12
+
13
+ # The associated requestId from AWS
14
+ # @return [String]
15
+ attr_accessor :request_id
16
+
17
+ # The constructor.
18
+ # @param [String] The reason for raising an exception.
19
+ # @param [HttpResponse] The HttpReponse of the API call.
20
+ def initialize(reason, response)
21
+ super(reason, response)
22
+ hash = APIHelper.json_deserialize(@response.raw_body)
23
+ unbox(hash)
24
+ end
25
+
26
+ # Populates this object by extracting properties from a hash.
27
+ # @param [Hash] The deserialized response sent by the server in the
28
+ # response body.
29
+ def unbox(hash)
30
+ @error = hash['error']
31
+ @request_id = hash['requestId']
32
+ end
33
+ end
34
+ end
@@ -4,11 +4,11 @@
4
4
  # ( https://apimatic.io ).
5
5
 
6
6
  module Bandwidth
7
- # InvalidRequest class.
8
- class InvalidRequestException < APIException
9
- # An error message pertaining to what the issue could be
7
+ # ForbiddenRequest class.
8
+ class ForbiddenRequestException < APIException
9
+ # The message containing the reason behind the request being forbidden
10
10
  # @return [String]
11
- attr_accessor :result
11
+ attr_accessor :message
12
12
 
13
13
  # The constructor.
14
14
  # @param [String] The reason for raising an exception.
@@ -23,7 +23,7 @@ module Bandwidth
23
23
  # @param [Hash] The deserialized response sent by the server in the
24
24
  # response body.
25
25
  def unbox(hash)
26
- @result = hash['result']
26
+ @message = hash['Message']
27
27
  end
28
28
  end
29
29
  end
@@ -0,0 +1,29 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # UnauthorizedRequest class.
8
+ class UnauthorizedRequestException < APIException
9
+ # The message containing the reason behind the request being unauthorized
10
+ # @return [String]
11
+ attr_accessor :message
12
+
13
+ # The constructor.
14
+ # @param [String] The reason for raising an exception.
15
+ # @param [HttpResponse] The HttpReponse of the API call.
16
+ def initialize(reason, response)
17
+ super(reason, response)
18
+ hash = APIHelper.json_deserialize(@response.raw_body)
19
+ unbox(hash)
20
+ end
21
+
22
+ # Populates this object by extracting properties from a hash.
23
+ # @param [Hash] The deserialized response sent by the server in the
24
+ # response body.
25
+ def unbox(hash)
26
+ @message = hash['message']
27
+ end
28
+ end
29
+ end
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: 5.0.0
4
+ version: 6.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: 2021-02-01 00:00:00.000000000 Z
11
+ date: 2021-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logging
@@ -177,13 +177,16 @@ files:
177
177
  - lib/bandwidth/messaging_lib/messaging/models/media.rb
178
178
  - lib/bandwidth/messaging_lib/messaging/models/message_request.rb
179
179
  - lib/bandwidth/messaging_lib/messaging/models/page_info.rb
180
+ - lib/bandwidth/messaging_lib/messaging/models/priority_enum.rb
180
181
  - lib/bandwidth/messaging_lib/messaging/models/tag.rb
181
182
  - lib/bandwidth/models/base_model.rb
182
183
  - lib/bandwidth/two_factor_auth_lib/two_factor_auth.rb
183
184
  - lib/bandwidth/two_factor_auth_lib/two_factor_auth/client.rb
184
- - lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/api_controller.rb
185
185
  - lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/base_controller.rb
186
- - lib/bandwidth/two_factor_auth_lib/two_factor_auth/exceptions/invalid_request_exception.rb
186
+ - lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/mfa_controller.rb
187
+ - lib/bandwidth/two_factor_auth_lib/two_factor_auth/exceptions/error_with_request_exception.rb
188
+ - lib/bandwidth/two_factor_auth_lib/two_factor_auth/exceptions/forbidden_request_exception.rb
189
+ - lib/bandwidth/two_factor_auth_lib/two_factor_auth/exceptions/unauthorized_request_exception.rb
187
190
  - lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_code_request_schema.rb
188
191
  - lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_messaging_response.rb
189
192
  - lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_verify_code_response.rb