Skip to content

Commit 446c463

Browse files
authored
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)
1 parent 6f3eab7 commit 446c463

File tree

298 files changed

+3090
-7638
lines changed

Some content is hidden

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

298 files changed

+3090
-7638
lines changed

.github/workflows/update-sdk.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
id: jira
4242
run: |
4343
JIRA_KEY=$(jq -r '.key' <<< $(curl -s -u $JIRA_USERNAME:$JIRA_TOKEN \
44-
-X POST https://415a76a1898d1ab9952165e173353bb1.m.pipedream.net \
44+
-X POST https://bandwidth-jira.atlassian.net/rest/api/2/issue \
4545
-H "Content-Type: application/json" \
4646
--data-binary @- << EOF
4747
{
@@ -102,8 +102,6 @@ jobs:
102102
- name: Open Pull Request
103103
if: steps.build.outputs.changes
104104
run: |
105-
sudo apt update
106-
sudo apt-get install -y hub
107-
hub pull-request -b Bandwidth:main -h Bandwidth:${{ steps.jira.outputs.jira-key }} -m '${{ steps.jira.outputs.jira-key }} Update SDK Based on Recent Spec Changes' -m 'Auto-generated by Update SDK Workflow'
105+
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'
108106
env:
109107
GITHUB_TOKEN: ${{ env.DX_GITHUB_TOKEN }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,5 @@ Gemfile.lock
3737

3838
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
3939
.rvmrc
40+
41+
.DS_Store

.openapi-generator-ignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# OpenAPI Generator Ignore
22
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
33

4-
/spec/spec_helper.rb
5-
/spec/configuration_spec.rb
6-
/spec/api_client_spec.rb
4+
/spec/**
75
Rakefile
86
.gitignore
7+
.rubocop.yml

.openapi-generator/FILES

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.gitlab-ci.yml
22
.rspec
3-
.rubocop.yml
43
.travis.yml
54
Gemfile
65
README.md

.rubocop.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ Layout/EmptyLinesAroundMethodBody:
4040
Layout/EmptyLinesAroundModuleBody:
4141
Enabled: true
4242

43+
Layout/EmptyLinesAroundBlockBody:
44+
Enabled: true
45+
4346
Layout/FirstArgumentIndentation:
4447
Enabled: true
4548

@@ -108,9 +111,17 @@ Layout/SpaceInsideParens:
108111
Enabled: true
109112

110113
# Check quotes usage according to lint rule below.
111-
#Style/StringLiterals:
112-
# Enabled: true
113-
# EnforcedStyle: single_quotes
114+
Style/StringLiterals:
115+
Enabled: true
116+
EnforcedStyle: single_quotes
117+
Exclude:
118+
- lib/bandwidth-sdk/api_client.rb
119+
- lib/bandwidth-sdk/configuration.rb
120+
121+
#Check quotes inside the string interpolation.
122+
Style/StringLiteralsInInterpolation:
123+
Enabled: true
124+
EnforcedStyle: single_quotes
114125

115126
# Detect hard tabs, no hard tabs.
116127
Layout/IndentationStyle:

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ group :development, :test do
66
gem 'rake', '~> 13.0.1'
77
gem 'pry-byebug'
88
gem 'rubocop', '~> 1.52.0'
9+
gem 'webmock', '~> 3.18.0'
10+
gem 'simplecov', '~> 0.21.2'
911
end

Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require "bundler/gem_tasks"
1+
require 'bundler/gem_tasks'
22

33
begin
44
require 'rspec/core/rake_task'

bandwidth-sdk.gemspec

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@ OpenAPI Generator version: 6.5.0
1212
1313
=end
1414

15-
$:.push File.expand_path("../lib", __FILE__)
16-
require "bandwidth-sdk/version"
15+
$:.push File.expand_path('../lib', __FILE__)
16+
require 'bandwidth-sdk/version'
1717

1818
Gem::Specification.new do |s|
19-
s.name = "bandwidth-sdk"
19+
s.name = 'bandwidth-sdk'
2020
s.version = Bandwidth::VERSION
2121
s.platform = Gem::Platform::RUBY
22-
s.authors = ["Bandwidth"]
23-
s.email = ["[email protected]"]
24-
s.homepage = "https://github.com/Bandwidth/ruby-sdk"
25-
s.summary = "Bandwidth Ruby SDK"
26-
s.description = "The official client SDK for Bandwidth&#39;s Voice, Messaging, MFA, and WebRTC APIs"
27-
s.license = "MIT"
28-
s.required_ruby_version = ">=2.7"
22+
s.authors = ['Bandwidth']
23+
s.email = ['[email protected]']
24+
s.homepage = 'https://github.com/Bandwidth/ruby-sdk'
25+
s.summary = 'Bandwidth Ruby SDK'
26+
s.description = 'The official client SDK for Bandwidth&#39;s Voice, Messaging, MFA, and WebRTC APIs'
27+
s.license = 'MIT'
28+
s.required_ruby_version = '>=2.7'
2929

3030
s.add_runtime_dependency 'faraday', '>= 1.0.1', '< 3.0'
3131
s.add_runtime_dependency 'faraday-multipart'
@@ -36,5 +36,5 @@ Gem::Specification.new do |s|
3636
s.files = `find *`.split("\n").uniq.sort.select { |f| !f.empty? }
3737
s.test_files = `find spec/*`.split("\n")
3838
s.executables = []
39-
s.require_paths = ["lib"]
39+
s.require_paths = ['lib']
4040
end

bandwidth.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ paths:
171171
- $ref: '#/components/parameters/sort'
172172
- $ref: '#/components/parameters/pageToken'
173173
- $ref: '#/components/parameters/limit'
174+
- $ref: '#/components/parameters/limitTotalCount'
174175
responses:
175176
'200':
176177
$ref: '#/components/responses/listMessagesResponse'
@@ -1237,7 +1238,9 @@ components:
12371238
properties:
12381239
totalCount:
12391240
type: integer
1240-
description: Total number of messages matched by the search.
1241+
description: >-
1242+
The total number of messages matched by the search. When the request
1243+
has limitTotalCount set to true this value is limited to 10,000.
12411244
example: 100
12421245
pageInfo:
12431246
$ref: '#/components/schemas/pageInfo'
@@ -1281,6 +1284,7 @@ components:
12811284
example: 9902
12821285
receiveTime:
12831286
type: string
1287+
format: date-time
12841288
description: The ISO 8601 datetime of the message.
12851289
example: 2020-04-07T14:03:07.000Z
12861290
carrierName:
@@ -1411,6 +1415,7 @@ components:
14111415
example: 93de2206-9669-4e07-948d-329f4b722ee2
14121416
time:
14131417
type: string
1418+
format: date-time
14141419
description: The datetime stamp of the message in ISO 8601
14151420
example: 2022-09-14T18:20:16.000Z
14161421
segmentCount:
@@ -3860,10 +3865,12 @@ components:
38603865
example: bridgeComplete
38613866
eventTime:
38623867
type: string
3868+
format: date-time
38633869
description: >-
38643870
The approximate UTC date and time when the event was generated by the
38653871
Bandwidth server, in ISO 8601 format. This may not be exactly the time
38663872
of event execution.
3873+
example: '2022-06-17T22:19:40.375Z'
38673874
accountId:
38683875
type: string
38693876
description: The user account associated with the call.
@@ -4952,6 +4959,19 @@ components:
49524959
schema:
49534960
type: integer
49544961
example: 50
4962+
limitTotalCount:
4963+
in: query
4964+
name: limitTotalCount
4965+
required: false
4966+
description: >-
4967+
When set to true, the response's totalCount field will have a maximum
4968+
value of 10,000. When set to false, or excluded, this will give an
4969+
accurate totalCount of all messages that match the provided filters. If
4970+
you are experiencing latency, try using this parameter to limit your
4971+
results.
4972+
example: true
4973+
schema:
4974+
type: boolean
49554975
callId:
49564976
name: callId
49574977
in: path

custom_templates/Gemfile.mustache

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ group :development, :test do
66
gem 'rake', '~> 13.0.1'
77
gem 'pry-byebug'
88
gem 'rubocop', '~> 1.52.0'
9+
gem 'webmock', '~> 3.18.0'
10+
gem 'simplecov', '~> 0.21.2'
911
end

0 commit comments

Comments
 (0)