Skip to content

Commit 8bf0706

Browse files
MFA package renaming, voice class and method renaming, body parameter definition set to required, and messaging upload media removal of content length parameter (breaking changes) (#24)
* New deploy * version bump, import fixes * updated tests * fixed parameters and errors * jacob cannot read Co-authored-by: jmulford-bw <[email protected]>
1 parent b91eb4d commit 8bf0706

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1138
-1032
lines changed

bandwidth.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Gem::Specification.new do |s|
22
s.name = 'bandwidth-sdk'
3-
s.version = '6.2.0'
3+
s.version = '7.0.0'
44
s.summary = 'bandwidth'
55
s.description = 'Bandwidth\'s set of APIs'
66
s.authors = ['APIMatic SDK Generator']

lib/bandwidth.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
# Utilities
1616
require_relative 'bandwidth/utilities/file_wrapper.rb'
17+
require_relative 'bandwidth/utilities/date_time_helper.rb'
1718

1819
# Http
1920
require_relative 'bandwidth/http/api_response.rb'
@@ -35,8 +36,8 @@
3536
# Namespaces
3637
require_relative 'bandwidth/messaging_lib/messaging'
3738
require_relative 'bandwidth/http/auth/messaging_basic_auth.rb'
38-
require_relative 'bandwidth/two_factor_auth_lib/two_factor_auth'
39-
require_relative 'bandwidth/http/auth/two_factor_auth_basic_auth.rb'
39+
require_relative 'bandwidth/multi_factor_auth_lib/multi_factor_auth'
40+
require_relative 'bandwidth/http/auth/multi_factor_auth_basic_auth.rb'
4041
require_relative 'bandwidth/phone_number_lookup_lib/phone_number_lookup'
4142
require_relative 'bandwidth/http/auth/phone_number_lookup_basic_auth.rb'
4243
require_relative 'bandwidth/voice_lib/voice'

lib/bandwidth/api_helper.rb

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -273,17 +273,5 @@ def self.map_response(obj, keys)
273273
end
274274
val
275275
end
276-
277-
# Safely converts a string into an rfc3339 DateTime object
278-
# @param [String] The datetime string
279-
# @return [DateTime] A DateTime object of rfc3339 format
280-
def self.rfc3339(date_time)
281-
# missing timezone information
282-
if date_time.end_with?('Z') || date_time.index('+')
283-
DateTime.rfc3339(date_time)
284-
else
285-
DateTime.rfc3339(date_time + 'Z')
286-
end
287-
end
288276
end
289277
end

lib/bandwidth/client.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ class Client
1212
def messaging_client
1313
@messaging_client ||= Messaging::Client.new(config: config)
1414
end
15-
# Access to two_factor_auth_client controller.
16-
# @return [TwoFactorAuth::Client] Returns the client instance.
17-
def two_factor_auth_client
18-
@two_factor_auth_client ||= TwoFactorAuth::Client.new(config: config)
15+
# Access to multi_factor_auth_client controller.
16+
# @return [MultiFactorAuth::Client] Returns the client instance.
17+
def multi_factor_auth_client
18+
@multi_factor_auth_client ||= MultiFactorAuth::Client.new(config: config)
1919
end
2020
# Access to phone_number_lookup_client controller.
2121
# @return [PhoneNumberLookup::Client] Returns the client instance.
@@ -41,8 +41,8 @@ def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
4141
base_url: 'https://www.example.com',
4242
messaging_basic_auth_user_name: 'TODO: Replace',
4343
messaging_basic_auth_password: 'TODO: Replace',
44-
two_factor_auth_basic_auth_user_name: 'TODO: Replace',
45-
two_factor_auth_basic_auth_password: 'TODO: Replace',
44+
multi_factor_auth_basic_auth_user_name: 'TODO: Replace',
45+
multi_factor_auth_basic_auth_password: 'TODO: Replace',
4646
phone_number_lookup_basic_auth_user_name: 'TODO: Replace',
4747
phone_number_lookup_basic_auth_password: 'TODO: Replace',
4848
voice_basic_auth_user_name: 'TODO: Replace',
@@ -59,8 +59,8 @@ def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
5959
base_url: base_url,
6060
messaging_basic_auth_user_name: messaging_basic_auth_user_name,
6161
messaging_basic_auth_password: messaging_basic_auth_password,
62-
two_factor_auth_basic_auth_user_name: two_factor_auth_basic_auth_user_name,
63-
two_factor_auth_basic_auth_password: two_factor_auth_basic_auth_password,
62+
multi_factor_auth_basic_auth_user_name: multi_factor_auth_basic_auth_user_name,
63+
multi_factor_auth_basic_auth_password: multi_factor_auth_basic_auth_password,
6464
phone_number_lookup_basic_auth_user_name: phone_number_lookup_basic_auth_user_name,
6565
phone_number_lookup_basic_auth_password: phone_number_lookup_basic_auth_password,
6666
voice_basic_auth_user_name: voice_basic_auth_user_name,

lib/bandwidth/configuration.rb

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Server
1717
SERVER = [
1818
DEFAULT = 'default'.freeze,
1919
MESSAGINGDEFAULT = 'MessagingDefault'.freeze,
20-
TWOFACTORAUTHDEFAULT = 'TwoFactorAuthDefault'.freeze,
20+
MULTIFACTORAUTHDEFAULT = 'MultiFactorAuthDefault'.freeze,
2121
PHONENUMBERLOOKUPDEFAULT = 'PhoneNumberLookupDefault'.freeze,
2222
VOICEDEFAULT = 'VoiceDefault'.freeze,
2323
WEBRTCDEFAULT = 'WebRtcDefault'.freeze
@@ -39,8 +39,8 @@ class Configuration
3939
attr_reader :base_url
4040
attr_reader :messaging_basic_auth_user_name
4141
attr_reader :messaging_basic_auth_password
42-
attr_reader :two_factor_auth_basic_auth_user_name
43-
attr_reader :two_factor_auth_basic_auth_password
42+
attr_reader :multi_factor_auth_basic_auth_user_name
43+
attr_reader :multi_factor_auth_basic_auth_password
4444
attr_reader :phone_number_lookup_basic_auth_user_name
4545
attr_reader :phone_number_lookup_basic_auth_password
4646
attr_reader :voice_basic_auth_user_name
@@ -60,8 +60,8 @@ def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
6060
base_url: 'https://www.example.com',
6161
messaging_basic_auth_user_name: 'TODO: Replace',
6262
messaging_basic_auth_password: 'TODO: Replace',
63-
two_factor_auth_basic_auth_user_name: 'TODO: Replace',
64-
two_factor_auth_basic_auth_password: 'TODO: Replace',
63+
multi_factor_auth_basic_auth_user_name: 'TODO: Replace',
64+
multi_factor_auth_basic_auth_password: 'TODO: Replace',
6565
phone_number_lookup_basic_auth_user_name: 'TODO: Replace',
6666
phone_number_lookup_basic_auth_password: 'TODO: Replace',
6767
voice_basic_auth_user_name: 'TODO: Replace',
@@ -100,10 +100,10 @@ def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
100100
@messaging_basic_auth_password = messaging_basic_auth_password
101101

102102
# The username to use with basic authentication
103-
@two_factor_auth_basic_auth_user_name = two_factor_auth_basic_auth_user_name
103+
@multi_factor_auth_basic_auth_user_name = multi_factor_auth_basic_auth_user_name
104104

105105
# The password to use with basic authentication
106-
@two_factor_auth_basic_auth_password = two_factor_auth_basic_auth_password
106+
@multi_factor_auth_basic_auth_password = multi_factor_auth_basic_auth_password
107107

108108
# The username to use with basic authentication
109109
@phone_number_lookup_basic_auth_user_name = phone_number_lookup_basic_auth_user_name
@@ -132,8 +132,8 @@ def clone_with(timeout: nil, max_retries: nil, retry_interval: nil,
132132
environment: nil, base_url: nil,
133133
messaging_basic_auth_user_name: nil,
134134
messaging_basic_auth_password: nil,
135-
two_factor_auth_basic_auth_user_name: nil,
136-
two_factor_auth_basic_auth_password: nil,
135+
multi_factor_auth_basic_auth_user_name: nil,
136+
multi_factor_auth_basic_auth_password: nil,
137137
phone_number_lookup_basic_auth_user_name: nil,
138138
phone_number_lookup_basic_auth_password: nil,
139139
voice_basic_auth_user_name: nil,
@@ -150,8 +150,8 @@ def clone_with(timeout: nil, max_retries: nil, retry_interval: nil,
150150
base_url ||= self.base_url
151151
messaging_basic_auth_user_name ||= self.messaging_basic_auth_user_name
152152
messaging_basic_auth_password ||= self.messaging_basic_auth_password
153-
two_factor_auth_basic_auth_user_name ||= self.two_factor_auth_basic_auth_user_name
154-
two_factor_auth_basic_auth_password ||= self.two_factor_auth_basic_auth_password
153+
multi_factor_auth_basic_auth_user_name ||= self.multi_factor_auth_basic_auth_user_name
154+
multi_factor_auth_basic_auth_password ||= self.multi_factor_auth_basic_auth_password
155155
phone_number_lookup_basic_auth_user_name ||= self.phone_number_lookup_basic_auth_user_name
156156
phone_number_lookup_basic_auth_password ||= self.phone_number_lookup_basic_auth_password
157157
voice_basic_auth_user_name ||= self.voice_basic_auth_user_name
@@ -166,8 +166,8 @@ def clone_with(timeout: nil, max_retries: nil, retry_interval: nil,
166166
environment: environment, base_url: base_url,
167167
messaging_basic_auth_user_name: messaging_basic_auth_user_name,
168168
messaging_basic_auth_password: messaging_basic_auth_password,
169-
two_factor_auth_basic_auth_user_name: two_factor_auth_basic_auth_user_name,
170-
two_factor_auth_basic_auth_password: two_factor_auth_basic_auth_password,
169+
multi_factor_auth_basic_auth_user_name: multi_factor_auth_basic_auth_user_name,
170+
multi_factor_auth_basic_auth_password: multi_factor_auth_basic_auth_password,
171171
phone_number_lookup_basic_auth_user_name: phone_number_lookup_basic_auth_user_name,
172172
phone_number_lookup_basic_auth_password: phone_number_lookup_basic_auth_password,
173173
voice_basic_auth_user_name: voice_basic_auth_user_name,
@@ -190,15 +190,15 @@ def create_http_client
190190
Environment::PRODUCTION => {
191191
Server::DEFAULT => 'api.bandwidth.com',
192192
Server::MESSAGINGDEFAULT => 'https://messaging.bandwidth.com/api/v2',
193-
Server::TWOFACTORAUTHDEFAULT => 'https://mfa.bandwidth.com/api/v1',
193+
Server::MULTIFACTORAUTHDEFAULT => 'https://mfa.bandwidth.com/api/v1',
194194
Server::PHONENUMBERLOOKUPDEFAULT => 'https://numbers.bandwidth.com/api/v1',
195195
Server::VOICEDEFAULT => 'https://voice.bandwidth.com',
196196
Server::WEBRTCDEFAULT => 'https://api.webrtc.bandwidth.com/v1'
197197
},
198198
Environment::CUSTOM => {
199199
Server::DEFAULT => '{base_url}',
200200
Server::MESSAGINGDEFAULT => '{base_url}',
201-
Server::TWOFACTORAUTHDEFAULT => '{base_url}',
201+
Server::MULTIFACTORAUTHDEFAULT => '{base_url}',
202202
Server::PHONENUMBERLOOKUPDEFAULT => '{base_url}',
203203
Server::VOICEDEFAULT => '{base_url}',
204204
Server::WEBRTCDEFAULT => '{base_url}'

lib/bandwidth/http/auth/two_factor_auth_basic_auth.rb renamed to lib/bandwidth/http/auth/multi_factor_auth_basic_auth.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77

88
module Bandwidth
99
# Utility class for basic authorization.
10-
class TwoFactorAuthBasicAuth
10+
class MultiFactorAuthBasicAuth
1111
# Add basic authentication to the request.
1212
# @param [HttpRequest] The HttpRequest object to which authentication will
1313
# be added.
1414
def self.apply(config, http_request)
15-
username = config.two_factor_auth_basic_auth_user_name
16-
password = config.two_factor_auth_basic_auth_password
15+
username = config.multi_factor_auth_basic_auth_user_name
16+
password = config.multi_factor_auth_basic_auth_password
1717
value = Base64.strict_encode64("#{username}:#{password}")
1818
header_value = "Basic #{value}"
1919
http_request.headers['Authorization'] = header_value

lib/bandwidth/messaging_lib/messaging/client.rb

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,17 @@ def client
1616
end
1717

1818
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,
2023
base_url: 'https://www.example.com',
2124
messaging_basic_auth_user_name: 'TODO: Replace',
2225
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',
2530
voice_basic_auth_user_name: 'TODO: Replace',
2631
voice_basic_auth_password: 'TODO: Replace',
2732
web_rtc_basic_auth_user_name: 'TODO: Replace',
@@ -32,12 +37,16 @@ def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
3237
max_retries: max_retries,
3338
retry_interval: retry_interval,
3439
backoff_factor: backoff_factor,
40+
retry_statuses: retry_statuses,
41+
retry_methods: retry_methods,
3542
environment: environment,
3643
base_url: base_url,
3744
messaging_basic_auth_user_name: messaging_basic_auth_user_name,
3845
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,
4150
voice_basic_auth_user_name: voice_basic_auth_user_name,
4251
voice_basic_auth_password: voice_basic_auth_password,
4352
web_rtc_basic_auth_user_name: web_rtc_basic_auth_user_name,

0 commit comments

Comments
 (0)