Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,6 @@ jobs:
permissions:
contents: read
id-token: write
env:
BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }}
BW_CLIENT_ID: ${{ secrets.BW_CLIENT_ID }}
BW_CLIENT_SECRET: ${{ secrets.BW_CLIENT_SECRET }}
BW_VOICE_APPLICATION_ID: ${{ secrets.BW_VOICE_APPLICATION_ID }}
BW_MESSAGING_APPLICATION_ID: ${{ secrets.BW_MESSAGING_APPLICATION_ID }}
BW_NUMBER: ${{ secrets.BW_NUMBER }}
USER_NUMBER: ${{ secrets.USER_NUMBER }}
BASE_CALLBACK_URL: ${{ secrets.BASE_CALLBACK_URL }}
RUBY_VERSION: "4.0"
OPERATING_SYSTEM: "ubuntu"
MANTECA_ACTIVE_NUMBER: ${{ secrets.MANTECA_ACTIVE_NUMBER }}
MANTECA_IDLE_NUMBER: ${{ secrets.MANTECA_IDLE_NUMBER }}
MANTECA_BASE_URL: ${{ secrets.MANTECA_BASE_URL }}
MANTECA_APPLICATION_ID: ${{ secrets.MANTECA_APPLICATION_ID }}
BW_NUMBER_PROVIDER: ${{ secrets.BW_NUMBER_PROVIDER }}

steps:
- name: Set Release Version
Expand Down
17 changes: 0 additions & 17 deletions .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,6 @@ concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true

env:
BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID || '9900000' }}
BW_CLIENT_ID: ${{ secrets.BW_CLIENT_ID }}
BW_CLIENT_SECRET: ${{ secrets.BW_CLIENT_SECRET }}
BW_VOICE_APPLICATION_ID: ${{ secrets.BW_VOICE_APPLICATION_ID || 'abc12345-6def-abc1-2345-6defabc12345' }}
BW_MESSAGING_APPLICATION_ID: ${{ secrets.BW_MESSAGING_APPLICATION_ID || 'abc12345-6def-abc1-2345-6defabc12345' }}
BW_NUMBER: ${{ secrets.BW_NUMBER || '+19195551234' }}
USER_NUMBER: ${{ secrets.USER_NUMBER || '+19195554321' }}
BASE_CALLBACK_URL: ${{ secrets.BASE_CALLBACK_URL || 'https://example.com' }}
MANTECA_ACTIVE_NUMBER: ${{ secrets.MANTECA_ACTIVE_NUMBER }}
MANTECA_IDLE_NUMBER: ${{ secrets.MANTECA_IDLE_NUMBER }}
MANTECA_BASE_URL: ${{ secrets.MANTECA_BASE_URL || 'https://example.com' }}
MANTECA_APPLICATION_ID: ${{ secrets.MANTECA_APPLICATION_ID }}

jobs:
test:
name: Test PR
Expand All @@ -46,7 +32,4 @@ jobs:
npm install -g @stoplight/prism-cli
bundle install
prism mock ./bandwidth.yml & (sleep 4; rake unit)
env:
RUBY_VERSION: ${{ matrix.ruby-version }}
OPERATING_SYSTEM: ${{ matrix.os }}
shell: bash
2 changes: 0 additions & 2 deletions .github/workflows/test-smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ jobs:
bundle install
rake smoke
env:
RUBY_VERSION: 3.4
OPERATING_SYSTEM: ubuntu
shell: bash

Expand Down Expand Up @@ -74,7 +73,6 @@ jobs:
bundle install
rake smoke
env:
RUBY_VERSION: 3.4
OPERATING_SYSTEM: ubuntu
shell: bash

Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ begin
t.pattern = './spec/smoke/*_spec.rb'
end

task default: :spec
task default: :unit
rescue LoadError
# no rspec available
end
2 changes: 1 addition & 1 deletion spec/smoke/calls_api_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require_relative '../call_utils'
require_relative 'smoke_helper'

# Integration Tests for Bandwidth::CallsApi
describe 'CallsApi Integration Tests' do
Expand Down
2 changes: 1 addition & 1 deletion spec/smoke/conferences_api_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require_relative '../call_utils'
require_relative 'smoke_helper'

# Integration Tests for Bandwidth::ConferencesApi
describe 'ConferencesApi Integration Tests' do
Expand Down
2 changes: 2 additions & 0 deletions spec/smoke/endpoints_api_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require_relative 'smoke_helper'

# Integration Tests for Bandwidth::EndpointsApi
describe 'EndpointsApi Integration Tests' do
before(:all) do
Expand Down
2 changes: 2 additions & 0 deletions spec/smoke/media_api_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require_relative 'smoke_helper'

# Integration Tests for Bandwidth::MediaApi
describe 'MediaApi Integration Tests' do
# media info
Expand Down
2 changes: 2 additions & 0 deletions spec/smoke/messages_api_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require_relative 'smoke_helper'

# Integration Tests for Bandwidth::MessagesApi
describe 'MessagesApi Integration Tests' do
# message info
Expand Down
2 changes: 2 additions & 0 deletions spec/smoke/mfa_api_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require_relative 'smoke_helper'

# Integration Tests for Bandwidth::MFAApi
describe 'MFAApi Integration Tests' do
# mfa info
Expand Down
2 changes: 2 additions & 0 deletions spec/smoke/multi_channel_api_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require_relative 'smoke_helper'

# Integration tests for Bandwidth::MultiChannelApi
describe 'MultiChannelApi' do
before(:all) do
Expand Down
2 changes: 2 additions & 0 deletions spec/smoke/phone_number_lookup_api_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require_relative 'smoke_helper'

# Integration tests for Bandwidth::PhoneNumberLookupApi
describe 'PhoneNumberLookupApi' do
let(:phone_numbers) { [BW_NUMBER, USER_NUMBER] }
Expand Down
2 changes: 1 addition & 1 deletion spec/smoke/recordings_api_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require_relative '../call_utils'
require_relative 'smoke_helper'

# Integration Tests for Bandwidth::RecordingsApi
describe 'RecordingsApi Integration Tests' do
Expand Down
41 changes: 41 additions & 0 deletions spec/smoke/smoke_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
require_relative '../call_utils'

RSpec.configure do |config|
config.before(:suite) {
begin
BW_CLIENT_ID = ENV.fetch('BW_CLIENT_ID')
BW_CLIENT_SECRET = ENV.fetch('BW_CLIENT_SECRET')
BW_ACCOUNT_ID = ENV.fetch('BW_ACCOUNT_ID')
BW_VOICE_APPLICATION_ID = ENV.fetch('BW_VOICE_APPLICATION_ID')
BW_MESSAGING_APPLICATION_ID = ENV.fetch('BW_MESSAGING_APPLICATION_ID')
BASE_CALLBACK_URL = ENV.fetch('BASE_CALLBACK_URL')
BW_NUMBER = ENV.fetch('BW_NUMBER')
USER_NUMBER = ENV.fetch('USER_NUMBER')
MANTECA_ACTIVE_NUMBER = ENV.fetch('MANTECA_ACTIVE_NUMBER')
MANTECA_IDLE_NUMBER = ENV.fetch('MANTECA_IDLE_NUMBER')
MANTECA_BASE_URL = ENV.fetch('MANTECA_BASE_URL')
MANTECA_APPLICATION_ID = ENV.fetch('MANTECA_APPLICATION_ID')
OPERATING_SYSTEM = ENV.fetch('OPERATING_SYSTEM')
rescue
puts 'Environmental variables not found'
exit(-1)
end

SLEEP_TIME_S = 3 # default sleep time in seconds
MAX_RETRIES = 40
$active_calls = []

$complete_call_body = Bandwidth::UpdateCall.new(
state: Bandwidth::CallStateEnum::COMPLETED
)
}

config.after(:suite) {
Bandwidth.configure do |config|
config.client_id = BW_CLIENT_ID
config.client_secret = BW_CLIENT_SECRET
end
calls_api = Bandwidth::CallsApi.new
cleanup_calls($active_calls, calls_api)
}
end
2 changes: 2 additions & 0 deletions spec/smoke/statistics_api_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require_relative 'smoke_helper'

# Integration Tests for Bandwidth::StatisticsApi
describe 'StatisticsApi Integration Tests' do
before(:all) do
Expand Down
2 changes: 2 additions & 0 deletions spec/smoke/toll_free_verification_api_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require_relative 'smoke_helper'

# Integration tests for Bandwidth::TollFreeVerificationApi
describe 'TollFreeVerificationApi' do
before(:all) do
Expand Down
2 changes: 1 addition & 1 deletion spec/smoke/transcriptions_api_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require_relative '../call_utils'
require_relative 'smoke_helper'

# Integration Tests for Bandwidth::TranscriptionsApi
describe 'TranscriptionsApi Integration Tests' do
Expand Down
42 changes: 0 additions & 42 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
# load the gem
require 'bandwidth-sdk'

# load call utils every time. This prevents an error from occurring when running only unit tests
require_relative './call_utils'

# The following was generated by the `rspec --init` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
Expand All @@ -41,45 +38,6 @@
#
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
config.before(:suite) {
begin
BW_CLIENT_ID = ENV.fetch('BW_CLIENT_ID')
BW_CLIENT_SECRET = ENV.fetch('BW_CLIENT_SECRET')
BW_ACCOUNT_ID = ENV.fetch('BW_ACCOUNT_ID')
BW_VOICE_APPLICATION_ID = ENV.fetch('BW_VOICE_APPLICATION_ID')
BW_MESSAGING_APPLICATION_ID = ENV.fetch('BW_MESSAGING_APPLICATION_ID')
BASE_CALLBACK_URL = ENV.fetch('BASE_CALLBACK_URL')
BW_NUMBER = ENV.fetch('BW_NUMBER')
USER_NUMBER = ENV.fetch('USER_NUMBER')
MANTECA_ACTIVE_NUMBER = ENV.fetch('MANTECA_ACTIVE_NUMBER')
MANTECA_IDLE_NUMBER = ENV.fetch('MANTECA_IDLE_NUMBER')
MANTECA_BASE_URL = ENV.fetch('MANTECA_BASE_URL')
MANTECA_APPLICATION_ID = ENV.fetch('MANTECA_APPLICATION_ID')
OPERATING_SYSTEM = ENV.fetch('OPERATING_SYSTEM')
RUBY_VERSION = ENV.fetch('RUBY_VERSION')
rescue
puts 'Environmental variables not found'
exit(-1)
end

SLEEP_TIME_S = 3 # default sleep time in seconds
MAX_RETRIES = 40
$active_calls = []

$complete_call_body = Bandwidth::UpdateCall.new(
state: Bandwidth::CallStateEnum::COMPLETED
)
}

config.after(:suite) {
Bandwidth.configure do |config|
config.client_id = BW_CLIENT_ID
config.client_secret = BW_CLIENT_SECRET
end
calls_api = Bandwidth::CallsApi.new
cleanup_calls($active_calls, calls_api)
}

RSpec::Matchers.define(:be_one_of) do |expected|
match do |actual|
expected.include?(actual)
Expand Down
4 changes: 3 additions & 1 deletion spec/unit/api/calls_api_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require_relative '../constants'

# Unit tests for Bandwidth::CallsApi
describe 'CallsApi' do
let(:call_id) { 'c-1234' }
Expand Down Expand Up @@ -174,7 +176,7 @@
it 'creates and updates a call' do
update_call_body = Bandwidth::UpdateCall.new(
state: Bandwidth::CallStateEnum::ACTIVE,
redirect_url: MANTECA_BASE_URL + '/bxml/pause'
redirect_url: BASE_CALLBACK_URL + '/bxml/pause'
)

_data, status_code = @calls_api_instance.update_call_with_http_info(BW_ACCOUNT_ID, call_id, update_call_body)
Expand Down
2 changes: 2 additions & 0 deletions spec/unit/api/conferences_api_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require_relative '../constants'

# Unit tests for Bandwidth::ConferencesApi
describe 'ConferencesApi' do
let(:call_id) { 'c-1234' }
Expand Down
2 changes: 2 additions & 0 deletions spec/unit/api/endpoints_api_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require_relative '../constants'

# Unit tests for Bandwidth::EndpointsApi
describe 'EndpointsApi' do
let(:endpoint_id) { 'ep-abc123' }
Expand Down
2 changes: 2 additions & 0 deletions spec/unit/api/media_api_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require_relative '../constants'

# Unit tests for Bandwidth::MediaApi
describe 'MediaApi' do
# media info
Expand Down
2 changes: 2 additions & 0 deletions spec/unit/api/messages_api_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require_relative '../constants'

# Unit tests for Bandwidth::MessagesApi
describe 'MessagesApi' do
before(:all) do
Expand Down
2 changes: 2 additions & 0 deletions spec/unit/api/mfa_api_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require_relative '../constants'

# Unit tests for Bandwidth::MFAApi
describe 'MFAApi' do
let(:message) { 'Your temporary {NAME} {SCOPE} code is: {CODE}' }
Expand Down
2 changes: 2 additions & 0 deletions spec/unit/api/multi_channel_api_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require_relative '../constants'

# Unit tests for Bandwidth::MultiChannelApi
describe 'MultiChannelApi' do
before(:all) do
Expand Down
2 changes: 2 additions & 0 deletions spec/unit/api/phone_number_lookup_api_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require_relative '../constants'

# Unit tests for Bandwidth::PhoneNumberLookupApi
describe 'PhoneNumberLookupApi' do
let(:phone_numbers) { [BW_NUMBER, USER_NUMBER] }
Expand Down
2 changes: 2 additions & 0 deletions spec/unit/api/recordings_api_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require_relative '../constants'

# Unit tests for Bandwidth::RecordingsApi
describe 'RecordingsApi' do
let(:call_id) { 'c-1234' }
Expand Down
2 changes: 2 additions & 0 deletions spec/unit/api/statistics_api_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require_relative '../constants'

# Unit tests for Bandwidth::StatisticsApi
describe 'StatisticsApi' do
before(:all) do
Expand Down
2 changes: 2 additions & 0 deletions spec/unit/api/toll_free_verification_api_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require_relative '../constants'

# Unit tests for Bandwidth::TollFreeVerificationApi
describe 'TollFreeVerificationApi' do
let (:webhook_subscription_request_schema) { Bandwidth::WebhookSubscriptionRequestSchema.new(
Expand Down
2 changes: 2 additions & 0 deletions spec/unit/api/transcriptions_api_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require_relative '../constants'

# Unit tests for Bandwidth::TranscriptionsApi
describe 'TranscriptionsApi' do
let(:call_id) { 'c-1234' }
Expand Down
1 change: 1 addition & 0 deletions spec/unit/client/configuration_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'uri'
require_relative '../constants'

# Unit tests for Bandwidth::Configuration
describe Bandwidth::Configuration do
Expand Down
6 changes: 6 additions & 0 deletions spec/unit/constants.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
BW_ACCOUNT_ID = '9900000'
BW_NUMBER = '+19195551234'
USER_NUMBER = '+19195554321'
BW_VOICE_APPLICATION_ID = 'abc12345-6def-abc1-2345-6defabc12345'
BW_MESSAGING_APPLICATION_ID = 'abc12345-6def-abc1-2345-6defabc12345'
BASE_CALLBACK_URL = 'https://example.com'
Loading