bandwidth-sdk 3.9.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/lib/bandwidth/client.rb +2 -0
  4. data/lib/bandwidth/configuration.rb +23 -4
  5. data/lib/bandwidth/http/api_response.rb +2 -0
  6. data/lib/bandwidth/http/faraday_client.rb +9 -2
  7. data/lib/bandwidth/messaging_lib/messaging/client.rb +2 -0
  8. data/lib/bandwidth/messaging_lib/messaging/controllers/api_controller.rb +8 -8
  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 +2 -0
  11. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/api_controller.rb +3 -3
  12. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/base_controller.rb +1 -1
  13. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_verify_request_schema.rb +0 -19
  14. data/lib/bandwidth/voice_lib/bxml/verbs/bridge.rb +7 -1
  15. data/lib/bandwidth/voice_lib/bxml/verbs/conference.rb +5 -1
  16. data/lib/bandwidth/voice_lib/bxml/verbs/gather.rb +5 -1
  17. data/lib/bandwidth/voice_lib/bxml/verbs/phone_number.rb +5 -1
  18. data/lib/bandwidth/voice_lib/bxml/verbs/record.rb +5 -1
  19. data/lib/bandwidth/voice_lib/bxml/verbs/redirect.rb +5 -1
  20. data/lib/bandwidth/voice_lib/bxml/verbs/ring.rb +15 -0
  21. data/lib/bandwidth/voice_lib/bxml/verbs/sip_uri.rb +25 -0
  22. data/lib/bandwidth/voice_lib/bxml/verbs/start_gather.rb +20 -0
  23. data/lib/bandwidth/voice_lib/bxml/verbs/stop_gather.rb +14 -0
  24. data/lib/bandwidth/voice_lib/bxml/verbs/tag.rb +13 -0
  25. data/lib/bandwidth/voice_lib/bxml/verbs/transfer.rb +14 -3
  26. data/lib/bandwidth/voice_lib/voice/client.rb +2 -0
  27. data/lib/bandwidth/voice_lib/voice/controllers/api_controller.rb +51 -52
  28. data/lib/bandwidth/voice_lib/voice/controllers/base_controller.rb +1 -1
  29. data/lib/bandwidth/voice_lib/voice/models/answer_fallback_method_enum.rb +17 -0
  30. data/lib/bandwidth/voice_lib/voice/models/api_call_response.rb +45 -0
  31. data/lib/bandwidth/voice_lib/voice/models/api_create_call_request.rb +117 -12
  32. data/lib/bandwidth/voice_lib/voice/models/api_modify_call_request.rb +36 -0
  33. data/lib/bandwidth/voice_lib/voice/models/api_modify_conference_request.rb +107 -0
  34. data/lib/bandwidth/voice_lib/voice/models/api_transcribe_recording_request.rb +11 -2
  35. data/lib/bandwidth/voice_lib/voice/models/call_engine_modify_conference_request.rb +38 -2
  36. data/lib/bandwidth/voice_lib/voice/models/conference_detail.rb +7 -4
  37. data/lib/bandwidth/voice_lib/voice/models/conference_recording_metadata_response.rb +5 -4
  38. data/lib/bandwidth/voice_lib/voice/models/recording_metadata_response.rb +5 -4
  39. data/lib/bandwidth/voice_lib/voice/models/redirect_fallback_method_enum.rb +17 -0
  40. data/lib/bandwidth/voice_lib/voice.rb +3 -1
  41. data/lib/bandwidth/web_rtc_lib/utils/web_rtc_transfer.rb +13 -0
  42. data/lib/bandwidth/web_rtc_lib/web_rtc/client.rb +2 -0
  43. data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/api_controller.rb +24 -24
  44. data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/base_controller.rb +1 -1
  45. data/lib/bandwidth.rb +24 -1
  46. metadata +13 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f60ebb7f84d08c70a63b5e3e0f66dbbba6ed9454e00eff7cd33b8b09ba0253b4
4
- data.tar.gz: 3473820c95bb5b50f4b416f26aed89a3131e0641532499e75cf89879ef2f8e30
3
+ metadata.gz: d5ee57c0eb2ed3e14b4d1a5804601d378b746e86d239dc165688b02bd8cba009
4
+ data.tar.gz: 8b04e6e9355e8cfa65de5e53817d1e911fd4186f4ab7a679c87362b1840d97a8
5
5
  SHA512:
6
- metadata.gz: eb17e8c233e85ddf3a0f83e84e58117cb8cdcb16b5e18b6a13de2cecd7ec6bfe1e586dc0ff7187a6db861173a80f9bfcf3c41a9c239bb29c7abffb0e3d2670ba
7
- data.tar.gz: 68d4877a6985d95bb3744fa7d321a3f9784c9237795a5a0e78a4899dc3afa73e3c09f568d235068e32c0d4bdc08231b873aa3a80b55ebbb4ffadfe09ef95afed
6
+ metadata.gz: 745e9bd8de4422f8563dbd0d5c96d9acba7317a938bba925e128737a7341f50a76e73b024b5f838c6635efb652c176089e8a855d45ca2df21ac89732ab92ed10
7
+ data.tar.gz: bab4629ee04f7f0ad2ee6a661500dace66c28885ba94365e40ac814db54e61243c602b81c95e1f04c0b0d83874a839738b41801fec566677a5d48595d6552e21
data/LICENSE CHANGED
@@ -3,7 +3,7 @@ License:
3
3
  The MIT License (MIT)
4
4
  http://opensource.org/licenses/MIT
5
5
 
6
- Copyright (c) 2014 - 2016 APIMATIC Limited
6
+ Copyright (c) 2014 - 2020 APIMATIC Limited
7
7
 
8
8
  Permission is hereby granted, free of charge, to any person obtaining a copy
9
9
  of this software and associated documentation files (the "Software"), to deal
@@ -30,6 +30,7 @@ module Bandwidth
30
30
 
31
31
  def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
32
32
  backoff_factor: 1, environment: Environment::PRODUCTION,
33
+ base_url: 'https://www.example.com',
33
34
  messaging_basic_auth_user_name: 'TODO: Replace',
34
35
  messaging_basic_auth_password: 'TODO: Replace',
35
36
  two_factor_auth_basic_auth_user_name: 'TODO: Replace',
@@ -43,6 +44,7 @@ module Bandwidth
43
44
  retry_interval: retry_interval,
44
45
  backoff_factor: backoff_factor,
45
46
  environment: environment,
47
+ base_url: base_url,
46
48
  messaging_basic_auth_user_name: messaging_basic_auth_user_name,
47
49
  messaging_basic_auth_password: messaging_basic_auth_password,
48
50
  two_factor_auth_basic_auth_user_name: two_factor_auth_basic_auth_user_name,
@@ -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
 
@@ -32,6 +33,7 @@ module Bandwidth
32
33
  attr_reader :retry_interval
33
34
  attr_reader :backoff_factor
34
35
  attr_reader :environment
36
+ attr_reader :base_url
35
37
  attr_reader :messaging_basic_auth_user_name
36
38
  attr_reader :messaging_basic_auth_password
37
39
  attr_reader :two_factor_auth_basic_auth_user_name
@@ -47,6 +49,7 @@ module Bandwidth
47
49
 
48
50
  def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
49
51
  backoff_factor: 1, environment: Environment::PRODUCTION,
52
+ base_url: 'https://www.example.com',
50
53
  messaging_basic_auth_user_name: 'TODO: Replace',
51
54
  messaging_basic_auth_password: 'TODO: Replace',
52
55
  two_factor_auth_basic_auth_user_name: 'TODO: Replace',
@@ -71,6 +74,9 @@ module Bandwidth
71
74
  # Current API environment
72
75
  @environment = String(environment)
73
76
 
77
+ # baseUrl value
78
+ @base_url = base_url
79
+
74
80
  # The username to use with basic authentication
75
81
  @messaging_basic_auth_user_name = messaging_basic_auth_user_name
76
82
 
@@ -100,7 +106,7 @@ module Bandwidth
100
106
  end
101
107
 
102
108
  def clone_with(timeout: nil, max_retries: nil, retry_interval: nil,
103
- backoff_factor: nil, environment: nil,
109
+ backoff_factor: nil, environment: nil, base_url: nil,
104
110
  messaging_basic_auth_user_name: nil,
105
111
  messaging_basic_auth_password: nil,
106
112
  two_factor_auth_basic_auth_user_name: nil,
@@ -114,6 +120,7 @@ module Bandwidth
114
120
  retry_interval ||= self.retry_interval
115
121
  backoff_factor ||= self.backoff_factor
116
122
  environment ||= self.environment
123
+ base_url ||= self.base_url
117
124
  messaging_basic_auth_user_name ||= self.messaging_basic_auth_user_name
118
125
  messaging_basic_auth_password ||= self.messaging_basic_auth_password
119
126
  two_factor_auth_basic_auth_user_name ||= self.two_factor_auth_basic_auth_user_name
@@ -126,7 +133,7 @@ module Bandwidth
126
133
  Configuration.new(
127
134
  timeout: timeout, max_retries: max_retries,
128
135
  retry_interval: retry_interval, backoff_factor: backoff_factor,
129
- environment: environment,
136
+ environment: environment, base_url: base_url,
130
137
  messaging_basic_auth_user_name: messaging_basic_auth_user_name,
131
138
  messaging_basic_auth_password: messaging_basic_auth_password,
132
139
  two_factor_auth_basic_auth_user_name: two_factor_auth_basic_auth_user_name,
@@ -152,6 +159,13 @@ module Bandwidth
152
159
  Server::TWOFACTORAUTHDEFAULT => 'https://mfa.bandwidth.com/api/v1/',
153
160
  Server::VOICEDEFAULT => 'https://voice.bandwidth.com',
154
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}'
155
169
  }
156
170
  }.freeze
157
171
 
@@ -160,7 +174,12 @@ module Bandwidth
160
174
  # required.
161
175
  # @return [String] The base URI.
162
176
  def get_base_uri(server = Server::DEFAULT)
163
- 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
+ )
164
183
  end
165
184
  end
166
185
  end
@@ -25,10 +25,12 @@ module Bandwidth
25
25
  @errors = errors
26
26
  end
27
27
 
28
+ # returns true if status_code is between 200-300
28
29
  def success?
29
30
  status_code >= 200 && status_code < 300
30
31
  end
31
32
 
33
+ # returns true if status_code is between 400-600
32
34
  def error?
33
35
  status_code >= 400 && status_code < 600
34
36
  end
@@ -15,6 +15,7 @@ module Bandwidth
15
15
  @connection = Faraday.new do |faraday|
16
16
  faraday.use Faraday::HttpCache, serializer: Marshal if cache
17
17
  faraday.use FaradayMiddleware::FollowRedirects
18
+ faraday.use :gzip
18
19
  faraday.request :multipart
19
20
  faraday.request :url_encoded
20
21
  faraday.ssl[:ca_file] = Certifi.where
@@ -34,7 +35,10 @@ module Bandwidth
34
35
  http_request.query_url
35
36
  ) do |request|
36
37
  request.headers = http_request.headers
37
- request.body = http_request.parameters
38
+ unless http_request.http_method == HttpMethodEnum::GET &&
39
+ http_request.parameters.empty?
40
+ request.body = http_request.parameters
41
+ end
38
42
  end
39
43
  convert_response(response, http_request)
40
44
  end
@@ -46,7 +50,10 @@ module Bandwidth
46
50
  http_request.query_url
47
51
  ) do |request|
48
52
  request.headers = http_request.headers
49
- request.body = http_request.parameters
53
+ unless http_request.http_method == HttpMethodEnum::GET &&
54
+ http_request.parameters.empty?
55
+ request.body = http_request.parameters
56
+ end
50
57
  end
51
58
  convert_response(response, http_request)
52
59
  end
@@ -17,6 +17,7 @@ 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',
@@ -32,6 +33,7 @@ module Bandwidth
32
33
  retry_interval: retry_interval,
33
34
  backoff_factor: backoff_factor,
34
35
  environment: environment,
36
+ base_url: base_url,
35
37
  messaging_basic_auth_user_name: messaging_basic_auth_user_name,
36
38
  messaging_basic_auth_password: messaging_basic_auth_password,
37
39
  two_factor_auth_basic_auth_user_name: two_factor_auth_basic_auth_user_name,
@@ -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' => { 'value' => user_id, 'encode' => true }
25
+ 'userId' => { 'value' => user_id, 'encode' => false }
26
26
  )
27
27
  _query_url = APIHelper.clean_url _query_builder
28
28
 
@@ -93,8 +93,8 @@ module Messaging
93
93
  _query_builder << '/users/{userId}/media/{mediaId}'
94
94
  _query_builder = APIHelper.append_url_with_template_parameters(
95
95
  _query_builder,
96
- 'userId' => { 'value' => user_id, 'encode' => true },
97
- 'mediaId' => { 'value' => media_id, 'encode' => true }
96
+ 'userId' => { 'value' => user_id, 'encode' => false },
97
+ 'mediaId' => { 'value' => media_id, 'encode' => false }
98
98
  )
99
99
  _query_url = APIHelper.clean_url _query_builder
100
100
 
@@ -165,8 +165,8 @@ module Messaging
165
165
  _query_builder << '/users/{userId}/media/{mediaId}'
166
166
  _query_builder = APIHelper.append_url_with_template_parameters(
167
167
  _query_builder,
168
- 'userId' => { 'value' => user_id, 'encode' => true },
169
- 'mediaId' => { 'value' => media_id, 'encode' => true }
168
+ 'userId' => { 'value' => user_id, 'encode' => false },
169
+ 'mediaId' => { 'value' => media_id, 'encode' => false }
170
170
  )
171
171
  _query_url = APIHelper.clean_url _query_builder
172
172
 
@@ -244,8 +244,8 @@ module Messaging
244
244
  _query_builder << '/users/{userId}/media/{mediaId}'
245
245
  _query_builder = APIHelper.append_url_with_template_parameters(
246
246
  _query_builder,
247
- 'userId' => { 'value' => user_id, 'encode' => true },
248
- 'mediaId' => { 'value' => media_id, 'encode' => true }
247
+ 'userId' => { 'value' => user_id, 'encode' => false },
248
+ 'mediaId' => { 'value' => media_id, 'encode' => false }
249
249
  )
250
250
  _query_url = APIHelper.clean_url _query_builder
251
251
 
@@ -305,7 +305,7 @@ module Messaging
305
305
  _query_builder << '/users/{userId}/messages'
306
306
  _query_builder = APIHelper.append_url_with_template_parameters(
307
307
  _query_builder,
308
- 'userId' => { 'value' => user_id, 'encode' => true }
308
+ 'userId' => { 'value' => user_id, 'encode' => false }
309
309
  )
310
310
  _query_url = APIHelper.clean_url _query_builder
311
311
 
@@ -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.9.0'
16
+ 'user-agent' => 'ruby-sdk'
17
17
  }
18
18
  end
19
19
 
@@ -17,6 +17,7 @@ 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',
@@ -32,6 +33,7 @@ module Bandwidth
32
33
  retry_interval: retry_interval,
33
34
  backoff_factor: backoff_factor,
34
35
  environment: environment,
36
+ base_url: base_url,
35
37
  messaging_basic_auth_user_name: messaging_basic_auth_user_name,
36
38
  messaging_basic_auth_password: messaging_basic_auth_password,
37
39
  two_factor_auth_basic_auth_user_name: two_factor_auth_basic_auth_user_name,
@@ -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' => { 'value' => account_id, 'encode' => true }
26
+ 'accountId' => { 'value' => account_id, 'encode' => false }
27
27
  )
28
28
  _query_url = APIHelper.clean_url _query_builder
29
29
 
@@ -70,7 +70,7 @@ module TwoFactorAuth
70
70
  _query_builder << '/accounts/{accountId}/code/messaging'
71
71
  _query_builder = APIHelper.append_url_with_template_parameters(
72
72
  _query_builder,
73
- 'accountId' => { 'value' => account_id, 'encode' => true }
73
+ 'accountId' => { 'value' => account_id, 'encode' => false }
74
74
  )
75
75
  _query_url = APIHelper.clean_url _query_builder
76
76
 
@@ -118,7 +118,7 @@ module TwoFactorAuth
118
118
  _query_builder << '/accounts/{accountId}/code/verify'
119
119
  _query_builder = APIHelper.append_url_with_template_parameters(
120
120
  _query_builder,
121
- 'accountId' => { 'value' => account_id, 'encode' => true }
121
+ 'accountId' => { 'value' => account_id, 'encode' => false }
122
122
  )
123
123
  _query_url = APIHelper.clean_url _query_builder
124
124
 
@@ -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.9.0'
16
+ 'user-agent' => 'ruby-sdk'
17
17
  }
18
18
  end
19
19
 
@@ -10,10 +10,6 @@ module Bandwidth
10
10
  # @return [String]
11
11
  attr_accessor :to
12
12
 
13
- # The application phone number, the sender of the 2fa code.
14
- # @return [String]
15
- attr_accessor :from
16
-
17
13
  # The application unique ID, obtained from Bandwidth.
18
14
  # @return [String]
19
15
  attr_accessor :application_id
@@ -23,11 +19,6 @@ module Bandwidth
23
19
  # @return [String]
24
20
  attr_accessor :scope
25
21
 
26
- # The number of digits for your 2fa code. The valid number ranges from 2 to
27
- # 8, inclusively.
28
- # @return [Float]
29
- attr_accessor :digits
30
-
31
22
  # The time period, in minutes, to validate the 2fa code. By setting this to
32
23
  # 3 minutes, it will mean any code generated within the last 3 minutes are
33
24
  # still valid. The valid range for expiration time is between 0 and 15
@@ -43,27 +34,21 @@ module Bandwidth
43
34
  def self.names
44
35
  @_hash = {} if @_hash.nil?
45
36
  @_hash['to'] = 'to'
46
- @_hash['from'] = 'from'
47
37
  @_hash['application_id'] = 'applicationId'
48
38
  @_hash['scope'] = 'scope'
49
- @_hash['digits'] = 'digits'
50
39
  @_hash['expiration_time_in_minutes'] = 'expirationTimeInMinutes'
51
40
  @_hash['code'] = 'code'
52
41
  @_hash
53
42
  end
54
43
 
55
44
  def initialize(to = nil,
56
- from = nil,
57
45
  application_id = nil,
58
- digits = nil,
59
46
  expiration_time_in_minutes = nil,
60
47
  code = nil,
61
48
  scope = nil)
62
49
  @to = to
63
- @from = from
64
50
  @application_id = application_id
65
51
  @scope = scope
66
- @digits = digits
67
52
  @expiration_time_in_minutes = expiration_time_in_minutes
68
53
  @code = code
69
54
  end
@@ -74,18 +59,14 @@ module Bandwidth
74
59
 
75
60
  # Extract variables from the hash.
76
61
  to = hash['to']
77
- from = hash['from']
78
62
  application_id = hash['applicationId']
79
- digits = hash['digits']
80
63
  expiration_time_in_minutes = hash['expirationTimeInMinutes']
81
64
  code = hash['code']
82
65
  scope = hash['scope']
83
66
 
84
67
  # Create object from extracted values.
85
68
  TwoFactorVerifyRequestSchema.new(to,
86
- from,
87
69
  application_id,
88
- digits,
89
70
  expiration_time_in_minutes,
90
71
  code,
91
72
  scope)
@@ -14,7 +14,13 @@ module Bandwidth
14
14
  'bridgeTargetCompleteMethod' => bridge_target_complete_method,
15
15
  'username' => username,
16
16
  'password' => password,
17
- 'tag' => tag
17
+ 'tag' => tag,
18
+ 'bridgeCompleteFallbackUrl' => bridge_complete_fallback_url,
19
+ 'bridgeCompleteFallbackMethod' => bridge_complete_fallback_method,
20
+ 'bridgeTargetCompleteFallbackUrl' => bridge_target_complete_fallback_url,
21
+ 'bridgeTargetCompleteFallbackMethod' => bridge_target_complete_fallback_method,
22
+ 'fallbackUsername' => fallback_username,
23
+ 'fallbackPassword' => fallback_password
18
24
  }))
19
25
  end
20
26
  end
@@ -20,7 +20,11 @@ module Bandwidth
20
20
  'conferenceEventMethod' => conference_event_method,
21
21
  'username' => username,
22
22
  'password' => password,
23
- 'tag' => tag
23
+ 'tag' => tag,
24
+ 'conferenceEventFallbackUrl' => conference_event_fallback_url,
25
+ 'conferenceEventFallbackMethod' => conference_event_fallback_method,
26
+ 'fallbackUsername' => fallback_username,
27
+ 'fallbackPassword' => fallback_password
24
28
  }))
25
29
  end
26
30
  end
@@ -17,7 +17,11 @@ module Bandwidth
17
17
  'username' => username,
18
18
  'password' => password,
19
19
  'firstDigitTimeout' => first_digit_timeout,
20
- 'repeatCount' => repeat_count
20
+ 'repeatCount' => repeat_count,
21
+ 'gatherFallbackUrl' => gather_fallback_url,
22
+ 'gatherFallbackMethod' => gather_fallback_method,
23
+ 'fallbackUsername' => fallback_username,
24
+ 'fallbackPassword' => fallback_password
21
25
  })) do
22
26
  def embedded_xml(xml, property, type)
23
27
  if property
@@ -12,7 +12,11 @@ module Bandwidth
12
12
  'transferDisconnectMethod' => transfer_disconnect_method,
13
13
  'username' => username,
14
14
  'password' => password,
15
- 'tag' => tag
15
+ 'tag' => tag,
16
+ 'transferAnswerFallbackUrl' => transfer_answer_fallback_url,
17
+ 'transferAnswerFallbackMethod' => transfer_answer_fallback_method,
18
+ 'fallbackUsername' => fallback_username,
19
+ 'fallbackPassword' => fallback_password
16
20
  }))
17
21
  end
18
22
  end
@@ -21,7 +21,11 @@ module Bandwidth
21
21
  'transcribe' => transcribe,
22
22
  'transcriptionAvailableUrl' => transcription_available_url,
23
23
  'transcriptionAvailableMethod' => transcription_available_method,
24
- 'silenceTimeout' => silence_timeout
24
+ 'silenceTimeout' => silence_timeout,
25
+ 'recordCompleteFallbackUrl' => record_complete_fallback_url,
26
+ 'recordCompleteFallbackMethod' => record_complete_fallback_method,
27
+ 'fallbackUsername' => fallback_username,
28
+ 'fallbackPassword' => fallback_password
25
29
  }))
26
30
  end
27
31
  end
@@ -12,7 +12,11 @@ module Bandwidth
12
12
  'redirectMethod' => redirect_method,
13
13
  'tag' => tag,
14
14
  'username' => username,
15
- 'password' => password
15
+ 'password' => password,
16
+ 'redirectFallbackUrl' => redirect_fallback_url,
17
+ 'redirectFallbackMethod' => redirect_fallback_method,
18
+ 'fallbackUsername' => fallback_username,
19
+ 'fallbackPassword' => fallback_password
16
20
  }))
17
21
  end
18
22
  end
@@ -0,0 +1,15 @@
1
+ require_relative 'xml_verb'
2
+
3
+ module Bandwidth
4
+ module Voice
5
+ class Ring
6
+ include XmlVerb
7
+
8
+ def to_bxml(xml)
9
+ xml.Ring(compact_hash({
10
+ 'duration' => duration
11
+ }))
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,25 @@
1
+ require_relative 'xml_verb'
2
+
3
+ module Bandwidth
4
+ module Voice
5
+ class SipUri
6
+ include XmlVerb
7
+ def to_bxml(xml)
8
+ xml.SipUri(uri, compact_hash({
9
+ 'transferAnswerUrl' => transfer_answer_url,
10
+ 'transferAnswerMethod' => transfer_answer_method,
11
+ 'transferDisconnectUrl' => transfer_disconnect_url,
12
+ 'transferDisconnectMethod' => transfer_disconnect_method,
13
+ 'username' => username,
14
+ 'password' => password,
15
+ 'tag' => tag,
16
+ 'uui' => uui,
17
+ 'transferAnswerFallbackUrl' => transfer_answer_fallback_url,
18
+ 'transferAnswerFallbackMethod' => transfer_answer_fallback_method,
19
+ 'fallbackUsername' => fallback_username,
20
+ 'fallbackPassword' => fallback_password
21
+ }))
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,20 @@
1
+ require_relative 'xml_verb'
2
+
3
+ module Bandwidth
4
+ module Voice
5
+ # The StartGather verb is used to start a gather
6
+ class StartGather
7
+ include XmlVerb
8
+
9
+ def to_bxml(xml)
10
+ xml.StartGather(compact_hash({
11
+ 'username' => username,
12
+ 'password' => password,
13
+ 'tag' => tag,
14
+ 'dtmfUrl' => dtmf_url,
15
+ 'dtmfMethod' => dtmf_method,
16
+ }))
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,14 @@
1
+ require_relative 'xml_verb'
2
+
3
+ module Bandwidth
4
+ module Voice
5
+ # The StopGather verb is used to complete a gather
6
+ class StopGather
7
+ include XmlVerb
8
+
9
+ def to_bxml(xml)
10
+ xml.StopGather()
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,13 @@
1
+ require_relative 'xml_verb'
2
+
3
+ module Bandwidth
4
+ module Voice
5
+ class Tag
6
+ include XmlVerb
7
+
8
+ def to_bxml(xml)
9
+ xml.Tag(tag)
10
+ end
11
+ end
12
+ end
13
+ end
@@ -16,7 +16,11 @@ module Bandwidth
16
16
  'username' => username,
17
17
  'password' => password,
18
18
  'diversionTreatment' => diversion_treatment,
19
- 'diversionReason' => diversion_reason
19
+ 'diversionReason' => diversion_reason,
20
+ 'transferCompleteFallbackUrl' => transfer_complete_fallback_url,
21
+ 'transferCompleteFallbackMethod' => transfer_complete_fallback_method,
22
+ 'fallbackUsername' => fallback_username,
23
+ 'fallbackPassword' => fallback_password
20
24
  })) do
21
25
  def embedded_xml(xml, property, type)
22
26
  if property
@@ -27,8 +31,15 @@ module Bandwidth
27
31
  s.to_bxml(xml)
28
32
  end
29
33
  end
30
- phone_numbers.each do |number|
31
- embedded_xml(xml, number, PhoneNumber)
34
+ if not phone_numbers.nil?
35
+ phone_numbers.each do |number|
36
+ embedded_xml(xml, number, PhoneNumber)
37
+ end
38
+ end
39
+ if not sip_uris.nil?
40
+ sip_uris.each do |sip_uri|
41
+ embedded_xml(xml, sip_uri, SipUri)
42
+ end
32
43
  end
33
44
  end
34
45
  end
@@ -17,6 +17,7 @@ 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',
@@ -32,6 +33,7 @@ module Bandwidth
32
33
  retry_interval: retry_interval,
33
34
  backoff_factor: backoff_factor,
34
35
  environment: environment,
36
+ base_url: base_url,
35
37
  messaging_basic_auth_user_name: messaging_basic_auth_user_name,
36
38
  messaging_basic_auth_password: messaging_basic_auth_password,
37
39
  two_factor_auth_basic_auth_user_name: two_factor_auth_basic_auth_user_name,