Skip to content

Commit 466779f

Browse files
authored
DX-2472 Add priority to createCall (#48)
* DX-2472 Add `priority` to `createCall` * @_hash * Apply suggestions from code review * update version
1 parent 0b19c4f commit 466779f

File tree

4 files changed

+38
-80
lines changed

4 files changed

+38
-80
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 = '9.1.2'
3+
s.version = '9.2.0'
44
s.summary = 'Bandwidth'
55
s.description = 'The official client SDK for Bandwidht\'s Voice, Messaging, MFA, and WebRTC APIs'
66
s.authors = ['Bandwidth']

lib/bandwidth/voice_lib/voice/models/create_call_request.rb

Lines changed: 12 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -25,126 +25,54 @@ class CreateCallRequest < BaseModel
2525
# @return [String]
2626
attr_accessor :uui
2727

28-
# A comma-separated list of 'User-To-User' headers to be sent in the INVITE
29-
# when calling a SIP URI. Each value must end with an 'encoding' parameter
30-
# as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
31-
# 'base64' encodings are allowed. The entire value cannot exceed 350
32-
# characters, including parameters and separators.
3328
# @return [Float]
3429
attr_accessor :call_timeout
3530

36-
# A comma-separated list of 'User-To-User' headers to be sent in the INVITE
37-
# when calling a SIP URI. Each value must end with an 'encoding' parameter
38-
# as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
39-
# 'base64' encodings are allowed. The entire value cannot exceed 350
40-
# characters, including parameters and separators.
4131
# @return [Float]
4232
attr_accessor :callback_timeout
4333

44-
# A comma-separated list of 'User-To-User' headers to be sent in the INVITE
45-
# when calling a SIP URI. Each value must end with an 'encoding' parameter
46-
# as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
47-
# 'base64' encodings are allowed. The entire value cannot exceed 350
48-
# characters, including parameters and separators.
4934
# @return [String]
5035
attr_accessor :answer_url
5136

52-
# A comma-separated list of 'User-To-User' headers to be sent in the INVITE
53-
# when calling a SIP URI. Each value must end with an 'encoding' parameter
54-
# as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
55-
# 'base64' encodings are allowed. The entire value cannot exceed 350
56-
# characters, including parameters and separators.
5737
# @return [String]
5838
attr_accessor :answer_fallback_url
5939

60-
# A comma-separated list of 'User-To-User' headers to be sent in the INVITE
61-
# when calling a SIP URI. Each value must end with an 'encoding' parameter
62-
# as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
63-
# 'base64' encodings are allowed. The entire value cannot exceed 350
64-
# characters, including parameters and separators.
6540
# @return [String]
6641
attr_accessor :username
6742

68-
# A comma-separated list of 'User-To-User' headers to be sent in the INVITE
69-
# when calling a SIP URI. Each value must end with an 'encoding' parameter
70-
# as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
71-
# 'base64' encodings are allowed. The entire value cannot exceed 350
72-
# characters, including parameters and separators.
7343
# @return [String]
7444
attr_accessor :password
7545

76-
# A comma-separated list of 'User-To-User' headers to be sent in the INVITE
77-
# when calling a SIP URI. Each value must end with an 'encoding' parameter
78-
# as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
79-
# 'base64' encodings are allowed. The entire value cannot exceed 350
80-
# characters, including parameters and separators.
8146
# @return [String]
8247
attr_accessor :fallback_username
8348

84-
# A comma-separated list of 'User-To-User' headers to be sent in the INVITE
85-
# when calling a SIP URI. Each value must end with an 'encoding' parameter
86-
# as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
87-
# 'base64' encodings are allowed. The entire value cannot exceed 350
88-
# characters, including parameters and separators.
8949
# @return [String]
9050
attr_accessor :fallback_password
9151

92-
# A comma-separated list of 'User-To-User' headers to be sent in the INVITE
93-
# when calling a SIP URI. Each value must end with an 'encoding' parameter
94-
# as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
95-
# 'base64' encodings are allowed. The entire value cannot exceed 350
96-
# characters, including parameters and separators.
9752
# @return [AnswerMethodEnum]
9853
attr_accessor :answer_method
9954

100-
# A comma-separated list of 'User-To-User' headers to be sent in the INVITE
101-
# when calling a SIP URI. Each value must end with an 'encoding' parameter
102-
# as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
103-
# 'base64' encodings are allowed. The entire value cannot exceed 350
104-
# characters, including parameters and separators.
10555
# @return [AnswerFallbackMethodEnum]
10656
attr_accessor :answer_fallback_method
10757

108-
# A comma-separated list of 'User-To-User' headers to be sent in the INVITE
109-
# when calling a SIP URI. Each value must end with an 'encoding' parameter
110-
# as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
111-
# 'base64' encodings are allowed. The entire value cannot exceed 350
112-
# characters, including parameters and separators.
11358
# @return [String]
11459
attr_accessor :disconnect_url
11560

116-
# A comma-separated list of 'User-To-User' headers to be sent in the INVITE
117-
# when calling a SIP URI. Each value must end with an 'encoding' parameter
118-
# as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
119-
# 'base64' encodings are allowed. The entire value cannot exceed 350
120-
# characters, including parameters and separators.
12161
# @return [DisconnectMethodEnum]
12262
attr_accessor :disconnect_method
12363

124-
# A comma-separated list of 'User-To-User' headers to be sent in the INVITE
125-
# when calling a SIP URI. Each value must end with an 'encoding' parameter
126-
# as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
127-
# 'base64' encodings are allowed. The entire value cannot exceed 350
128-
# characters, including parameters and separators.
12964
# @return [String]
13065
attr_accessor :tag
13166

132-
# A comma-separated list of 'User-To-User' headers to be sent in the INVITE
133-
# when calling a SIP URI. Each value must end with an 'encoding' parameter
134-
# as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
135-
# 'base64' encodings are allowed. The entire value cannot exceed 350
136-
# characters, including parameters and separators.
13767
# @return [String]
13868
attr_accessor :application_id
13969

140-
# A comma-separated list of 'User-To-User' headers to be sent in the INVITE
141-
# when calling a SIP URI. Each value must end with an 'encoding' parameter
142-
# as described in https://tools.ietf.org/html/rfc7433. Only 'jwt' and
143-
# 'base64' encodings are allowed. The entire value cannot exceed 350
144-
# characters, including parameters and separators.
14570
# @return [MachineDetectionRequest]
14671
attr_accessor :machine_detection
14772

73+
# @return [Integer]
74+
attr_accessor :priority
75+
14876
# A mapping from model property names to API property names.
14977
def self.names
15078
@_hash = {} if @_hash.nil?
@@ -166,6 +94,7 @@ def self.names
16694
@_hash['tag'] = 'tag'
16795
@_hash['application_id'] = 'applicationId'
16896
@_hash['machine_detection'] = 'machineDetection'
97+
@_hash['priority'] = 'priority'
16998
@_hash
17099
end
171100

@@ -186,6 +115,7 @@ def optionals
186115
disconnect_method
187116
tag
188117
machine_detection
118+
priority
189119
]
190120
end
191121

@@ -205,6 +135,7 @@ def nullables
205135
disconnect_url
206136
disconnect_method
207137
tag
138+
priority
208139
]
209140
end
210141

@@ -225,7 +156,8 @@ def initialize(from = nil,
225156
disconnect_url = nil,
226157
disconnect_method = nil,
227158
tag = nil,
228-
machine_detection = nil)
159+
machine_detection = nil,
160+
priority = nil)
229161
@from = from unless from == SKIP
230162
@to = to unless to == SKIP
231163
@uui = uui unless uui == SKIP
@@ -244,6 +176,7 @@ def initialize(from = nil,
244176
@tag = tag unless tag == SKIP
245177
@application_id = application_id unless application_id == SKIP
246178
@machine_detection = machine_detection unless machine_detection == SKIP
179+
@priority = priority unless priority == SKIP
247180
end
248181

249182
# Creates an instance of the object from a hash.
@@ -276,6 +209,7 @@ def self.from_hash(hash)
276209
tag = hash.key?('tag') ? hash['tag'] : SKIP
277210
machine_detection = MachineDetectionConfiguration.from_hash(hash['machineDetection']) if
278211
hash['machineDetection']
212+
priority = hash.key?('priority') ? hash['priority'] : SKIP
279213

280214
# Create object from extracted values.
281215
CreateCallRequest.new(from,
@@ -295,7 +229,8 @@ def self.from_hash(hash)
295229
disconnect_url,
296230
disconnect_method,
297231
tag,
298-
machine_detection)
232+
machine_detection,
233+
priority)
299234
end
300235
end
301236
end

lib/bandwidth/voice_lib/voice/models/create_call_response.rb

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ class CreateCallResponse < BaseModel
9090
# @return [String]
9191
attr_accessor :tag
9292

93+
# @return [Integer]
94+
attr_accessor :priority
95+
9396
# A mapping from model property names to API property names.
9497
def self.names
9598
@_hash = {} if @_hash.nil?
@@ -113,6 +116,7 @@ def self.names
113116
@_hash['fallback_username'] = 'fallbackUsername'
114117
@_hash['fallback_password'] = 'fallbackPassword'
115118
@_hash['tag'] = 'tag'
119+
@_hash['priority'] = 'priority'
116120
@_hash
117121
end
118122

@@ -130,6 +134,7 @@ def optionals
130134
fallback_username
131135
fallback_password
132136
tag
137+
priority
133138
]
134139
end
135140

@@ -145,6 +150,7 @@ def nullables
145150
fallback_username
146151
fallback_password
147152
tag
153+
priority
148154
]
149155
end
150156

@@ -167,7 +173,8 @@ def initialize(account_id = nil,
167173
password = nil,
168174
fallback_username = nil,
169175
fallback_password = nil,
170-
tag = nil)
176+
tag = nil,
177+
priority = nil)
171178
@account_id = account_id unless account_id == SKIP
172179
@call_id = call_id unless call_id == SKIP
173180
@application_id = application_id unless application_id == SKIP
@@ -188,6 +195,7 @@ def initialize(account_id = nil,
188195
@fallback_username = fallback_username unless fallback_username == SKIP
189196
@fallback_password = fallback_password unless fallback_password == SKIP
190197
@tag = tag unless tag == SKIP
198+
@priority = priority unless priority == SKIP
191199
end
192200

193201
# Creates an instance of the object from a hash.
@@ -225,6 +233,7 @@ def self.from_hash(hash)
225233
fallback_password =
226234
hash.key?('fallbackPassword') ? hash['fallbackPassword'] : SKIP
227235
tag = hash.key?('tag') ? hash['tag'] : SKIP
236+
priority = hash.key?('priority') ? hash['priority'] : SKIP
228237

229238
# Create object from extracted values.
230239
CreateCallResponse.new(account_id,
@@ -246,7 +255,8 @@ def self.from_hash(hash)
246255
password,
247256
fallback_username,
248257
fallback_password,
249-
tag)
258+
tag,
259+
priority)
250260
end
251261

252262
def to_start_time

test/integration/test_integration.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,19 @@ def test_create_call_with_amd_and_get_call_state
143143
assert(response.data.state.length > 0, "state value not set")
144144
end
145145

146+
def test_create_call_with_priority
147+
body = CreateCallRequest.new
148+
body.from = BW_NUMBER
149+
body.to = USER_NUMBER
150+
body.application_id = BW_VOICE_APPLICATION_ID
151+
body.answer_url = BASE_CALLBACK_URL
152+
body.priority = 1
153+
154+
response = @bandwidth_client.voice_client.client.create_call(BW_ACCOUNT_ID, body)
155+
assert(response.data.call_id.length > 0, "call_id value not set")
156+
assert(response.data.priority == 1, "priority not set")
157+
end
158+
146159
def test_create_call_invalid_phone_number
147160
body = CreateCallRequest.new
148161
body.from = BW_NUMBER

0 commit comments

Comments
 (0)