Skip to content

Commit 8c708af

Browse files
OpenAPI Generator SDK Feature Branch (#61)
* OpenAPI Generator SDK Feature Branch * remove old sdk * Update to OpenAPI Generator v6.3 (#66) * use version 6.3 of the generator * regenerate tests * drop ruby 2.6 * add 3.2 to test matrix * split tests and do messaging integration as test * remove from test.rb * checkout v3 * tests in readme * put constant env vars in spec_helper * remove constants from messaging * add unit and integration tasks to rake * move other unit tests to unit folder * clean up integration test files * remove messaging integration tests to put in separate pr * gitignore gemfile.lock * update bw spec and use v6.4.0 of the generator (#72) * Remove webrtc (#73) * remove webrtc files * update files * Small changes to clean up repo for beta release (#74) * DX-2940 Messaging Integration Tests (#67) * DX-2940 Messaging Integration Tests * remove ssl_verify * switch to 1 set of 4xx tests * set config once * assert response objects * DX-2941 MFA Integration Tests (#68) * DX-2941 MFA Integration Tests * 4xx * finish mfa tests * undo changes to test.rb * standardize response name * assert response objects * DX-2942 TN Lookup Integration Tests (#69) * DX-2942 TN Lookup Integration Tests * remove unused after block * update comment * remove unused variable * separate tests * assert response objects * DX-2938 Media Integration Tests (#70) * DX-2938 Media Integration Tests * upload and list tests * happy path * add attr_accessor for return_binary_data * add 404 * remove unused after block * update with comment from my parent project PR * remove unused files * assert response object * use stricter asserts * Add BXML Verbs (#75) * Add Root Classes for BXML Verbs * remove unfinished verbs from sdk requires * add unit tests for Bxml and Response * add ffi to install libxml2 for windows * use 3.2.2 of libxml * switch to libxml require * Try Using Ox (#78) * ox dump instead of to_s * use attribute map in verb * standardize expected bxml var * typos * Add Terminal Verbs (#76) * Add Terminal Verbs * update bridge and add unit test * add unit test for root verb module * bridge test * bridge comment * update conference * add terminal verb unit test * verb test * all attributes in bridge test * add conference and test * add conference to sdk * remove backslash escaping * test number * use real booleans for conference * add comment to bridge * add pause and test * conference timeout is a Number * add forward and test * add explicit empty hash to tag * add hangup and test * add pause_recording and test * add phone_number and test * add play_audio and test * comments for params * add record and test * add redirect and test * add resume_recording and test * add ring and test * add send_dtmf and test * add sip_uri and test * add speak_sentence and test * add start_gather and test * add start_recording and test * add stop_gather and test * add stop_recording and test * add stop_stream and test * _name for stop_stream * add stream_param and test * add test for tag verb * turn ssml regex into constants * test decimals in ring verb * test decimals in conference * comment clean up * Add Non-Terminal Verbs (#77) * Add Non-Terminal Verbs * merge SWI-1730 * update gather and add tests * period in gather comment * add start_stream and test * add transfer and test * remove add_verb method * update response and bxml class tests * update non-terminal verbs and tests * refactor base verb classes (#80) * use call id for bridge test * update gem ox dependency * Apply suggestions from code review Co-authored-by: Matthew Martin <[email protected]> --------- Co-authored-by: Matthew Martin <[email protected]> * Calls, Recordings, Conferences, and Statistics Integration Tests (#71) * DX-2937 Calls Integration Tests * update ignore * separate tests * remove test.rb * split tests and add 4xx tests * add 403 * update call test * update call * clearer variable name and update env vars * secrets. * finish calls * add env vars, refactoring, and recording tests * conferences test * more recordings tests * finish recordings * add asserts for response objects * finalize calls * reorder recordings * finish conferences * complete or partial * fix test.yml * spaces * updates and statistics tests (#79) * use stricter type matching for asserts * stricter asserts * add statistics tests * add retry logic to call cleanup * add sleep and retry less * update version * SWI-1988 Update SDK with `expiration` field (#87) * SWI-1988 Update SDK with `expiration` field * update pre-release name regex * remove application id assert from recordings test because its not guaranteed (#90) * update tests workflows for feature branch * Task: Update Manteca Test IDs (#89) * SWI-2788 Add Transcription BXML to Feature Branch (#100) * SWI-2788 Add Transcription BXML to Feature Branch * update workflow * update workflows with formatting * SWI-2821 Prep for GA (#101) * update spec and use 6.6 * changes we'd need to automate * newline in readme * remove config tests * revert config back to working version * regenerate with v6.5.0 * fix other files * dont try to clean up calls since voice api is slow * update spec * add custom templates and update readme badge * update test workflow name * add openapitools * add sdk update workflow * add config test file and fix it * update config test * update integration tests * Revert "update integration tests" This reverts commit 77545d9. * add client option to rakefile * update version logic and ignore file * remove unnecessary env vars from build wf * revert version change * remove unnecessary spec_helper imports * lots of small changes based on rubocop linting * update custom templates * add rubocop badge to README * add gem version badge to readme * remove unnecessary deploy action * update codeowners * update workflows * add gem version env var to test wfs * SWI-1771 Add Unit Tests (#103) * update spec and use 6.6 * changes we'd need to automate * newline in readme * remove config tests * revert config back to working version * regenerate with v6.5.0 * fix other files * dont try to clean up calls since voice api is slow * update spec * add custom templates and update readme badge * update test workflow name * add openapitools * add sdk update workflow * add config test file and fix it * update config test * update integration tests * Revert "update integration tests" This reverts commit 77545d9. * add client option to rakefile * update version logic and ignore file * remove unnecessary env vars from build wf * revert version change * remove unnecessary spec_helper imports * lots of small changes based on rubocop linting * update custom templates * add rubocop badge to README * add gem version badge to readme * remove unnecessary deploy action * update codeowners * update workflows * add gem version env var to test wfs * remove newlines from bxml tests * unit tests for acc stats * comment * fix eventTime data type * answer callback tests and improve * bridge callback and improve * bridge target * enum tests * test desc * delete unused spec files for unit tests * update message time to be date-time * add suite of encompassing unit tests * update gitignore * fix small logic error in bxml library * calls_api unit tests * remove unnecessary require * update calls tests to be better and add conferences tests * add webmock * move 4xx tests to client suite * skip all integration tests * skip 4xx tests for now (TODO: fix these) * rubocop linting for calls and conferences * add comment to document test skips * spacing * fix hashes * media tests * remove unnecessary flag from media integration * rubocop doesnt like my newline * add argument error tests to media * reorganizing * recordings tests * update list message item receive time * messages tests * add argument error tests to messages * fix expects * update messages * mfa tests * i can test basic auth in the client, not needed in apis * assert arrays * be_a -> be_instance_of * tnlookup tests * statistics tests * add gems to Gemfile and template * bring back statistics integration tests * bring back mfa * remove json dep * tnlookup * enforce single quotes * more quotes changes * single quotes * media * add string interpolation rule * quotes in tests * dont do config * exclude files from rubocop * ignore rubocop * messages * calls * newline * assertion cleanup * conferences * consistency * recordings * update model tests * start on client tests * configuration tests * small changes * update openapi-generator-ignore to ignore all tests * update error checking * error checking * lots of client tests * lowercase require? * use @uri * refactor to use let * use let for rest of unit tests * use let * final client tests * use let in integration tests * rubocop save me * rubocop newlines around blocks * add ApiError tests * no longer need to install hub * update unit tests * finalize workflow * add limitTotalCount (new msg param) * SWI-2821 Improve BXML Library (#106) * fix deploy workflow * please deploy this time * SWI-3149 Update to Generator Version 7.0.0 (#107) * SWI-3149 Update to Generator Version 7.0.0 * update tests * fix tests again * update workflow * SWI-3336 Update SDK to OpenAPI Generator 7.0.0 (#108) * SWI-3336 Update SDK to OpenAPI Generator 7.0.0 * update generator config * update bw spec * update sdk to 7.0.0 * add `display_name` to calls tests * remove assignee from Jira * SWI-3338 Update SDK for GA (#109) * SWI-3338 Update SDK for GA * update beta regex to normal release regex * update version * update README to include generate command * update deploy workflow to update gem version before release * test wf * update test * remove test * revert pre-release regex * update call state test * update release regex * remove ruby-notes and old sdk files --------- Co-authored-by: Matthew Martin <[email protected]>
1 parent c18063e commit 8c708af

File tree

476 files changed

+48276
-14530
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

476 files changed

+48276
-14530
lines changed

.github/actions/deploy/Dockerfile

-11
This file was deleted.

.github/actions/deploy/action.yml

-6
This file was deleted.

.github/actions/deploy/entrypoint.sh

-7
This file was deleted.

.github/workflows/deploy.yml

+26-63
Original file line numberDiff line numberDiff line change
@@ -7,48 +7,7 @@ on:
77

88
jobs:
99
deploy:
10-
name: Deploy to Rubygems
11-
if: ${{ !github.event.release.prerelease && github.event.release.target_commitish == 'main' }}
12-
runs-on: ubuntu-latest
13-
steps:
14-
- name: Checkout
15-
uses: actions/checkout@v3
16-
17-
- name: Setup Ruby
18-
uses: ruby/setup-ruby@v1
19-
with:
20-
ruby-version: "3.0"
21-
22-
- name: Install Packages
23-
run: bundle install
24-
25-
- name: Test
26-
env:
27-
BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }}
28-
BW_USERNAME: ${{ secrets.BW_USERNAME }}
29-
BW_PASSWORD: ${{ secrets.BW_PASSWORD }}
30-
BW_VOICE_APPLICATION_ID: ${{ secrets.BW_VOICE_APPLICATION_ID }}
31-
BW_MESSAGING_APPLICATION_ID: ${{ secrets.BW_MESSAGING_APPLICATION_ID }}
32-
BW_NUMBER: ${{ secrets.BW_NUMBER }}
33-
USER_NUMBER: ${{ secrets.USER_NUMBER }}
34-
BASE_CALLBACK_URL: ${{ secrets.BASE_CALLBACK_URL }}
35-
run: rake
36-
37-
- name: Deploy to Rubygems
38-
uses: ./.github/actions/deploy
39-
env:
40-
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
41-
42-
- uses: Bandwidth/[email protected]
43-
if: always()
44-
with:
45-
job-status: ${{ job.status }}
46-
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
47-
slack-channel: ${{ secrets.SLACK_CHANNEL }}
48-
49-
deploy_pre_release:
50-
name: Deploy OpenAPI Generator Client Pre-Release to Rubygems
51-
if: ${{ github.event.release.prerelease && github.event.release.target_commitish == 'feature/openapi-generator-sdk' }}
10+
name: Deploy SDK to Rubygems
5211
runs-on: ubuntu-latest
5312
env:
5413
BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }}
@@ -61,49 +20,53 @@ jobs:
6120
BW_NUMBER: ${{ secrets.BW_NUMBER }}
6221
USER_NUMBER: ${{ secrets.USER_NUMBER }}
6322
BASE_CALLBACK_URL: ${{ secrets.BASE_CALLBACK_URL }}
64-
RUBY_VERSION: '3.0'
65-
OPERATING_SYSTEM: 'ubuntu'
23+
RUBY_VERSION: "3.0"
24+
OPERATING_SYSTEM: "ubuntu"
6625
MANTECA_ACTIVE_NUMBER: ${{ secrets.MANTECA_ACTIVE_NUMBER }}
6726
MANTECA_IDLE_NUMBER: ${{ secrets.MANTECA_IDLE_NUMBER }}
6827
MANTECA_BASE_URL: ${{ secrets.MANTECA_BASE_URL }}
6928
MANTECA_APPLICATION_ID: ${{ secrets.MANTECA_APPLICATION_ID }}
7029
BW_NUMBER_PROVIDER: ${{ secrets.BW_NUMBER_PROVIDER }}
71-
30+
7231
steps:
7332
- name: Set Release Version
74-
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
75-
76-
- name: Check Release Tag Format
7733
run: |
78-
re=[0-9]+\.[0-9]+\.[0-9]+\.pre\.beta\.[0-9]+\.?[0-9]*\.?[0-9]*
79-
if ! [[ $RELEASE_VERSION =~ $re ]]; then
80-
echo 'Tag does not match expected regex pattern for beta releases (v[0-9]+\.[0-9]+\.[0-9]+\.pre\.beta\.[0-9]+\.?[0-9]*\.?[0-9]*)'
34+
RELEASE_VERSION=${GITHUB_REF#refs/tags/v}
35+
re=[0-9]+\.[0-9]+\.[0-9]+
36+
if [[ $RELEASE_VERSION =~ $re ]]; then
37+
echo "GEM_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
38+
else
39+
echo "Tag does not match expected semver regex pattern (v$re)"
8140
echo $RELEASE_VERSION
8241
echo 'Please update your tag to match the expected regex pattern'
8342
exit 1
8443
fi
85-
44+
8645
- name: Checkout
8746
uses: actions/checkout@v3
88-
with:
89-
ref: feature/openapi-generator-sdk
9047

9148
- name: Setup Ruby
9249
uses: ruby/setup-ruby@v1
9350
with:
9451
ruby-version: "3.0"
9552

96-
- name: Install Packages
97-
run: bundle install
53+
- name: Update Gem Version
54+
run: sed -i "s/VERSION = '.*'/VERSION = '$GEM_VERSION'/g" lib/bandwidth-sdk/version.rb
55+
56+
- name: Install Packages and Test
57+
run: |
58+
bundle install
59+
rake
9860
99-
- name: Test
100-
run: rake
101-
10261
- name: Deploy to Rubygems
103-
uses: ./.github/actions/deploy
104-
env:
105-
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
106-
62+
run: |
63+
mkdir ~/.gem
64+
touch ~/.gem/credentials
65+
chmod 0600 ~/.gem/credentials
66+
printf -- "---\n:rubygems_api_key: ${{ secrets.RUBYGEMS_API_KEY }}\n" > ~/.gem/credentials
67+
gem build *.gemspec
68+
gem push *.gem
69+
10770
- uses: Bandwidth/[email protected]
10871
if: always()
10972
with:

.github/workflows/test-nightly.yml

+4-28
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Test Main and Feature Branch Nightly
1+
name: Test Main Branch Nightly
22

33
on:
44
schedule:
@@ -31,12 +31,12 @@ jobs:
3131
strategy:
3232
matrix:
3333
os: [windows-2022, windows-2019, ubuntu-20.04, ubuntu-22.04]
34-
ruby-version: [2.6, 2.7, 3.0]
34+
ruby-version: [2.7, 3.0, 3.1, 3.2]
3535
steps:
3636
- name: Checkout
3737
uses: actions/checkout@v3
3838
with:
39-
ref: 'main'
39+
ref: "main"
4040

4141
- name: Set up Ruby
4242
uses: ruby/setup-ruby@v1
@@ -47,37 +47,13 @@ jobs:
4747
run: |
4848
bundle install
4949
rake
50-
51-
test_feature:
52-
name: Test Feature Branch Nightly
53-
runs-on: ${{ matrix.os }}
54-
strategy:
55-
matrix:
56-
os: [windows-2022, windows-2019, ubuntu-20.04, ubuntu-22.04]
57-
ruby-version: [2.7, 3.0, 3.1, 3.2]
58-
steps:
59-
- name: Checkout
60-
uses: actions/checkout@v3
61-
with:
62-
ref: 'feature/openapi-generator-sdk'
63-
64-
- name: Set up Ruby
65-
uses: ruby/setup-ruby@v1
66-
with:
67-
ruby-version: ${{ matrix.ruby-version }}
68-
69-
- name: Install Packages and Test
7050
env:
7151
RUBY_VERSION: ${{ matrix.ruby-version }}
7252
OPERATING_SYSTEM: ${{ matrix.os }}
73-
GEM_VERSION: "11.0.0"
74-
run: |
75-
bundle install
76-
rake
7753

7854
notify_for_failures:
7955
name: Notify for Failures
80-
needs: [test_main, test_feature]
56+
needs: [test_main]
8157
if: failure()
8258
runs-on: ubuntu-latest
8359
steps:

.github/workflows/test-pr.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ env:
2424
MANTECA_APPLICATION_ID: ${{ secrets.MANTECA_APPLICATION_ID }}
2525

2626
jobs:
27-
test_pr_main:
27+
test_pr:
2828
name: Test PR
2929
runs-on: ${{ matrix.os }}
3030
strategy:
3131
matrix:
3232
os: [windows-2022, windows-2019, ubuntu-20.04, ubuntu-22.04]
33-
ruby-version: [2.6, 2.7, 3.0]
33+
ruby-version: [2.7, 3.0, 3.1, 3.2]
3434
steps:
3535
- name: Checkout
3636
uses: actions/checkout@v3
@@ -44,3 +44,6 @@ jobs:
4444
run: |
4545
bundle install
4646
rake
47+
env:
48+
RUBY_VERSION: ${{ matrix.ruby-version }}
49+
OPERATING_SYSTEM: ${{ matrix.os }}

.github/workflows/update-sdk.yml

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: Update SDK
2+
3+
on:
4+
schedule:
5+
- cron: "0 14 * * 2"
6+
workflow_dispatch:
7+
8+
jobs:
9+
update-sdk:
10+
name: Update SDK if Necessary
11+
runs-on: ubuntu-latest
12+
outputs:
13+
generate: ${{ steps.compare.outputs.generate }}
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v3
17+
18+
- name: Combine Product Specs
19+
uses: Bandwidth/[email protected]
20+
with:
21+
token: ${{ secrets.DX_GITHUB_TOKEN }}
22+
23+
- name: Determine if a New SDK is Needed
24+
id: compare
25+
run: |
26+
if cmp -s "bandwidth.yml" "api-specs/bandwidth.yml"; then :; else mv -f api-specs/bandwidth.yml bandwidth.yml; rm -r -f api-specs; echo "generate=true" >> $GITHUB_OUTPUT; fi
27+
28+
- name: Create JIRA Card for SDK Update
29+
if: ${{ steps.compare.outputs.generate == 'true' }}
30+
id: jira
31+
run: |
32+
JIRA_KEY=$(jq -r '.key' <<< $(curl -s -u $JIRA_USERNAME:$JIRA_TOKEN \
33+
-X POST https://bandwidth-jira.atlassian.net/rest/api/2/issue \
34+
-H "Content-Type: application/json" \
35+
--data-binary @- << EOF
36+
{
37+
"fields": {
38+
"project": {
39+
"key": "SWI"
40+
},
41+
"summary": "[$LANGUAGE] Update SDK for New Spec Version",
42+
"description": "Prepare the $LANGUAGE SDK for release based on the latest spec changes.",
43+
"issuetype": {
44+
"name": "Story"
45+
},
46+
"customfield_12108": "$LANGUAGE SDK is ready for release. Tests are created/updated if need be.",
47+
"customfield_10205": "$EPIC",
48+
"components": [{
49+
"name": "Client SDKs"
50+
}]
51+
}
52+
}
53+
EOF
54+
))
55+
echo "jira-key=$JIRA_KEY" >> $GITHUB_OUTPUT
56+
env:
57+
LANGUAGE: Ruby
58+
EPIC: SWI-1876
59+
JIRA_USERNAME: ${{ secrets.JIRA_USERNAME }}
60+
JIRA_TOKEN: ${{ secrets.JIRA_TOKEN }}
61+
62+
- name: Build SDK
63+
id: build
64+
if: ${{ startsWith(steps.jira.outputs.jira-key, 'SWI') }}
65+
uses: Bandwidth/[email protected]
66+
with:
67+
branch-name: ${{ steps.jira.outputs.jira-key }}
68+
token: ${{ secrets.DX_GITHUB_TOKEN }}
69+
openapi-generator-version: 7.0.0
70+
language: ruby
71+
config: ./openapi-config.yml
72+
73+
- name: Setup Ruby
74+
if: steps.build.outputs.changes
75+
uses: ruby/setup-ruby@v1
76+
with:
77+
ruby-version: "3.0"
78+
79+
- name: Clean SDK
80+
if: steps.build.outputs.changes
81+
run: |
82+
bundle install
83+
rubocop -A
84+
git add .
85+
git commit -m "Clean SDK using Rubocop"
86+
git push origin ${{ steps.jira.outputs.jira-key }}
87+
88+
- name: Open Pull Request
89+
if: steps.build.outputs.changes
90+
run: |
91+
gh pr create -B main -H Bandwidth:${{ steps.jira.outputs.jira-key }} -t '${{ steps.jira.outputs.jira-key }} Update SDK Based on Recent Spec Changes' -b 'Auto-generated by Update SDK Workflow'
92+
env:
93+
GITHUB_TOKEN: ${{ secrets.DX_GITHUB_TOKEN }}
94+
95+
notify-for-failures:
96+
name: Notify for Failures
97+
needs: [update-sdk]
98+
if: failure()
99+
runs-on: ubuntu-latest
100+
steps:
101+
- name: Notify Slack of Failures
102+
uses: Bandwidth/[email protected]
103+
with:
104+
job-status: failure
105+
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
106+
slack-channel: ${{ secrets.SLACK_CHANNEL }}

.gitignore

+41-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,41 @@
1-
Gemfile.lock
1+
# Generated by: https://openapi-generator.tech
2+
#
3+
4+
*.gem
5+
*.rbc
6+
/.config
7+
/coverage/
8+
/InstalledFiles
9+
/pkg/
10+
/spec/reports/
11+
/spec/examples.txt
12+
/test/tmp/
13+
/test/version_tmp/
14+
/tmp/
15+
16+
## Specific to RubyMotion:
17+
.dat*
18+
.repl_history
19+
build/
20+
21+
## Documentation cache and generated files:
22+
/.yardoc/
23+
/_yardoc/
24+
/doc/
25+
/rdoc/
26+
27+
## Environment normalization:
28+
/.bundle/
29+
/vendor/bundle
30+
/lib/bundler/man/
31+
32+
# for a library or gem, you might want to ignore these files since the code is
33+
# intended to run in multiple environments; otherwise, check them in:
34+
Gemfile.lock
35+
# .ruby-version
36+
# .ruby-gemset
37+
38+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
39+
.rvmrc
40+
41+
.DS_Store

.gitkeep

-4
This file was deleted.

0 commit comments

Comments
 (0)