bandwidth-sdk 3.6.0 → 3.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bandwidth.rb +24 -1
- data/lib/bandwidth/api_helper.rb +14 -9
- data/lib/bandwidth/client.rb +13 -2
- data/lib/bandwidth/configuration.rb +46 -9
- data/lib/bandwidth/http/auth/web_rtc_basic_auth.rb +22 -0
- data/lib/bandwidth/messaging_lib/messaging/client.rb +9 -2
- data/lib/bandwidth/messaging_lib/messaging/controllers/api_controller.rb +18 -12
- data/lib/bandwidth/messaging_lib/messaging/controllers/base_controller.rb +1 -1
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/client.rb +9 -2
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/api_controller.rb +14 -9
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/base_controller.rb +1 -1
- data/lib/bandwidth/voice_lib/bxml/verbs/bridge.rb +7 -1
- data/lib/bandwidth/voice_lib/bxml/verbs/conference.rb +5 -1
- data/lib/bandwidth/voice_lib/bxml/verbs/gather.rb +5 -1
- data/lib/bandwidth/voice_lib/bxml/verbs/phone_number.rb +5 -1
- data/lib/bandwidth/voice_lib/bxml/verbs/record.rb +5 -1
- data/lib/bandwidth/voice_lib/bxml/verbs/redirect.rb +5 -1
- data/lib/bandwidth/voice_lib/bxml/verbs/ring.rb +15 -0
- data/lib/bandwidth/voice_lib/bxml/verbs/transfer.rb +5 -1
- data/lib/bandwidth/voice_lib/voice.rb +8 -2
- data/lib/bandwidth/voice_lib/voice/client.rb +9 -2
- data/lib/bandwidth/voice_lib/voice/controllers/api_controller.rb +625 -55
- data/lib/bandwidth/voice_lib/voice/controllers/base_controller.rb +1 -1
- data/lib/bandwidth/voice_lib/voice/models/answer_fallback_method_enum.rb +17 -0
- data/lib/bandwidth/voice_lib/voice/models/api_call_response.rb +45 -0
- data/lib/bandwidth/voice_lib/voice/models/api_create_call_request.rb +45 -0
- data/lib/bandwidth/voice_lib/voice/models/api_modify_call_request.rb +36 -0
- data/lib/bandwidth/voice_lib/voice/models/api_transcribe_recording_request.rb +11 -2
- data/lib/bandwidth/voice_lib/voice/models/call_engine_modify_conference_request.rb +74 -2
- data/lib/bandwidth/voice_lib/voice/models/conference_detail.rb +108 -0
- data/lib/bandwidth/voice_lib/voice/models/conference_event_method_enum.rb +35 -0
- data/lib/bandwidth/voice_lib/voice/models/conference_member_detail.rb +80 -0
- data/lib/bandwidth/voice_lib/voice/models/conference_recording_metadata_response.rb +126 -0
- data/lib/bandwidth/voice_lib/voice/models/recording_metadata_response.rb +32 -4
- data/lib/bandwidth/voice_lib/voice/models/redirect_fallback_method_enum.rb +17 -0
- data/lib/bandwidth/voice_lib/voice/models/state_enum.rb +3 -3
- data/lib/bandwidth/voice_lib/voice/models/status1_enum.rb +4 -1
- data/lib/bandwidth/voice_lib/voice/models/{status2_enum.rb → status3_enum.rb} +3 -3
- data/lib/bandwidth/voice_lib/voice/models/transcription.rb +1 -1
- data/lib/bandwidth/web_rtc_lib/utils/web_rtc_transfer.rb +13 -0
- data/lib/bandwidth/web_rtc_lib/web_rtc.rb +21 -0
- data/lib/bandwidth/web_rtc_lib/web_rtc/client.rb +51 -0
- data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/api_controller.rb +692 -0
- data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/base_controller.rb +49 -0
- data/lib/bandwidth/web_rtc_lib/web_rtc/exceptions/error_exception.rb +34 -0
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/accounts_participants_response.rb +47 -0
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/participant.rb +83 -0
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/participant_subscription.rb +35 -0
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/publish_permission_enum.rb +17 -0
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/session.rb +44 -0
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/subscriptions.rb +54 -0
- metadata +43 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ee38371ece860ee70a08149297e79e58a0ca72a093168951ca8256c6a83e45c
|
4
|
+
data.tar.gz: dc0ab4ad91c207356b662728a700079f2c1aeb965f8b34681463c5c28a4a649d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5823198c1684b55e3505e8439615cef32b6d71745795ad215710760ff58638a3b34db6afaa31a20d495d2a33e620689e8d3644813831f1cb7ad47376513ac07
|
7
|
+
data.tar.gz: 8d4f8f124305b63102cfdb1908897ac521f14f4fcc133562f402dc28f4c9a69eb613765a6e5eb610a3ce0aaf49bcff078c575a2986cb065df750c4b429ab6536
|
data/lib/bandwidth.rb
CHANGED
@@ -39,5 +39,28 @@ 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
|
+
# External Files
|
46
|
+
require_relative 'bandwidth/voice_lib/bxml/bxml.rb'
|
47
|
+
require_relative 'bandwidth/web_rtc_lib/utils/web_rtc_transfer.rb'
|
48
|
+
require_relative 'bandwidth/voice_lib/bxml/verbs/bridge.rb'
|
49
|
+
require_relative 'bandwidth/voice_lib/bxml/verbs/conference.rb'
|
50
|
+
require_relative 'bandwidth/voice_lib/bxml/verbs/forward.rb'
|
51
|
+
require_relative 'bandwidth/voice_lib/bxml/verbs/gather.rb'
|
52
|
+
require_relative 'bandwidth/voice_lib/bxml/verbs/hangup.rb'
|
53
|
+
require_relative 'bandwidth/voice_lib/bxml/verbs/pause.rb'
|
54
|
+
require_relative 'bandwidth/voice_lib/bxml/verbs/pause_recording.rb'
|
55
|
+
require_relative 'bandwidth/voice_lib/bxml/verbs/phone_number.rb'
|
56
|
+
require_relative 'bandwidth/voice_lib/bxml/verbs/play_audio.rb'
|
57
|
+
require_relative 'bandwidth/voice_lib/bxml/verbs/record.rb'
|
58
|
+
require_relative 'bandwidth/voice_lib/bxml/verbs/redirect.rb'
|
59
|
+
require_relative 'bandwidth/voice_lib/bxml/verbs/resume_recording.rb'
|
60
|
+
require_relative 'bandwidth/voice_lib/bxml/verbs/ring.rb'
|
61
|
+
require_relative 'bandwidth/voice_lib/bxml/verbs/send_dtmf.rb'
|
62
|
+
require_relative 'bandwidth/voice_lib/bxml/verbs/speak_sentence.rb'
|
63
|
+
require_relative 'bandwidth/voice_lib/bxml/verbs/start_recording.rb'
|
64
|
+
require_relative 'bandwidth/voice_lib/bxml/verbs/stop_recording.rb'
|
65
|
+
require_relative 'bandwidth/voice_lib/bxml/verbs/transfer.rb'
|
66
|
+
require_relative 'bandwidth/voice_lib/bxml/verbs/xml_verb.rb'
|
data/lib/bandwidth/api_helper.rb
CHANGED
@@ -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
|
-
|
45
|
-
|
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
|
-
|
52
|
-
|
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 =
|
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.
|
data/lib/bandwidth/client.rb
CHANGED
@@ -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',
|
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
|
-
|
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',
|
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(
|
80
|
-
|
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(
|
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(
|
363
|
+
ApiResponse.new(
|
364
|
+
_response, data: BandwidthMessage.from_hash(decoded)
|
365
|
+
)
|
360
366
|
end
|
361
367
|
end
|
362
368
|
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',
|
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
|