bandwidth-sdk 9.1.0 → 9.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 72d08e72e19066da912c18946e2bcb7e38c3da78f58005388dd2a6d1b8bc98da
4
- data.tar.gz: 26a7f5cd86a6a3ea974062f66de43b7edee59bf1e7f74fb2ec6e5272a22cdbea
3
+ metadata.gz: 063a9c96b344ab96b6b6717599921eed06e2e2cb8fffb2081b6e88da34d0883e
4
+ data.tar.gz: 5fbba072d5895a00208b1ae54451f05f01fc7b34c5eff381b34cd286bba65363
5
5
  SHA512:
6
- metadata.gz: cfa230d51fe36a6c513821b05975e1d28a0a14f70e326cd802c20788cbc966f20405f9d3c82e478e2c0095b7ffedda699050d981986e50eecad4716c4c525453
7
- data.tar.gz: e99889889de6d0893da79e616aa9cce33dcc76395c692258c0dfb98f0cde7e38d7901579dd9542acd1e0594ebf0dde25407a5c06be09307fea30ea07197ba04e
6
+ metadata.gz: '08f682f87864b61e67fed4badf7469d2e18ce260a0c592131ae5964e133d48418f10806baddaad4d636fa9d5b8d0436d7d4b9b9dc1a1f8ed12b56991932ac71d'
7
+ data.tar.gz: f047132f1527a0f4e4e794d6cfd4e1dee6b6adc732ca8bce596c35f394de77636719a154eb45f2a4144a23db596b4263e330a228d5d81d7f942ae584c759edbc
@@ -144,6 +144,7 @@ module Bandwidth
144
144
  # Parses JSON string.
145
145
  # @param [String] A JSON string.
146
146
  def self.json_deserialize(json)
147
+ return {} if json.nil? || json.empty?
147
148
  JSON.parse(json)
148
149
  rescue StandardError
149
150
  raise TypeError, 'Server responded with invalid JSON.'
@@ -590,15 +590,9 @@ module Voice
590
590
  )
591
591
  _query_url = APIHelper.clean_url _query_builder
592
592
 
593
- # Prepare headers.
594
- _headers = {
595
- 'accept' => 'application/json'
596
- }
597
-
598
593
  # Prepare and execute HttpRequest.
599
594
  _request = config.http_client.get(
600
- _query_url,
601
- headers: _headers
595
+ _query_url
602
596
  )
603
597
  VoiceBasicAuth.apply(config, _request)
604
598
  _response = execute_request(_request)
@@ -648,11 +642,8 @@ module Voice
648
642
  validate_response(_response)
649
643
 
650
644
  # Return appropriate response type.
651
- decoded = APIHelper.json_deserialize(_response.raw_body) unless
652
- _response.raw_body.nil? ||
653
- _response.raw_body.to_s.strip.empty?
654
645
  ApiResponse.new(
655
- _response, data: decoded
646
+ _response, data: _response.raw_body
656
647
  )
657
648
  end
658
649
 
@@ -25,126 +25,54 @@ module Bandwidth
25
25
  # @return [String]
26
26
  attr_accessor :uui
27
27
 
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.
33
28
  # @return [Float]
34
29
  attr_accessor :call_timeout
35
30
 
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.
41
31
  # @return [Float]
42
32
  attr_accessor :callback_timeout
43
33
 
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.
49
34
  # @return [String]
50
35
  attr_accessor :answer_url
51
36
 
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.
57
37
  # @return [String]
58
38
  attr_accessor :answer_fallback_url
59
39
 
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.
65
40
  # @return [String]
66
41
  attr_accessor :username
67
42
 
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.
73
43
  # @return [String]
74
44
  attr_accessor :password
75
45
 
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.
81
46
  # @return [String]
82
47
  attr_accessor :fallback_username
83
48
 
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.
89
49
  # @return [String]
90
50
  attr_accessor :fallback_password
91
51
 
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.
97
52
  # @return [AnswerMethodEnum]
98
53
  attr_accessor :answer_method
99
54
 
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.
105
55
  # @return [AnswerFallbackMethodEnum]
106
56
  attr_accessor :answer_fallback_method
107
57
 
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.
113
58
  # @return [String]
114
59
  attr_accessor :disconnect_url
115
60
 
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.
121
61
  # @return [DisconnectMethodEnum]
122
62
  attr_accessor :disconnect_method
123
63
 
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.
129
64
  # @return [String]
130
65
  attr_accessor :tag
131
66
 
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.
137
67
  # @return [String]
138
68
  attr_accessor :application_id
139
69
 
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.
145
70
  # @return [MachineDetectionRequest]
146
71
  attr_accessor :machine_detection
147
72
 
73
+ # @return [Integer]
74
+ attr_accessor :priority
75
+
148
76
  # A mapping from model property names to API property names.
149
77
  def self.names
150
78
  @_hash = {} if @_hash.nil?
@@ -166,6 +94,7 @@ module Bandwidth
166
94
  @_hash['tag'] = 'tag'
167
95
  @_hash['application_id'] = 'applicationId'
168
96
  @_hash['machine_detection'] = 'machineDetection'
97
+ @_hash['priority'] = 'priority'
169
98
  @_hash
170
99
  end
171
100
 
@@ -186,6 +115,7 @@ module Bandwidth
186
115
  disconnect_method
187
116
  tag
188
117
  machine_detection
118
+ priority
189
119
  ]
190
120
  end
191
121
 
@@ -205,6 +135,7 @@ module Bandwidth
205
135
  disconnect_url
206
136
  disconnect_method
207
137
  tag
138
+ priority
208
139
  ]
209
140
  end
210
141
 
@@ -225,7 +156,8 @@ module Bandwidth
225
156
  disconnect_url = nil,
226
157
  disconnect_method = nil,
227
158
  tag = nil,
228
- machine_detection = nil)
159
+ machine_detection = nil,
160
+ priority = nil)
229
161
  @from = from unless from == SKIP
230
162
  @to = to unless to == SKIP
231
163
  @uui = uui unless uui == SKIP
@@ -244,6 +176,7 @@ module Bandwidth
244
176
  @tag = tag unless tag == SKIP
245
177
  @application_id = application_id unless application_id == SKIP
246
178
  @machine_detection = machine_detection unless machine_detection == SKIP
179
+ @priority = priority unless priority == SKIP
247
180
  end
248
181
 
249
182
  # Creates an instance of the object from a hash.
@@ -276,6 +209,7 @@ module Bandwidth
276
209
  tag = hash.key?('tag') ? hash['tag'] : SKIP
277
210
  machine_detection = MachineDetectionConfiguration.from_hash(hash['machineDetection']) if
278
211
  hash['machineDetection']
212
+ priority = hash.key?('priority') ? hash['priority'] : SKIP
279
213
 
280
214
  # Create object from extracted values.
281
215
  CreateCallRequest.new(from,
@@ -295,7 +229,8 @@ module Bandwidth
295
229
  disconnect_url,
296
230
  disconnect_method,
297
231
  tag,
298
- machine_detection)
232
+ machine_detection,
233
+ priority)
299
234
  end
300
235
  end
301
236
  end
@@ -90,6 +90,9 @@ module Bandwidth
90
90
  # @return [String]
91
91
  attr_accessor :tag
92
92
 
93
+ # @return [Integer]
94
+ attr_accessor :priority
95
+
93
96
  # A mapping from model property names to API property names.
94
97
  def self.names
95
98
  @_hash = {} if @_hash.nil?
@@ -113,6 +116,7 @@ module Bandwidth
113
116
  @_hash['fallback_username'] = 'fallbackUsername'
114
117
  @_hash['fallback_password'] = 'fallbackPassword'
115
118
  @_hash['tag'] = 'tag'
119
+ @_hash['priority'] = 'priority'
116
120
  @_hash
117
121
  end
118
122
 
@@ -130,6 +134,7 @@ module Bandwidth
130
134
  fallback_username
131
135
  fallback_password
132
136
  tag
137
+ priority
133
138
  ]
134
139
  end
135
140
 
@@ -145,6 +150,7 @@ module Bandwidth
145
150
  fallback_username
146
151
  fallback_password
147
152
  tag
153
+ priority
148
154
  ]
149
155
  end
150
156
 
@@ -167,7 +173,8 @@ module Bandwidth
167
173
  password = nil,
168
174
  fallback_username = nil,
169
175
  fallback_password = nil,
170
- tag = nil)
176
+ tag = nil,
177
+ priority = nil)
171
178
  @account_id = account_id unless account_id == SKIP
172
179
  @call_id = call_id unless call_id == SKIP
173
180
  @application_id = application_id unless application_id == SKIP
@@ -188,6 +195,7 @@ module Bandwidth
188
195
  @fallback_username = fallback_username unless fallback_username == SKIP
189
196
  @fallback_password = fallback_password unless fallback_password == SKIP
190
197
  @tag = tag unless tag == SKIP
198
+ @priority = priority unless priority == SKIP
191
199
  end
192
200
 
193
201
  # Creates an instance of the object from a hash.
@@ -225,6 +233,7 @@ module Bandwidth
225
233
  fallback_password =
226
234
  hash.key?('fallbackPassword') ? hash['fallbackPassword'] : SKIP
227
235
  tag = hash.key?('tag') ? hash['tag'] : SKIP
236
+ priority = hash.key?('priority') ? hash['priority'] : SKIP
228
237
 
229
238
  # Create object from extracted values.
230
239
  CreateCallResponse.new(account_id,
@@ -246,7 +255,8 @@ module Bandwidth
246
255
  password,
247
256
  fallback_username,
248
257
  fallback_password,
249
- tag)
258
+ tag,
259
+ priority)
250
260
  end
251
261
 
252
262
  def to_start_time
@@ -38,6 +38,17 @@ class IntegrationTest < Test::Unit::TestCase
38
38
  phone_number_lookup_basic_auth_user_name: BW_USERNAME,
39
39
  phone_number_lookup_basic_auth_password: BW_PASSWORD
40
40
  )
41
+
42
+ @bandwidth_client_invalid_auth = Bandwidth::Client.new(
43
+ voice_basic_auth_user_name: "bad_username",
44
+ voice_basic_auth_password: "bad_password",
45
+ messaging_basic_auth_user_name: "bad_username",
46
+ messaging_basic_auth_password: "bad_password",
47
+ multi_factor_auth_basic_auth_user_name: "bad_username",
48
+ multi_factor_auth_basic_auth_password: "bad_password",
49
+ phone_number_lookup_basic_auth_user_name: "bad_username",
50
+ phone_number_lookup_basic_auth_password: "bad_password"
51
+ )
41
52
  end
42
53
 
43
54
  def test_create_message
@@ -79,6 +90,19 @@ class IntegrationTest < Test::Unit::TestCase
79
90
  assert_equal(downloaded_media, media, "Downloaded media file not equal to upload")
80
91
  end
81
92
 
93
+ def test_get_message
94
+ # Send a successful request to the GET messages API
95
+ response = @bandwidth_client.messaging_client.client.get_messages(BW_ACCOUNT_ID, :message_id => "abc123")
96
+ assert_equal(response.status_code, 200, "API did not return a 200 OK")
97
+ end
98
+
99
+ def test_get_message_invalid_auth
100
+ # Send an unsuccessful request to the GET messages API
101
+ assert_raise MessagingException do
102
+ response = @bandwidth_client_invalid_auth.messaging_client.client.get_messages(BW_ACCOUNT_ID)
103
+ end
104
+ end
105
+
82
106
  def test_create_call_and_get_call_state
83
107
  body = CreateCallRequest.new
84
108
  body.from = BW_NUMBER
@@ -89,6 +113,7 @@ class IntegrationTest < Test::Unit::TestCase
89
113
  assert(response.data.call_id.length > 0, "call_id value not set")
90
114
 
91
115
  #Get phone call information
116
+ sleep 1
92
117
  response = @bandwidth_client.voice_client.client.get_call(BW_ACCOUNT_ID, response.data.call_id)
93
118
  assert(response.data.state.length > 0, "state value not set")
94
119
  end
@@ -118,6 +143,19 @@ class IntegrationTest < Test::Unit::TestCase
118
143
  assert(response.data.state.length > 0, "state value not set")
119
144
  end
120
145
 
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
+
121
159
  def test_create_call_invalid_phone_number
122
160
  body = CreateCallRequest.new
123
161
  body.from = BW_NUMBER
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bandwidth-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.1.0
4
+ version: 9.2.0
5
5
  platform: ruby
6
6
  authors:
7
- - APIMatic SDK Generator
7
+ - Bandwidth
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-09 00:00:00.000000000 Z
11
+ date: 2022-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logging
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: '1.0'
34
34
  - - "<="
35
35
  - !ruby/object:Gem::Version
36
- version: 1.3.0
36
+ version: 1.9.3
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '1.0'
44
44
  - - "<="
45
45
  - !ruby/object:Gem::Version
46
- version: 1.3.0
46
+ version: 1.9.3
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: faraday_middleware
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -140,8 +140,9 @@ dependencies:
140
140
  - - "~>"
141
141
  - !ruby/object:Gem::Version
142
142
  version: '1.0'
143
- description: Bandwidth's set of APIs
144
- email: support@apimatic.io
143
+ description: The official client SDK for Bandwidht's Voice, Messaging, MFA, and WebRTC
144
+ APIs
145
+ email: dx@bandwidth.com
145
146
  executables: []
146
147
  extensions: []
147
148
  extra_rdoc_files: []
@@ -283,7 +284,7 @@ files:
283
284
  - test/http_response_catcher.rb
284
285
  - test/integration/test_integration.rb
285
286
  - test/test_helper.rb
286
- homepage: https://apimatic.io
287
+ homepage: https://github.com/Bandwidth/ruby-sdk
287
288
  licenses:
288
289
  - MIT
289
290
  metadata: {}
@@ -302,7 +303,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
302
303
  - !ruby/object:Gem::Version
303
304
  version: '0'
304
305
  requirements: []
305
- rubygems_version: 3.2.22
306
+ rubygems_version: 3.3.7
306
307
  signing_key:
307
308
  specification_version: 4
308
309
  summary: Bandwidth