bandwidth-sdk 18.3.1 → 19.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +13 -13
  3. data/README.md +1 -10
  4. data/Rakefile +1 -1
  5. data/bandwidth.yml +285 -109
  6. data/coverage/.last_run.json +1 -1
  7. data/coverage/.resultset.json +1400 -1051
  8. data/coverage/index.html +20186 -16225
  9. data/custom_templates/api_client.mustache +3 -1
  10. data/custom_templates/configuration.mustache +18 -12
  11. data/custom_templates/gem.mustache +2 -2
  12. data/docs/Callback.md +1 -0
  13. data/docs/CallsApi.md +5 -25
  14. data/docs/ConferencesApi.md +9 -45
  15. data/docs/DisconnectCallback.md +6 -2
  16. data/docs/EndpointsApi.md +5 -25
  17. data/docs/InboundCallback.md +1 -1
  18. data/docs/InboundCallbackMessage.md +2 -0
  19. data/docs/InitiateCallback.md +1 -1
  20. data/docs/LookupResult.md +2 -2
  21. data/docs/MFAApi.md +3 -15
  22. data/docs/MediaApi.md +4 -20
  23. data/docs/Message.md +1 -1
  24. data/docs/MessagesApi.md +2 -10
  25. data/docs/MultiChannelAction.md +3 -3
  26. data/docs/MultiChannelActionCalendarEvent.md +3 -3
  27. data/docs/MultiChannelApi.md +1 -5
  28. data/docs/PhoneNumberLookupApi.md +3 -15
  29. data/docs/RbmActionBase.md +3 -3
  30. data/docs/RbmActionDial.md +3 -3
  31. data/docs/RbmActionOpenUrl.md +3 -3
  32. data/docs/RbmActionViewLocation.md +3 -3
  33. data/docs/RbmSession.md +26 -0
  34. data/docs/RbmSuggestionResponse.md +4 -4
  35. data/docs/RecordingsApi.md +10 -50
  36. data/docs/StatisticsApi.md +1 -5
  37. data/docs/StatusCallback.md +2 -2
  38. data/docs/StatusCallbackMessage.md +3 -1
  39. data/docs/TollFreeVerificationApi.md +9 -45
  40. data/docs/TranscriptionsApi.md +3 -15
  41. data/docs/TransferDisconnectCallback.md +7 -1
  42. data/lib/bandwidth-sdk/api/calls_api.rb +5 -5
  43. data/lib/bandwidth-sdk/api/conferences_api.rb +9 -9
  44. data/lib/bandwidth-sdk/api/endpoints_api.rb +5 -5
  45. data/lib/bandwidth-sdk/api/media_api.rb +4 -4
  46. data/lib/bandwidth-sdk/api/messages_api.rb +2 -2
  47. data/lib/bandwidth-sdk/api/mfa_api.rb +3 -3
  48. data/lib/bandwidth-sdk/api/multi_channel_api.rb +1 -1
  49. data/lib/bandwidth-sdk/api/phone_number_lookup_api.rb +3 -3
  50. data/lib/bandwidth-sdk/api/recordings_api.rb +10 -10
  51. data/lib/bandwidth-sdk/api/statistics_api.rb +1 -1
  52. data/lib/bandwidth-sdk/api/toll_free_verification_api.rb +9 -9
  53. data/lib/bandwidth-sdk/api/transcriptions_api.rb +3 -3
  54. data/lib/bandwidth-sdk/api_client.rb +3 -1
  55. data/lib/bandwidth-sdk/configuration.rb +18 -19
  56. data/lib/bandwidth-sdk/models/callback.rb +1 -0
  57. data/lib/bandwidth-sdk/models/disconnect_callback.rb +27 -5
  58. data/lib/bandwidth-sdk/models/inbound_callback_message.rb +10 -1
  59. data/lib/bandwidth-sdk/models/initiate_callback.rb +1 -1
  60. data/lib/bandwidth-sdk/models/list_message_item.rb +1 -0
  61. data/lib/bandwidth-sdk/models/multi_channel_action_calendar_event.rb +1 -1
  62. data/lib/bandwidth-sdk/models/rbm_action_base.rb +1 -1
  63. data/lib/bandwidth-sdk/models/rbm_action_dial.rb +1 -1
  64. data/lib/bandwidth-sdk/models/rbm_action_open_url.rb +1 -1
  65. data/lib/bandwidth-sdk/models/rbm_action_view_location.rb +1 -1
  66. data/lib/bandwidth-sdk/models/rbm_session.rb +208 -0
  67. data/lib/bandwidth-sdk/models/rbm_suggestion_response.rb +2 -2
  68. data/lib/bandwidth-sdk/models/status_callback_message.rb +13 -4
  69. data/lib/bandwidth-sdk/models/status_callback_type_enum.rb +2 -1
  70. data/lib/bandwidth-sdk/models/transfer_disconnect_callback.rb +37 -5
  71. data/lib/bandwidth-sdk/version.rb +1 -1
  72. data/lib/bandwidth-sdk.rb +3 -2
  73. data/spec/smoke/calls_api_spec.rb +46 -46
  74. data/spec/smoke/conferences_api_spec.rb +1 -1
  75. data/spec/smoke/endpoints_api_spec.rb +2 -31
  76. data/spec/smoke/media_api_spec.rb +2 -0
  77. data/spec/smoke/messages_api_spec.rb +2 -24
  78. data/spec/smoke/mfa_api_spec.rb +4 -27
  79. data/spec/smoke/multi_channel_api_spec.rb +4 -2
  80. data/spec/smoke/phone_number_lookup_api_spec.rb +2 -0
  81. data/spec/smoke/recordings_api_spec.rb +1 -1
  82. data/spec/smoke/smoke_helper.rb +41 -0
  83. data/spec/smoke/statistics_api_spec.rb +2 -37
  84. data/spec/smoke/toll_free_verification_api_spec.rb +2 -0
  85. data/spec/smoke/transcriptions_api_spec.rb +1 -1
  86. data/spec/spec_helper.rb +0 -48
  87. data/spec/unit/api/calls_api_spec.rb +3 -1
  88. data/spec/unit/api/conferences_api_spec.rb +2 -0
  89. data/spec/unit/api/endpoints_api_spec.rb +2 -0
  90. data/spec/unit/api/media_api_spec.rb +2 -0
  91. data/spec/unit/api/messages_api_spec.rb +2 -0
  92. data/spec/unit/api/mfa_api_spec.rb +2 -0
  93. data/spec/unit/api/multi_channel_api_spec.rb +2 -0
  94. data/spec/unit/api/phone_number_lookup_api_spec.rb +2 -0
  95. data/spec/unit/api/recordings_api_spec.rb +2 -0
  96. data/spec/unit/api/statistics_api_spec.rb +2 -0
  97. data/spec/unit/api/toll_free_verification_api_spec.rb +2 -0
  98. data/spec/unit/api/transcriptions_api_spec.rb +2 -0
  99. data/spec/unit/client/api_client_spec.rb +70 -206
  100. data/spec/unit/client/configuration_spec.rb +22 -17
  101. data/spec/unit/constants.rb +6 -0
  102. data/spec/unit/models/callback_spec.rb +1 -0
  103. data/spec/unit/models/disconnect_callback_spec.rb +10 -2
  104. data/spec/unit/models/inbound_callback_message_spec.rb +20 -5
  105. data/spec/unit/models/list_message_item_spec.rb +1 -0
  106. data/spec/unit/models/rbm_session_spec.rb +95 -0
  107. data/spec/unit/models/status_callback_message_spec.rb +20 -5
  108. data/spec/unit/models/status_callback_type_enum_spec.rb +7 -1
  109. data/spec/unit/models/transfer_disconnect_callback_spec.rb +16 -4
  110. metadata +9 -1
@@ -20,9 +20,10 @@ module Bandwidth
20
20
  MESSAGE_DELIVERED = 'message-delivered'.freeze
21
21
  MESSAGE_FAILED = 'message-failed'.freeze
22
22
  MESSAGE_READ = 'message-read'.freeze
23
+ SESSION_STARTED = 'session-started'.freeze
23
24
 
24
25
  def self.all_vars
25
- @all_vars ||= [MESSAGE_SENDING, MESSAGE_SENT, MESSAGE_DELIVERED, MESSAGE_FAILED, MESSAGE_READ].freeze
26
+ @all_vars ||= [MESSAGE_SENDING, MESSAGE_SENT, MESSAGE_DELIVERED, MESSAGE_FAILED, MESSAGE_READ, SESSION_STARTED].freeze
26
27
  end
27
28
 
28
29
  # Builds the enum from string
@@ -75,6 +75,15 @@ module Bandwidth
75
75
  # Bandwidth's internal id that references the error event.
76
76
  attr_accessor :error_id
77
77
 
78
+ # (optional) The SIP status code of the final response that rejected an outbound call's (or transferred leg's) INVITE (e.g. 486 for busy, 603 for decline). Present only when the call was rejected with a SIP response.
79
+ attr_accessor :sip_response_code
80
+
81
+ # (optional) The full SIP status line, exactly as received, of the final response that rejected an outbound call's INVITE. The reason phrase can help distinguish outcomes that share a status code, such as `603 Network Blocked` and `603 Decline`. Present only when an outbound call was rejected with a SIP response.
82
+ attr_accessor :sip_status_line
83
+
84
+ # (optional) Map of SIP headers, with lowercase keys (SIP headers are case-insensitive). On the Initiate callback, contains the customer-supplied X-* headers from the original INVITE; present only for inbound SIP URI calls with custom headers. On the Disconnect and Transfer Disconnect callbacks, contains a single `reason` key holding the raw, unmodified `Reason` header value from the final SIP response that rejected an outbound call (or transferred leg); present only when that response included a `Reason` header (for example, `v=analytics1` call-analytics block information from a terminating carrier). If the response carries more than one `Reason` header, all values are returned in the order received, separated by `, `. Note - on the Initiate callback, keys preserve the original SIP header name in lowercase rather than Bandwidth's usual camelCase JSON convention, since these are passthrough values from the caller's SIP INVITE, not Bandwidth-defined fields. If the same header name is sent more than once in the INVITE, only the last value is kept. The example shown is for the Initiate callback; on the Disconnect and Transfer Disconnect callbacks the only key is `reason`.
85
+ attr_accessor :sip_headers
86
+
78
87
  class EnumAttributeValidator
79
88
  attr_reader :datatype
80
89
  attr_reader :allowable_values
@@ -119,7 +128,10 @@ module Bandwidth
119
128
  :'transfer_to' => :'transferTo',
120
129
  :'cause' => :'cause',
121
130
  :'error_message' => :'errorMessage',
122
- :'error_id' => :'errorId'
131
+ :'error_id' => :'errorId',
132
+ :'sip_response_code' => :'sipResponseCode',
133
+ :'sip_status_line' => :'sipStatusLine',
134
+ :'sip_headers' => :'sipHeaders'
123
135
  }
124
136
  end
125
137
 
@@ -155,7 +167,10 @@ module Bandwidth
155
167
  :'transfer_to' => :'String',
156
168
  :'cause' => :'String',
157
169
  :'error_message' => :'String',
158
- :'error_id' => :'String'
170
+ :'error_id' => :'String',
171
+ :'sip_response_code' => :'Integer',
172
+ :'sip_status_line' => :'String',
173
+ :'sip_headers' => :'Hash<String, String>'
159
174
  }
160
175
  end
161
176
 
@@ -166,7 +181,7 @@ module Bandwidth
166
181
  :'answer_time',
167
182
  :'tag',
168
183
  :'error_message',
169
- :'error_id'
184
+ :'error_id',
170
185
  ])
171
186
  end
172
187
 
@@ -265,6 +280,20 @@ module Bandwidth
265
280
  if attributes.key?(:'error_id')
266
281
  self.error_id = attributes[:'error_id']
267
282
  end
283
+
284
+ if attributes.key?(:'sip_response_code')
285
+ self.sip_response_code = attributes[:'sip_response_code']
286
+ end
287
+
288
+ if attributes.key?(:'sip_status_line')
289
+ self.sip_status_line = attributes[:'sip_status_line']
290
+ end
291
+
292
+ if attributes.key?(:'sip_headers')
293
+ if (value = attributes[:'sip_headers']).is_a?(Hash)
294
+ self.sip_headers = value
295
+ end
296
+ end
268
297
  end
269
298
 
270
299
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -306,7 +335,10 @@ module Bandwidth
306
335
  transfer_to == o.transfer_to &&
307
336
  cause == o.cause &&
308
337
  error_message == o.error_message &&
309
- error_id == o.error_id
338
+ error_id == o.error_id &&
339
+ sip_response_code == o.sip_response_code &&
340
+ sip_status_line == o.sip_status_line &&
341
+ sip_headers == o.sip_headers
310
342
  end
311
343
 
312
344
  # @see the `==` method
@@ -318,7 +350,7 @@ module Bandwidth
318
350
  # Calculates hash code according to all attributes.
319
351
  # @return [Integer] Hash code
320
352
  def hash
321
- [event_type, event_time, account_id, application_id, from, to, direction, call_id, call_url, parent_call_id, enqueued_time, start_time, answer_time, end_time, tag, transfer_caller_id, transfer_to, cause, error_message, error_id].hash
353
+ [event_type, event_time, account_id, application_id, from, to, direction, call_id, call_url, parent_call_id, enqueued_time, start_time, answer_time, end_time, tag, transfer_caller_id, transfer_to, cause, error_message, error_id, sip_response_code, sip_status_line, sip_headers].hash
322
354
  end
323
355
 
324
356
  # Builds the object from hash
@@ -11,5 +11,5 @@ Generator version: 7.24.0
11
11
  =end
12
12
 
13
13
  module Bandwidth
14
- VERSION = '18.3.1'
14
+ VERSION = '19.0.0'
15
15
  end
data/lib/bandwidth-sdk.rb CHANGED
@@ -164,6 +164,7 @@ require 'bandwidth-sdk/models/rbm_message_content_rich_card'
164
164
  require 'bandwidth-sdk/models/rbm_message_content_text'
165
165
  require 'bandwidth-sdk/models/rbm_message_media'
166
166
  require 'bandwidth-sdk/models/rbm_open_url_enum'
167
+ require 'bandwidth-sdk/models/rbm_session'
167
168
  require 'bandwidth-sdk/models/rbm_standalone_card'
168
169
  require 'bandwidth-sdk/models/rbm_suggestion_response'
169
170
  require 'bandwidth-sdk/models/rbm_web_view_enum'
@@ -276,8 +277,8 @@ module Bandwidth
276
277
  class << self
277
278
  # Customize default settings for the SDK using block.
278
279
  # Bandwidth.configure do |config|
279
- # config.username = "xxx"
280
- # config.password = "xxx"
280
+ # config.client_id = "xxx"
281
+ # config.client_secret = "xxx"
281
282
  # end
282
283
  # If no block given, return the default Configuration object.
283
284
  def configure
@@ -1,4 +1,4 @@
1
- require_relative '../call_utils'
1
+ require_relative 'smoke_helper'
2
2
 
3
3
  # Integration Tests for Bandwidth::CallsApi
4
4
  describe 'CallsApi Integration Tests' do
@@ -83,7 +83,7 @@ describe 'CallsApi Integration Tests' do
83
83
  # Get Calls
84
84
  describe '#list_calls' do
85
85
  it 'gets a list of calls' do
86
- data, status_code = @calls_api_instance.list_calls_with_http_info(BW_ACCOUNT_ID)
86
+ data, status_code = @calls_api_instance.list_calls_with_http_info(BW_ACCOUNT_ID, { to: USER_NUMBER, from: BW_NUMBER })
87
87
 
88
88
  expect(status_code).to eq(200)
89
89
  expect(data).to be_instance_of(Array)
@@ -94,58 +94,58 @@ describe 'CallsApi Integration Tests' do
94
94
  end
95
95
 
96
96
  # Get Call State Information
97
- # describe 'get_call_state' do
98
- # it 'gets the call state' do
99
- # sleep(40) # wait 40s for voice API to update call status
100
- # data, status_code = @calls_api_instance.get_call_state_with_http_info(BW_ACCOUNT_ID, $call_info_id)
101
-
102
- # expect(status_code).to eq(200)
103
- # expect(data).to be_instance_of(Bandwidth::CallState)
104
- # expect(data.call_id).to eq($call_info_id)
105
- # expect(data.account_id).to eq(BW_ACCOUNT_ID)
106
- # expect(data.application_id).to eq(BW_VOICE_APPLICATION_ID)
107
- # expect(data.start_time).to be_instance_of(Time).or be_nil
108
- # expect(data.last_update).to be_instance_of(Time)
109
- # expect(data.state).to be_instance_of(String)
110
- # expect(data.direction).to eq(direction)
111
- # end
112
- # end
97
+ describe 'get_call_state' do
98
+ it 'gets the call state' do
99
+ sleep(40) # wait 40s for voice API to update call status
100
+ data, status_code = @calls_api_instance.get_call_state_with_http_info(BW_ACCOUNT_ID, $call_info_id)
101
+
102
+ expect(status_code).to eq(200)
103
+ expect(data).to be_instance_of(Bandwidth::CallState)
104
+ expect(data.call_id).to eq($call_info_id)
105
+ expect(data.account_id).to eq(BW_ACCOUNT_ID)
106
+ expect(data.application_id).to eq(BW_VOICE_APPLICATION_ID)
107
+ expect(data.start_time).to be_instance_of(Time).or be_nil
108
+ expect(data.last_update).to be_instance_of(Time)
109
+ expect(data.state).to be_instance_of(String)
110
+ expect(data.direction).to eq(direction)
111
+ end
112
+ end
113
113
 
114
114
  # Update Call
115
- # describe 'update_call' do
116
- # it 'creates and updates a call' do
117
- # update_call_body = Bandwidth::UpdateCall.new(
118
- # state: Bandwidth::CallStateEnum::ACTIVE,
119
- # redirect_url: MANTECA_BASE_URL + '/bxml/pause'
120
- # )
115
+ describe 'update_call' do
116
+ it 'creates and updates a call' do
117
+ update_call_body = Bandwidth::UpdateCall.new(
118
+ state: Bandwidth::CallStateEnum::ACTIVE,
119
+ redirect_url: MANTECA_BASE_URL + '/bxml/pause'
120
+ )
121
121
 
122
- # update_call_id = create_manteca_call(@calls_api_instance)
123
- # sleep(SLEEP_TIME_S)
122
+ update_call_id = create_manteca_call(@calls_api_instance)
123
+ sleep(SLEEP_TIME_S)
124
124
 
125
- # _update_data, update_status_code = @calls_api_instance.update_call_with_http_info(BW_ACCOUNT_ID, update_call_id, update_call_body)
126
- # expect(update_status_code).to eq(200)
127
- # sleep(SLEEP_TIME_S)
125
+ _update_data, update_status_code = @calls_api_instance.update_call_with_http_info(BW_ACCOUNT_ID, update_call_id, update_call_body)
126
+ expect(update_status_code).to eq(200)
127
+ sleep(SLEEP_TIME_S)
128
128
 
129
- # _complete_data, complete_status_code = @calls_api_instance.update_call_with_http_info(BW_ACCOUNT_ID, update_call_id, $complete_call_body)
130
- # expect(complete_status_code).to eq(200)
131
- # end
132
- # end
129
+ _complete_data, complete_status_code = @calls_api_instance.update_call_with_http_info(BW_ACCOUNT_ID, update_call_id, $complete_call_body)
130
+ expect(complete_status_code).to eq(200)
131
+ end
132
+ end
133
133
 
134
134
  # Update Call BXML
135
- # describe 'update_call_bxml' do
136
- # it 'updates a call using bxml' do
137
- # update_call_id = create_manteca_call(@calls_api_instance)
138
- # sleep(SLEEP_TIME_S)
139
-
140
- # update_bxml = '<?xml version="1.0" encoding="UTF-8"?><Bxml><SpeakSentence locale="en_US" gender="female" voice="susan">This is a test bxml response</SpeakSentence><Pause duration="3"/></Bxml>'
141
- # _update_data, update_status_code = @calls_api_instance.update_call_bxml_with_http_info(BW_ACCOUNT_ID, update_call_id, update_bxml)
142
- # expect(update_status_code).to eq(204)
143
- # sleep(SLEEP_TIME_S)
135
+ describe 'update_call_bxml' do
136
+ it 'updates a call using bxml' do
137
+ update_call_id = create_manteca_call(@calls_api_instance)
138
+ sleep(SLEEP_TIME_S)
139
+
140
+ update_bxml = '<?xml version="1.0" encoding="UTF-8"?><Bxml><SpeakSentence locale="en_US" gender="female" voice="susan">This is a test bxml response</SpeakSentence><Pause duration="3"/></Bxml>'
141
+ _update_data, update_status_code = @calls_api_instance.update_call_bxml_with_http_info(BW_ACCOUNT_ID, update_call_id, update_bxml)
142
+ expect(update_status_code).to eq(204)
143
+ sleep(SLEEP_TIME_S)
144
144
 
145
- # _complete_data, complete_status_code = @calls_api_instance.update_call_with_http_info(BW_ACCOUNT_ID, update_call_id, $complete_call_body)
146
- # expect(complete_status_code).to eq(200)
147
- # end
148
- # end
145
+ _complete_data, complete_status_code = @calls_api_instance.update_call_with_http_info(BW_ACCOUNT_ID, update_call_id, $complete_call_body)
146
+ expect(complete_status_code).to eq(200)
147
+ end
148
+ end
149
149
 
150
150
  # HTTP 4XX Errors
151
151
  describe 'http error' do
@@ -1,4 +1,4 @@
1
- require_relative '../call_utils'
1
+ require_relative 'smoke_helper'
2
2
 
3
3
  # Integration Tests for Bandwidth::ConferencesApi
4
4
  describe 'ConferencesApi Integration Tests' do
@@ -1,3 +1,5 @@
1
+ require_relative 'smoke_helper'
2
+
1
3
  # Integration Tests for Bandwidth::EndpointsApi
2
4
  describe 'EndpointsApi Integration Tests' do
3
5
  before(:all) do
@@ -9,14 +11,6 @@ describe 'EndpointsApi Integration Tests' do
9
11
  client = Bandwidth::ApiClient.new(config)
10
12
  @endpoints_api_instance = Bandwidth::EndpointsApi.new(client)
11
13
 
12
- unauthorized_config = Bandwidth::Configuration.new
13
- unauthorized_config.configure do |config|
14
- config.username = UNAUTHORIZED_USERNAME
15
- config.password = UNAUTHORIZED_PASSWORD
16
- end
17
- unauthorized_client = Bandwidth::ApiClient.new(unauthorized_config)
18
- @unauthorized_api_instance = Bandwidth::EndpointsApi.new(unauthorized_client)
19
-
20
14
  $endpoint_id = ''
21
15
  end
22
16
 
@@ -104,29 +98,6 @@ describe 'EndpointsApi Integration Tests' do
104
98
 
105
99
  # HTTP 4XX Errors
106
100
  describe 'http error' do
107
- it 'causes a 401 error on create' do
108
- create_endpoint_body = Bandwidth::CreateWebRtcConnectionRequest.new(
109
- type: Bandwidth::EndpointTypeEnum::WEBRTC,
110
- direction: Bandwidth::EndpointDirectionEnum::BIDIRECTIONAL
111
- )
112
-
113
- expect {
114
- @unauthorized_api_instance.create_endpoint_with_http_info(BW_ACCOUNT_ID, create_endpoint_body)
115
- }.to raise_error { |e|
116
- expect(e).to be_instance_of(Bandwidth::ApiError)
117
- expect(e.code).to eq(401)
118
- }
119
- end
120
-
121
- it 'causes a 401 error on list' do
122
- expect {
123
- @unauthorized_api_instance.list_endpoints_with_http_info(BW_ACCOUNT_ID)
124
- }.to raise_error { |e|
125
- expect(e).to be_instance_of(Bandwidth::ApiError)
126
- expect(e.code).to eq(401)
127
- }
128
- end
129
-
130
101
  it 'causes a 404 error on get' do
131
102
  expect {
132
103
  @endpoints_api_instance.get_endpoint_with_http_info(BW_ACCOUNT_ID, 'does-not-exist')
@@ -1,3 +1,5 @@
1
+ require_relative 'smoke_helper'
2
+
1
3
  # Integration Tests for Bandwidth::MediaApi
2
4
  describe 'MediaApi Integration Tests' do
3
5
  # media info
@@ -1,3 +1,5 @@
1
+ require_relative 'smoke_helper'
2
+
1
3
  # Integration Tests for Bandwidth::MessagesApi
2
4
  describe 'MessagesApi Integration Tests' do
3
5
  # message info
@@ -110,30 +112,6 @@ describe 'MessagesApi Integration Tests' do
110
112
  expect(e.code).to eq(400)
111
113
  }
112
114
  end
113
-
114
- it 'causes a 401 error' do
115
- config = Bandwidth::Configuration.new
116
- config.configure do |config|
117
- config.username = UNAUTHORIZED_USERNAME
118
- config.password = UNAUTHORIZED_PASSWORD
119
- end
120
- client = Bandwidth::ApiClient.new(config)
121
- unauthorized_instance = Bandwidth::MessagesApi.new(client)
122
-
123
- body = Bandwidth::MessageRequest.new(
124
- application_id: BW_MESSAGING_APPLICATION_ID,
125
- to: [USER_NUMBER],
126
- from: BW_NUMBER,
127
- text: 'ruby sdk 401 test'
128
- )
129
-
130
- expect {
131
- unauthorized_instance.create_message_with_http_info(BW_ACCOUNT_ID, body)
132
- }.to raise_error { |e|
133
- expect(e).to be_instance_of(Bandwidth::ApiError)
134
- expect(e.code).to eq(401)
135
- }
136
- end
137
115
  end
138
116
 
139
117
  end
@@ -1,3 +1,5 @@
1
+ require_relative 'smoke_helper'
2
+
1
3
  # Integration Tests for Bandwidth::MFAApi
2
4
  describe 'MFAApi Integration Tests' do
3
5
  # mfa info
@@ -7,8 +9,8 @@ describe 'MFAApi Integration Tests' do
7
9
  before(:all) do
8
10
  config = Bandwidth::Configuration.new
9
11
  config.configure do |config|
10
- config.username = BW_USERNAME
11
- config.password = BW_PASSWORD
12
+ config.client_id = BW_CLIENT_ID
13
+ config.client_secret = BW_CLIENT_SECRET
12
14
  end
13
15
  client = Bandwidth::ApiClient.new(config)
14
16
  @mfa_api_instance = Bandwidth::MFAApi.new(client)
@@ -88,30 +90,5 @@ describe 'MFAApi Integration Tests' do
88
90
  expect(e.code).to eq(400)
89
91
  }
90
92
  end
91
-
92
- it 'causes a 403 error' do
93
- config = Bandwidth::Configuration.new
94
- config.configure do |config|
95
- config.username = UNAUTHORIZED_USERNAME
96
- config.password = UNAUTHORIZED_PASSWORD
97
- end
98
- client = Bandwidth::ApiClient.new(config)
99
- forbidden_instance = Bandwidth::MFAApi.new(client)
100
-
101
- req_schema = Bandwidth::CodeRequest.new(
102
- to: USER_NUMBER,
103
- from: BW_NUMBER,
104
- application_id: BW_MESSAGING_APPLICATION_ID,
105
- message: message,
106
- digits: digits
107
- )
108
-
109
- expect {
110
- forbidden_instance.generate_messaging_code_with_http_info(BW_ACCOUNT_ID, req_schema)
111
- }.to raise_error { |e|
112
- expect(e).to be_instance_of(Bandwidth::ApiError)
113
- expect(e.code).to eq(403)
114
- }
115
- end
116
93
  end
117
94
  end
@@ -1,10 +1,12 @@
1
+ require_relative 'smoke_helper'
2
+
1
3
  # Integration tests for Bandwidth::MultiChannelApi
2
4
  describe 'MultiChannelApi' do
3
5
  before(:all) do
4
6
  config = Bandwidth::Configuration.new
5
7
  config.configure do |config|
6
- config.username = BW_USERNAME
7
- config.password = BW_PASSWORD
8
+ config.client_id = BW_CLIENT_ID
9
+ config.client_secret = BW_CLIENT_SECRET
8
10
  end
9
11
  client = Bandwidth::ApiClient.new(config)
10
12
  @multi_channel_api_instance = Bandwidth::MultiChannelApi.new(client)
@@ -1,3 +1,5 @@
1
+ require_relative 'smoke_helper'
2
+
1
3
  # Integration tests for Bandwidth::PhoneNumberLookupApi
2
4
  describe 'PhoneNumberLookupApi' do
3
5
  let(:phone_numbers) { [BW_NUMBER, USER_NUMBER] }
@@ -1,4 +1,4 @@
1
- require_relative '../call_utils'
1
+ require_relative 'smoke_helper'
2
2
 
3
3
  # Integration Tests for Bandwidth::RecordingsApi
4
4
  describe 'RecordingsApi Integration Tests' do
@@ -0,0 +1,41 @@
1
+ require_relative '../call_utils'
2
+
3
+ RSpec.configure do |config|
4
+ config.before(:suite) {
5
+ begin
6
+ BW_CLIENT_ID = ENV.fetch('BW_CLIENT_ID')
7
+ BW_CLIENT_SECRET = ENV.fetch('BW_CLIENT_SECRET')
8
+ BW_ACCOUNT_ID = ENV.fetch('BW_ACCOUNT_ID')
9
+ BW_VOICE_APPLICATION_ID = ENV.fetch('BW_VOICE_APPLICATION_ID')
10
+ BW_MESSAGING_APPLICATION_ID = ENV.fetch('BW_MESSAGING_APPLICATION_ID')
11
+ BASE_CALLBACK_URL = ENV.fetch('BASE_CALLBACK_URL')
12
+ BW_NUMBER = ENV.fetch('BW_NUMBER')
13
+ USER_NUMBER = ENV.fetch('USER_NUMBER')
14
+ MANTECA_ACTIVE_NUMBER = ENV.fetch('MANTECA_ACTIVE_NUMBER')
15
+ MANTECA_IDLE_NUMBER = ENV.fetch('MANTECA_IDLE_NUMBER')
16
+ MANTECA_BASE_URL = ENV.fetch('MANTECA_BASE_URL')
17
+ MANTECA_APPLICATION_ID = ENV.fetch('MANTECA_APPLICATION_ID')
18
+ OPERATING_SYSTEM = ENV.fetch('OPERATING_SYSTEM')
19
+ rescue
20
+ puts 'Environmental variables not found'
21
+ exit(-1)
22
+ end
23
+
24
+ SLEEP_TIME_S = 3 # default sleep time in seconds
25
+ MAX_RETRIES = 40
26
+ $active_calls = []
27
+
28
+ $complete_call_body = Bandwidth::UpdateCall.new(
29
+ state: Bandwidth::CallStateEnum::COMPLETED
30
+ )
31
+ }
32
+
33
+ config.after(:suite) {
34
+ Bandwidth.configure do |config|
35
+ config.client_id = BW_CLIENT_ID
36
+ config.client_secret = BW_CLIENT_SECRET
37
+ end
38
+ calls_api = Bandwidth::CallsApi.new
39
+ cleanup_calls($active_calls, calls_api)
40
+ }
41
+ end
@@ -1,3 +1,5 @@
1
+ require_relative 'smoke_helper'
2
+
1
3
  # Integration Tests for Bandwidth::StatisticsApi
2
4
  describe 'StatisticsApi Integration Tests' do
3
5
  before(:all) do
@@ -21,41 +23,4 @@ describe 'StatisticsApi Integration Tests' do
21
23
  expect(data.max_call_queue_size).to eq(7500)
22
24
  end
23
25
  end
24
-
25
- # HTTP 4XX Errors
26
- describe 'http error' do
27
- it 'causes a 401 error' do
28
- config = Bandwidth::Configuration.new
29
- config.configure do |config|
30
- config.username = UNAUTHORIZED_USERNAME
31
- config.password = UNAUTHORIZED_PASSWORD
32
- end
33
- client = Bandwidth::ApiClient.new(config)
34
- unauthorized_instance = Bandwidth::StatisticsApi.new(client)
35
-
36
- expect {
37
- unauthorized_instance.get_statistics_with_http_info(BW_ACCOUNT_ID)
38
- }.to raise_error { |e|
39
- expect(e).to be_instance_of(Bandwidth::ApiError)
40
- expect(e.code).to eq(401)
41
- }
42
- end
43
-
44
- it 'causes a 403 error' do
45
- config = Bandwidth::Configuration.new
46
- config.configure do |config|
47
- config.username = FORBIDDEN_USERNAME
48
- config.password = FORBIDDEN_PASSWORD
49
- end
50
- client = Bandwidth::ApiClient.new(config)
51
- forbidden_instance = Bandwidth::StatisticsApi.new(client)
52
-
53
- expect {
54
- forbidden_instance.get_statistics_with_http_info(BW_ACCOUNT_ID)
55
- }.to raise_error { |e|
56
- expect(e).to be_instance_of(Bandwidth::ApiError)
57
- expect(e.code).to eq(403)
58
- }
59
- end
60
- end
61
26
  end
@@ -1,3 +1,5 @@
1
+ require_relative 'smoke_helper'
2
+
1
3
  # Integration tests for Bandwidth::TollFreeVerificationApi
2
4
  describe 'TollFreeVerificationApi' do
3
5
  before(:all) do
@@ -1,4 +1,4 @@
1
- require_relative '../call_utils'
1
+ require_relative 'smoke_helper'
2
2
 
3
3
  # Integration Tests for Bandwidth::TranscriptionsApi
4
4
  describe 'TranscriptionsApi Integration Tests' do
data/spec/spec_helper.rb CHANGED
@@ -19,9 +19,6 @@ end
19
19
  # load the gem
20
20
  require 'bandwidth-sdk'
21
21
 
22
- # load call utils every time. This prevents an error from occurring when running only unit tests
23
- require_relative './call_utils'
24
-
25
22
  # The following was generated by the `rspec --init` command. Conventionally, all
26
23
  # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
27
24
  # The generated `.rspec` file contains `--require spec_helper` which will cause
@@ -41,51 +38,6 @@ require_relative './call_utils'
41
38
  #
42
39
  # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
43
40
  RSpec.configure do |config|
44
- config.before(:suite) {
45
- begin
46
- BW_USERNAME = ENV.fetch('BW_USERNAME')
47
- BW_PASSWORD = ENV.fetch('BW_PASSWORD')
48
- BW_CLIENT_ID = ENV.fetch('BW_CLIENT_ID')
49
- BW_CLIENT_SECRET = ENV.fetch('BW_CLIENT_SECRET')
50
- FORBIDDEN_USERNAME = ENV.fetch('BW_USERNAME_FORBIDDEN')
51
- FORBIDDEN_PASSWORD = ENV.fetch('BW_PASSWORD_FORBIDDEN')
52
- BW_ACCOUNT_ID = ENV.fetch('BW_ACCOUNT_ID')
53
- BW_VOICE_APPLICATION_ID = ENV.fetch('BW_VOICE_APPLICATION_ID')
54
- BW_MESSAGING_APPLICATION_ID = ENV.fetch('BW_MESSAGING_APPLICATION_ID')
55
- BASE_CALLBACK_URL = ENV.fetch('BASE_CALLBACK_URL')
56
- BW_NUMBER = ENV.fetch('BW_NUMBER')
57
- USER_NUMBER = ENV.fetch('USER_NUMBER')
58
- MANTECA_ACTIVE_NUMBER = ENV.fetch('MANTECA_ACTIVE_NUMBER')
59
- MANTECA_IDLE_NUMBER = ENV.fetch('MANTECA_IDLE_NUMBER')
60
- MANTECA_BASE_URL = ENV.fetch('MANTECA_BASE_URL')
61
- MANTECA_APPLICATION_ID = ENV.fetch('MANTECA_APPLICATION_ID')
62
- OPERATING_SYSTEM = ENV.fetch('OPERATING_SYSTEM')
63
- RUBY_VERSION = ENV.fetch('RUBY_VERSION')
64
- rescue
65
- puts 'Environmental variables not found'
66
- exit(-1)
67
- end
68
-
69
- SLEEP_TIME_S = 3 # default sleep time in seconds
70
- MAX_RETRIES = 40
71
- UNAUTHORIZED_USERNAME = 'bad_username'
72
- UNAUTHORIZED_PASSWORD = 'bad_password'
73
- $active_calls = []
74
-
75
- $complete_call_body = Bandwidth::UpdateCall.new(
76
- state: Bandwidth::CallStateEnum::COMPLETED
77
- )
78
- }
79
-
80
- config.after(:suite) {
81
- Bandwidth.configure do |config|
82
- config.username = BW_USERNAME
83
- config.password = BW_PASSWORD
84
- end
85
- calls_api = Bandwidth::CallsApi.new
86
- cleanup_calls($active_calls, calls_api)
87
- }
88
-
89
41
  RSpec::Matchers.define(:be_one_of) do |expected|
90
42
  match do |actual|
91
43
  expected.include?(actual)
@@ -1,3 +1,5 @@
1
+ require_relative '../constants'
2
+
1
3
  # Unit tests for Bandwidth::CallsApi
2
4
  describe 'CallsApi' do
3
5
  let(:call_id) { 'c-1234' }
@@ -174,7 +176,7 @@ describe 'CallsApi' do
174
176
  it 'creates and updates a call' do
175
177
  update_call_body = Bandwidth::UpdateCall.new(
176
178
  state: Bandwidth::CallStateEnum::ACTIVE,
177
- redirect_url: MANTECA_BASE_URL + '/bxml/pause'
179
+ redirect_url: BASE_CALLBACK_URL + '/bxml/pause'
178
180
  )
179
181
 
180
182
  _data, status_code = @calls_api_instance.update_call_with_http_info(BW_ACCOUNT_ID, call_id, update_call_body)
@@ -1,3 +1,5 @@
1
+ require_relative '../constants'
2
+
1
3
  # Unit tests for Bandwidth::ConferencesApi
2
4
  describe 'ConferencesApi' do
3
5
  let(:call_id) { 'c-1234' }
@@ -1,3 +1,5 @@
1
+ require_relative '../constants'
2
+
1
3
  # Unit tests for Bandwidth::EndpointsApi
2
4
  describe 'EndpointsApi' do
3
5
  let(:endpoint_id) { 'ep-abc123' }
@@ -1,3 +1,5 @@
1
+ require_relative '../constants'
2
+
1
3
  # Unit tests for Bandwidth::MediaApi
2
4
  describe 'MediaApi' do
3
5
  # media info
@@ -1,3 +1,5 @@
1
+ require_relative '../constants'
2
+
1
3
  # Unit tests for Bandwidth::MessagesApi
2
4
  describe 'MessagesApi' do
3
5
  before(:all) do
@@ -1,3 +1,5 @@
1
+ require_relative '../constants'
2
+
1
3
  # Unit tests for Bandwidth::MFAApi
2
4
  describe 'MFAApi' do
3
5
  let(:message) { 'Your temporary {NAME} {SCOPE} code is: {CODE}' }
@@ -1,3 +1,5 @@
1
+ require_relative '../constants'
2
+
1
3
  # Unit tests for Bandwidth::MultiChannelApi
2
4
  describe 'MultiChannelApi' do
3
5
  before(:all) do
@@ -1,3 +1,5 @@
1
+ require_relative '../constants'
2
+
1
3
  # Unit tests for Bandwidth::PhoneNumberLookupApi
2
4
  describe 'PhoneNumberLookupApi' do
3
5
  let(:phone_numbers) { [BW_NUMBER, USER_NUMBER] }