bandwidth-sdk 3.5.0 → 3.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/lib/bandwidth.rb +2 -0
  3. data/lib/bandwidth/api_helper.rb +14 -9
  4. data/lib/bandwidth/client.rb +13 -2
  5. data/lib/bandwidth/configuration.rb +46 -9
  6. data/lib/bandwidth/http/auth/web_rtc_basic_auth.rb +22 -0
  7. data/lib/bandwidth/messaging_lib/messaging/client.rb +9 -2
  8. data/lib/bandwidth/messaging_lib/messaging/controllers/api_controller.rb +18 -12
  9. data/lib/bandwidth/messaging_lib/messaging/controllers/base_controller.rb +1 -1
  10. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/client.rb +9 -2
  11. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/api_controller.rb +14 -9
  12. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/base_controller.rb +1 -1
  13. data/lib/bandwidth/voice_lib/bxml/verbs/bridge.rb +28 -0
  14. data/lib/bandwidth/voice_lib/bxml/verbs/conference.rb +5 -1
  15. data/lib/bandwidth/voice_lib/bxml/verbs/gather.rb +5 -1
  16. data/lib/bandwidth/voice_lib/bxml/verbs/phone_number.rb +5 -1
  17. data/lib/bandwidth/voice_lib/bxml/verbs/record.rb +5 -1
  18. data/lib/bandwidth/voice_lib/bxml/verbs/redirect.rb +5 -1
  19. data/lib/bandwidth/voice_lib/bxml/verbs/ring.rb +15 -0
  20. data/lib/bandwidth/voice_lib/bxml/verbs/transfer.rb +5 -1
  21. data/lib/bandwidth/voice_lib/voice.rb +8 -2
  22. data/lib/bandwidth/voice_lib/voice/client.rb +9 -2
  23. data/lib/bandwidth/voice_lib/voice/controllers/api_controller.rb +625 -55
  24. data/lib/bandwidth/voice_lib/voice/controllers/base_controller.rb +1 -1
  25. data/lib/bandwidth/voice_lib/voice/models/answer_fallback_method_enum.rb +17 -0
  26. data/lib/bandwidth/voice_lib/voice/models/api_call_response.rb +45 -0
  27. data/lib/bandwidth/voice_lib/voice/models/api_create_call_request.rb +45 -0
  28. data/lib/bandwidth/voice_lib/voice/models/api_modify_call_request.rb +36 -0
  29. data/lib/bandwidth/voice_lib/voice/models/api_transcribe_recording_request.rb +11 -2
  30. data/lib/bandwidth/voice_lib/voice/models/call_engine_modify_conference_request.rb +74 -2
  31. data/lib/bandwidth/voice_lib/voice/models/conference_detail.rb +108 -0
  32. data/lib/bandwidth/voice_lib/voice/models/conference_event_method_enum.rb +35 -0
  33. data/lib/bandwidth/voice_lib/voice/models/conference_member_detail.rb +80 -0
  34. data/lib/bandwidth/voice_lib/voice/models/conference_recording_metadata_response.rb +126 -0
  35. data/lib/bandwidth/voice_lib/voice/models/recording_metadata_response.rb +32 -4
  36. data/lib/bandwidth/voice_lib/voice/models/redirect_fallback_method_enum.rb +17 -0
  37. data/lib/bandwidth/voice_lib/voice/models/state_enum.rb +3 -3
  38. data/lib/bandwidth/voice_lib/voice/models/status1_enum.rb +4 -1
  39. data/lib/bandwidth/voice_lib/voice/models/{status2_enum.rb → status3_enum.rb} +3 -3
  40. data/lib/bandwidth/voice_lib/voice/models/transcription.rb +1 -1
  41. data/lib/bandwidth/web_rtc_lib/web_rtc.rb +21 -0
  42. data/lib/bandwidth/web_rtc_lib/web_rtc/client.rb +51 -0
  43. data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/api_controller.rb +692 -0
  44. data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/base_controller.rb +49 -0
  45. data/lib/bandwidth/web_rtc_lib/web_rtc/exceptions/error_exception.rb +34 -0
  46. data/lib/bandwidth/web_rtc_lib/web_rtc/models/accounts_participants_response.rb +47 -0
  47. data/lib/bandwidth/web_rtc_lib/web_rtc/models/participant.rb +83 -0
  48. data/lib/bandwidth/web_rtc_lib/web_rtc/models/participant_subscription.rb +35 -0
  49. data/lib/bandwidth/web_rtc_lib/web_rtc/models/publish_permission_enum.rb +17 -0
  50. data/lib/bandwidth/web_rtc_lib/web_rtc/models/session.rb +44 -0
  51. data/lib/bandwidth/web_rtc_lib/web_rtc/models/subscriptions.rb +54 -0
  52. metadata +43 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 48115c5ef2d3c4b9f64d4ef6afce6b6ecb94cdde4b445afb21fc4c1819b079c0
4
- data.tar.gz: d9f295c220a2ac75b090ca8a419a1ae2375779119d9cb4bd7a14d09f0f5fed93
3
+ metadata.gz: f3d2881e1496cedc05c46f0cfd26e3d3d5f962ed99a44b058716601e604b9fdf
4
+ data.tar.gz: ee7642af1962da2ed997831b55dde24a8e6568403d47affd12df2200aae2a477
5
5
  SHA512:
6
- metadata.gz: e0d4a309e16b781e6e020688cc1ab153b171aa6a9f59e1e34ddaa81d442c851623cae0a4fdc9d081d62623cee0935277e28265b8da883c7dc2a66aab0c762093
7
- data.tar.gz: d2c7435d3f124001aa11bc8c610336086309b511e65c9744d3007082b03b812c7c14e200005774b5d078b3fb512e62fa483218d7855791efd8206b6868531fc9
6
+ metadata.gz: d8fb09237fb2de6e11a8714b7944dd46a8fbae1ca80c93eb5e596a039012a3755b850075ffb84c4e2bb55e914b08d71852ffdb307daba184d53ade4ac976b37b
7
+ data.tar.gz: 44c19dfccfbc76061c5977ac581ae041db2ddd62ddccfff99235e52d9e04134f4035ed934261656e1b11270d006d707f43d8377e429e169ff019b362ba480b1c
@@ -39,5 +39,7 @@ require_relative 'bandwidth/two_factor_auth_lib/two_factor_auth'
39
39
  require_relative 'bandwidth/http/auth/two_factor_auth_basic_auth.rb'
40
40
  require_relative 'bandwidth/voice_lib/voice'
41
41
  require_relative 'bandwidth/http/auth/voice_basic_auth.rb'
42
+ require_relative 'bandwidth/web_rtc_lib/web_rtc'
43
+ require_relative 'bandwidth/http/auth/web_rtc_basic_auth.rb'
42
44
 
43
45
  # Controllers
@@ -41,17 +41,22 @@ module Bandwidth
41
41
  # Return if there are no parameters to replace.
42
42
  return query_builder if parameters.nil?
43
43
 
44
- # Iterate and append parameters.
45
- parameters.each do |key, value|
46
- replace_value = ''
47
-
48
- if value.nil?
44
+ parameters.each do |key, val|
45
+ if val.nil?
49
46
  replace_value = ''
50
- elsif value.instance_of? Array
51
- value.map! { |element| CGI.escape(element.to_s) }
52
- replace_value = value.join('/')
47
+ elsif val['value'].instance_of? Array
48
+ if val['encode'] == true
49
+ val['value'].map! { |element| CGI.escape(element.to_s) }
50
+ else
51
+ val['value'].map!(&:to_s)
52
+ end
53
+ replace_value = val['value'].join('/')
53
54
  else
54
- replace_value = CGI.escape(value.to_s)
55
+ replace_value = if val['encode'] == true
56
+ CGI.escape(val['value'].to_s)
57
+ else
58
+ val['value'].to_s
59
+ end
55
60
  end
56
61
 
57
62
  # Find the template parameter and replace it with its value.
@@ -22,26 +22,37 @@ module Bandwidth
22
22
  def voice_client
23
23
  @voice_client ||= Voice::Client.new(config: config)
24
24
  end
25
+ # Access to web_rtc_client controller.
26
+ # @return [WebRtc::Client] Returns the client instance.
27
+ def web_rtc_client
28
+ @web_rtc_client ||= WebRtc::Client.new(config: config)
29
+ end
25
30
 
26
31
  def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
27
32
  backoff_factor: 1, environment: Environment::PRODUCTION,
33
+ base_url: 'https://www.example.com',
28
34
  messaging_basic_auth_user_name: 'TODO: Replace',
29
35
  messaging_basic_auth_password: 'TODO: Replace',
30
36
  two_factor_auth_basic_auth_user_name: 'TODO: Replace',
31
37
  two_factor_auth_basic_auth_password: 'TODO: Replace',
32
38
  voice_basic_auth_user_name: 'TODO: Replace',
33
- voice_basic_auth_password: 'TODO: Replace', config: nil)
39
+ voice_basic_auth_password: 'TODO: Replace',
40
+ web_rtc_basic_auth_user_name: 'TODO: Replace',
41
+ web_rtc_basic_auth_password: 'TODO: Replace', config: nil)
34
42
  @config = if config.nil?
35
43
  Configuration.new(timeout: timeout, max_retries: max_retries,
36
44
  retry_interval: retry_interval,
37
45
  backoff_factor: backoff_factor,
38
46
  environment: environment,
47
+ base_url: base_url,
39
48
  messaging_basic_auth_user_name: messaging_basic_auth_user_name,
40
49
  messaging_basic_auth_password: messaging_basic_auth_password,
41
50
  two_factor_auth_basic_auth_user_name: two_factor_auth_basic_auth_user_name,
42
51
  two_factor_auth_basic_auth_password: two_factor_auth_basic_auth_password,
43
52
  voice_basic_auth_user_name: voice_basic_auth_user_name,
44
- voice_basic_auth_password: voice_basic_auth_password)
53
+ voice_basic_auth_password: voice_basic_auth_password,
54
+ web_rtc_basic_auth_user_name: web_rtc_basic_auth_user_name,
55
+ web_rtc_basic_auth_password: web_rtc_basic_auth_password)
45
56
  else
46
57
  config
47
58
  end
@@ -7,7 +7,8 @@ module Bandwidth
7
7
  # An enum for SDK environments.
8
8
  class Environment
9
9
  ENVIRONMENT = [
10
- PRODUCTION = 'production'.freeze
10
+ PRODUCTION = 'production'.freeze,
11
+ CUSTOM = 'custom'.freeze
11
12
  ].freeze
12
13
  end
13
14
 
@@ -17,7 +18,8 @@ module Bandwidth
17
18
  DEFAULT = 'default'.freeze,
18
19
  MESSAGINGDEFAULT = 'MessagingDefault'.freeze,
19
20
  TWOFACTORAUTHDEFAULT = 'TwoFactorAuthDefault'.freeze,
20
- VOICEDEFAULT = 'VoiceDefault'.freeze
21
+ VOICEDEFAULT = 'VoiceDefault'.freeze,
22
+ WEBRTCDEFAULT = 'WebRtcDefault'.freeze
21
23
  ].freeze
22
24
  end
23
25
 
@@ -31,12 +33,15 @@ module Bandwidth
31
33
  attr_reader :retry_interval
32
34
  attr_reader :backoff_factor
33
35
  attr_reader :environment
36
+ attr_reader :base_url
34
37
  attr_reader :messaging_basic_auth_user_name
35
38
  attr_reader :messaging_basic_auth_password
36
39
  attr_reader :two_factor_auth_basic_auth_user_name
37
40
  attr_reader :two_factor_auth_basic_auth_password
38
41
  attr_reader :voice_basic_auth_user_name
39
42
  attr_reader :voice_basic_auth_password
43
+ attr_reader :web_rtc_basic_auth_user_name
44
+ attr_reader :web_rtc_basic_auth_password
40
45
 
41
46
  class << self
42
47
  attr_reader :environments
@@ -44,12 +49,15 @@ module Bandwidth
44
49
 
45
50
  def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
46
51
  backoff_factor: 1, environment: Environment::PRODUCTION,
52
+ base_url: 'https://www.example.com',
47
53
  messaging_basic_auth_user_name: 'TODO: Replace',
48
54
  messaging_basic_auth_password: 'TODO: Replace',
49
55
  two_factor_auth_basic_auth_user_name: 'TODO: Replace',
50
56
  two_factor_auth_basic_auth_password: 'TODO: Replace',
51
57
  voice_basic_auth_user_name: 'TODO: Replace',
52
- voice_basic_auth_password: 'TODO: Replace')
58
+ voice_basic_auth_password: 'TODO: Replace',
59
+ web_rtc_basic_auth_user_name: 'TODO: Replace',
60
+ web_rtc_basic_auth_password: 'TODO: Replace')
53
61
  # The value to use for connection timeout
54
62
  @timeout = timeout
55
63
 
@@ -66,6 +74,9 @@ module Bandwidth
66
74
  # Current API environment
67
75
  @environment = String(environment)
68
76
 
77
+ # baseUrl value
78
+ @base_url = base_url
79
+
69
80
  # The username to use with basic authentication
70
81
  @messaging_basic_auth_user_name = messaging_basic_auth_user_name
71
82
 
@@ -84,40 +95,53 @@ module Bandwidth
84
95
  # The password to use with basic authentication
85
96
  @voice_basic_auth_password = voice_basic_auth_password
86
97
 
98
+ # The username to use with basic authentication
99
+ @web_rtc_basic_auth_user_name = web_rtc_basic_auth_user_name
100
+
101
+ # The password to use with basic authentication
102
+ @web_rtc_basic_auth_password = web_rtc_basic_auth_password
103
+
87
104
  # The Http Client to use for making requests.
88
105
  @http_client = create_http_client
89
106
  end
90
107
 
91
108
  def clone_with(timeout: nil, max_retries: nil, retry_interval: nil,
92
- backoff_factor: nil, environment: nil,
109
+ backoff_factor: nil, environment: nil, base_url: nil,
93
110
  messaging_basic_auth_user_name: nil,
94
111
  messaging_basic_auth_password: nil,
95
112
  two_factor_auth_basic_auth_user_name: nil,
96
113
  two_factor_auth_basic_auth_password: nil,
97
114
  voice_basic_auth_user_name: nil,
98
- voice_basic_auth_password: nil)
115
+ voice_basic_auth_password: nil,
116
+ web_rtc_basic_auth_user_name: nil,
117
+ web_rtc_basic_auth_password: nil)
99
118
  timeout ||= self.timeout
100
119
  max_retries ||= self.max_retries
101
120
  retry_interval ||= self.retry_interval
102
121
  backoff_factor ||= self.backoff_factor
103
122
  environment ||= self.environment
123
+ base_url ||= self.base_url
104
124
  messaging_basic_auth_user_name ||= self.messaging_basic_auth_user_name
105
125
  messaging_basic_auth_password ||= self.messaging_basic_auth_password
106
126
  two_factor_auth_basic_auth_user_name ||= self.two_factor_auth_basic_auth_user_name
107
127
  two_factor_auth_basic_auth_password ||= self.two_factor_auth_basic_auth_password
108
128
  voice_basic_auth_user_name ||= self.voice_basic_auth_user_name
109
129
  voice_basic_auth_password ||= self.voice_basic_auth_password
130
+ web_rtc_basic_auth_user_name ||= self.web_rtc_basic_auth_user_name
131
+ web_rtc_basic_auth_password ||= self.web_rtc_basic_auth_password
110
132
 
111
133
  Configuration.new(
112
134
  timeout: timeout, max_retries: max_retries,
113
135
  retry_interval: retry_interval, backoff_factor: backoff_factor,
114
- environment: environment,
136
+ environment: environment, base_url: base_url,
115
137
  messaging_basic_auth_user_name: messaging_basic_auth_user_name,
116
138
  messaging_basic_auth_password: messaging_basic_auth_password,
117
139
  two_factor_auth_basic_auth_user_name: two_factor_auth_basic_auth_user_name,
118
140
  two_factor_auth_basic_auth_password: two_factor_auth_basic_auth_password,
119
141
  voice_basic_auth_user_name: voice_basic_auth_user_name,
120
- voice_basic_auth_password: voice_basic_auth_password
142
+ voice_basic_auth_password: voice_basic_auth_password,
143
+ web_rtc_basic_auth_user_name: web_rtc_basic_auth_user_name,
144
+ web_rtc_basic_auth_password: web_rtc_basic_auth_password
121
145
  )
122
146
  end
123
147
 
@@ -133,7 +157,15 @@ module Bandwidth
133
157
  Server::DEFAULT => 'api.bandwidth.com',
134
158
  Server::MESSAGINGDEFAULT => 'https://messaging.bandwidth.com/api/v2',
135
159
  Server::TWOFACTORAUTHDEFAULT => 'https://mfa.bandwidth.com/api/v1/',
136
- Server::VOICEDEFAULT => 'https://voice.bandwidth.com'
160
+ Server::VOICEDEFAULT => 'https://voice.bandwidth.com',
161
+ Server::WEBRTCDEFAULT => 'https://api.webrtc.bandwidth.com/v1'
162
+ },
163
+ Environment::CUSTOM => {
164
+ Server::DEFAULT => '{base_url}',
165
+ Server::MESSAGINGDEFAULT => '{base_url}',
166
+ Server::TWOFACTORAUTHDEFAULT => '{base_url}',
167
+ Server::VOICEDEFAULT => '{base_url}',
168
+ Server::WEBRTCDEFAULT => '{base_url}'
137
169
  }
138
170
  }.freeze
139
171
 
@@ -142,7 +174,12 @@ module Bandwidth
142
174
  # required.
143
175
  # @return [String] The base URI.
144
176
  def get_base_uri(server = Server::DEFAULT)
145
- ENVIRONMENTS[environment][server].clone
177
+ parameters = {
178
+ 'base_url' => { 'value' => base_url, 'encode' => false }
179
+ }
180
+ APIHelper.append_url_with_template_parameters(
181
+ ENVIRONMENTS[environment][server], parameters
182
+ )
146
183
  end
147
184
  end
148
185
  end
@@ -0,0 +1,22 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ require 'base64'
7
+
8
+ module Bandwidth
9
+ # Utility class for basic authorization.
10
+ class WebRtcBasicAuth
11
+ # Add basic authentication to the request.
12
+ # @param [HttpRequest] The HttpRequest object to which authentication will
13
+ # be added.
14
+ def self.apply(config, http_request)
15
+ username = config.web_rtc_basic_auth_user_name
16
+ password = config.web_rtc_basic_auth_password
17
+ value = Base64.strict_encode64("#{username}:#{password}")
18
+ header_value = "Basic #{value}"
19
+ http_request.headers['Authorization'] = header_value
20
+ end
21
+ end
22
+ end
@@ -17,24 +17,31 @@ module Bandwidth
17
17
 
18
18
  def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
19
19
  backoff_factor: 1, environment: Environment::PRODUCTION,
20
+ base_url: 'https://www.example.com',
20
21
  messaging_basic_auth_user_name: 'TODO: Replace',
21
22
  messaging_basic_auth_password: 'TODO: Replace',
22
23
  two_factor_auth_basic_auth_user_name: 'TODO: Replace',
23
24
  two_factor_auth_basic_auth_password: 'TODO: Replace',
24
25
  voice_basic_auth_user_name: 'TODO: Replace',
25
- voice_basic_auth_password: 'TODO: Replace', config: nil)
26
+ voice_basic_auth_password: 'TODO: Replace',
27
+ web_rtc_basic_auth_user_name: 'TODO: Replace',
28
+ web_rtc_basic_auth_password: 'TODO: Replace',
29
+ config: nil)
26
30
  @config = if config.nil?
27
31
  Configuration.new(timeout: timeout,
28
32
  max_retries: max_retries,
29
33
  retry_interval: retry_interval,
30
34
  backoff_factor: backoff_factor,
31
35
  environment: environment,
36
+ base_url: base_url,
32
37
  messaging_basic_auth_user_name: messaging_basic_auth_user_name,
33
38
  messaging_basic_auth_password: messaging_basic_auth_password,
34
39
  two_factor_auth_basic_auth_user_name: two_factor_auth_basic_auth_user_name,
35
40
  two_factor_auth_basic_auth_password: two_factor_auth_basic_auth_password,
36
41
  voice_basic_auth_user_name: voice_basic_auth_user_name,
37
- voice_basic_auth_password: voice_basic_auth_password)
42
+ voice_basic_auth_password: voice_basic_auth_password,
43
+ web_rtc_basic_auth_user_name: web_rtc_basic_auth_user_name,
44
+ web_rtc_basic_auth_password: web_rtc_basic_auth_password)
38
45
  else
39
46
  config
40
47
  end
@@ -22,7 +22,7 @@ module Messaging
22
22
  _query_builder << '/users/{userId}/media'
23
23
  _query_builder = APIHelper.append_url_with_template_parameters(
24
24
  _query_builder,
25
- 'userId' => user_id
25
+ 'userId' => { 'value' => user_id, 'encode' => true }
26
26
  )
27
27
  _query_url = APIHelper.clean_url _query_builder
28
28
 
@@ -76,8 +76,10 @@ module Messaging
76
76
 
77
77
  # Return appropriate response type.
78
78
  decoded = APIHelper.json_deserialize(_response.raw_body)
79
- ApiResponse.new(_response,
80
- data: decoded.map { |element| Media.from_hash(element) })
79
+ ApiResponse.new(
80
+ _response,
81
+ data: decoded.map { |element| Media.from_hash(element) }
82
+ )
81
83
  end
82
84
 
83
85
  # getMedia
@@ -91,8 +93,8 @@ module Messaging
91
93
  _query_builder << '/users/{userId}/media/{mediaId}'
92
94
  _query_builder = APIHelper.append_url_with_template_parameters(
93
95
  _query_builder,
94
- 'userId' => user_id,
95
- 'mediaId' => media_id
96
+ 'userId' => { 'value' => user_id, 'encode' => true },
97
+ 'mediaId' => { 'value' => media_id, 'encode' => true }
96
98
  )
97
99
  _query_url = APIHelper.clean_url _query_builder
98
100
 
@@ -138,7 +140,9 @@ module Messaging
138
140
  validate_response(_response)
139
141
 
140
142
  # Return appropriate response type.
141
- ApiResponse.new(_response, data: _response.raw_body)
143
+ ApiResponse.new(
144
+ _response, data: _response.raw_body
145
+ )
142
146
  end
143
147
 
144
148
  # uploadMedia
@@ -161,8 +165,8 @@ module Messaging
161
165
  _query_builder << '/users/{userId}/media/{mediaId}'
162
166
  _query_builder = APIHelper.append_url_with_template_parameters(
163
167
  _query_builder,
164
- 'userId' => user_id,
165
- 'mediaId' => media_id
168
+ 'userId' => { 'value' => user_id, 'encode' => true },
169
+ 'mediaId' => { 'value' => media_id, 'encode' => true }
166
170
  )
167
171
  _query_url = APIHelper.clean_url _query_builder
168
172
 
@@ -240,8 +244,8 @@ module Messaging
240
244
  _query_builder << '/users/{userId}/media/{mediaId}'
241
245
  _query_builder = APIHelper.append_url_with_template_parameters(
242
246
  _query_builder,
243
- 'userId' => user_id,
244
- 'mediaId' => media_id
247
+ 'userId' => { 'value' => user_id, 'encode' => true },
248
+ 'mediaId' => { 'value' => media_id, 'encode' => true }
245
249
  )
246
250
  _query_url = APIHelper.clean_url _query_builder
247
251
 
@@ -301,7 +305,7 @@ module Messaging
301
305
  _query_builder << '/users/{userId}/messages'
302
306
  _query_builder = APIHelper.append_url_with_template_parameters(
303
307
  _query_builder,
304
- 'userId' => user_id
308
+ 'userId' => { 'value' => user_id, 'encode' => true }
305
309
  )
306
310
  _query_url = APIHelper.clean_url _query_builder
307
311
 
@@ -356,7 +360,9 @@ module Messaging
356
360
 
357
361
  # Return appropriate response type.
358
362
  decoded = APIHelper.json_deserialize(_response.raw_body)
359
- ApiResponse.new(_response, data: BandwidthMessage.from_hash(decoded))
363
+ ApiResponse.new(
364
+ _response, data: BandwidthMessage.from_hash(decoded)
365
+ )
360
366
  end
361
367
  end
362
368
  end
@@ -13,7 +13,7 @@ module Bandwidth
13
13
  @http_call_back = http_call_back
14
14
 
15
15
  @global_headers = {
16
- 'user-agent' => 'ruby-sdk-refs/tags/ruby3.5.0'
16
+ 'user-agent' => 'ruby-sdk-refs/tags/ruby3.10.0'
17
17
  }
18
18
  end
19
19
 
@@ -17,24 +17,31 @@ module Bandwidth
17
17
 
18
18
  def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
19
19
  backoff_factor: 1, environment: Environment::PRODUCTION,
20
+ base_url: 'https://www.example.com',
20
21
  messaging_basic_auth_user_name: 'TODO: Replace',
21
22
  messaging_basic_auth_password: 'TODO: Replace',
22
23
  two_factor_auth_basic_auth_user_name: 'TODO: Replace',
23
24
  two_factor_auth_basic_auth_password: 'TODO: Replace',
24
25
  voice_basic_auth_user_name: 'TODO: Replace',
25
- voice_basic_auth_password: 'TODO: Replace', config: nil)
26
+ voice_basic_auth_password: 'TODO: Replace',
27
+ web_rtc_basic_auth_user_name: 'TODO: Replace',
28
+ web_rtc_basic_auth_password: 'TODO: Replace',
29
+ config: nil)
26
30
  @config = if config.nil?
27
31
  Configuration.new(timeout: timeout,
28
32
  max_retries: max_retries,
29
33
  retry_interval: retry_interval,
30
34
  backoff_factor: backoff_factor,
31
35
  environment: environment,
36
+ base_url: base_url,
32
37
  messaging_basic_auth_user_name: messaging_basic_auth_user_name,
33
38
  messaging_basic_auth_password: messaging_basic_auth_password,
34
39
  two_factor_auth_basic_auth_user_name: two_factor_auth_basic_auth_user_name,
35
40
  two_factor_auth_basic_auth_password: two_factor_auth_basic_auth_password,
36
41
  voice_basic_auth_user_name: voice_basic_auth_user_name,
37
- voice_basic_auth_password: voice_basic_auth_password)
42
+ voice_basic_auth_password: voice_basic_auth_password,
43
+ web_rtc_basic_auth_user_name: web_rtc_basic_auth_user_name,
44
+ web_rtc_basic_auth_password: web_rtc_basic_auth_password)
38
45
  else
39
46
  config
40
47
  end
@@ -23,7 +23,7 @@ module TwoFactorAuth
23
23
  _query_builder << '/accounts/{accountId}/code/voice'
24
24
  _query_builder = APIHelper.append_url_with_template_parameters(
25
25
  _query_builder,
26
- 'accountId' => account_id
26
+ 'accountId' => { 'value' => account_id, 'encode' => true }
27
27
  )
28
28
  _query_url = APIHelper.clean_url _query_builder
29
29
 
@@ -53,8 +53,9 @@ module TwoFactorAuth
53
53
 
54
54
  # Return appropriate response type.
55
55
  decoded = APIHelper.json_deserialize(_response.raw_body)
56
- ApiResponse.new(_response,
57
- data: TwoFactorVoiceResponse.from_hash(decoded))
56
+ ApiResponse.new(
57
+ _response, data: TwoFactorVoiceResponse.from_hash(decoded)
58
+ )
58
59
  end
59
60
 
60
61
  # Two-Factor authentication with Bandwidth messaging services
@@ -69,7 +70,7 @@ module TwoFactorAuth
69
70
  _query_builder << '/accounts/{accountId}/code/messaging'
70
71
  _query_builder = APIHelper.append_url_with_template_parameters(
71
72
  _query_builder,
72
- 'accountId' => account_id
73
+ 'accountId' => { 'value' => account_id, 'encode' => true }
73
74
  )
74
75
  _query_url = APIHelper.clean_url _query_builder
75
76
 
@@ -99,8 +100,10 @@ module TwoFactorAuth
99
100
 
100
101
  # Return appropriate response type.
101
102
  decoded = APIHelper.json_deserialize(_response.raw_body)
102
- ApiResponse.new(_response,
103
- data: TwoFactorMessagingResponse.from_hash(decoded))
103
+ ApiResponse.new(
104
+ _response,
105
+ data: TwoFactorMessagingResponse.from_hash(decoded)
106
+ )
104
107
  end
105
108
 
106
109
  # Verify a previously sent two-factor authentication code
@@ -115,7 +118,7 @@ module TwoFactorAuth
115
118
  _query_builder << '/accounts/{accountId}/code/verify'
116
119
  _query_builder = APIHelper.append_url_with_template_parameters(
117
120
  _query_builder,
118
- 'accountId' => account_id
121
+ 'accountId' => { 'value' => account_id, 'encode' => true }
119
122
  )
120
123
  _query_url = APIHelper.clean_url _query_builder
121
124
 
@@ -145,8 +148,10 @@ module TwoFactorAuth
145
148
 
146
149
  # Return appropriate response type.
147
150
  decoded = APIHelper.json_deserialize(_response.raw_body)
148
- ApiResponse.new(_response,
149
- data: TwoFactorVerifyCodeResponse.from_hash(decoded))
151
+ ApiResponse.new(
152
+ _response,
153
+ data: TwoFactorVerifyCodeResponse.from_hash(decoded)
154
+ )
150
155
  end
151
156
  end
152
157
  end