ruby-bandwidth-iris 3.0.1 → 4.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE/bug_report.md +40 -0
- data/.github/ISSUE_TEMPLATE/config.yml +5 -0
- data/.github/workflows/deploy.yml +42 -0
- data/.github/workflows/release-draft.yml +19 -0
- data/.github/workflows/test.yml +38 -0
- data/Gemfile +2 -0
- data/README.md +5 -1
- data/examples/config.yml.example +1 -1
- data/lib/bandwidth-iris/client.rb +1 -2
- data/lib/bandwidth-iris/dlda.rb +2 -2
- data/lib/bandwidth-iris/in_service_number.rb +1 -1
- data/lib/bandwidth-iris/port_in.rb +2 -2
- data/lib/bandwidth-iris/sip_credential.rb +42 -0
- data/lib/bandwidth-iris/sip_peer.rb +2 -2
- data/lib/bandwidth-iris/tn.rb +5 -5
- data/lib/bandwidth-iris/version.rb +1 -1
- data/lib/ruby-bandwidth-iris.rb +1 -0
- data/ruby-bandwidth-iris.gemspec +1 -2
- data/spec/bandwidth-iris/client_spec.rb +6 -1
- data/spec/bandwidth-iris/sipcredential_spec.rb +54 -0
- data/spec/helper.rb +4 -4
- data/spec/xml.yml +2 -0
- metadata +13 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 373ed29bb9cd7ef9cd436aab511587a5a937f33bebde33773b56ac916b033119
|
4
|
+
data.tar.gz: ba88ef8c2ab05e21b1b6849f1578bed13367b9300949fae0fe78dfed54185402
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f690327563c59dd642d22fa0736c5acfa70a8f1f2e33d1543f7ce582ea9f0a379b680324ab2099da285b00109a9ad40b4cdd1bbe9abde0c9a70792fcc7a5b6e2
|
7
|
+
data.tar.gz: b121461b763ad2c51f7f4f225989b6c525c1f6d05d8b311ada7b2432b23d5e639fc4f763c70069423519d7668fd64b64b21cede50edf994b345540e1728c438e
|
@@ -0,0 +1,40 @@
|
|
1
|
+
---
|
2
|
+
name: Bug Report
|
3
|
+
about: Create a bug report
|
4
|
+
title: '[BUG] Description'
|
5
|
+
labels: 'bug'
|
6
|
+
---
|
7
|
+
|
8
|
+
### Checklist
|
9
|
+
- [ ] Have you provided a description of the bug?
|
10
|
+
- [ ] Have you provided your Environment information?
|
11
|
+
- [ ] Have you provided a sample code snippet?
|
12
|
+
- [ ] Have you provided a stack trace?
|
13
|
+
- [ ] Have you outlined the expected behavior?
|
14
|
+
|
15
|
+
### Description
|
16
|
+
<!-- Please provide a clear and concise description of the bug. -->
|
17
|
+
|
18
|
+
### Environment Information
|
19
|
+
<!-- Please provide the version of the OS, SDK, and Environment you are experiencing the bug in. -->
|
20
|
+
- OS Version: _(e.g. Windows 10)_
|
21
|
+
- SDK Version: _(e.g. 1.1.0)_
|
22
|
+
- Environment: _(e.g. Ruby 3.1.0)_
|
23
|
+
|
24
|
+
### Sample Code Snippet
|
25
|
+
<!-- Please provide a code snippet that produces or is relevant to the bug. -->
|
26
|
+
```ruby
|
27
|
+
# Sample Code Snippet
|
28
|
+
```
|
29
|
+
|
30
|
+
### Stack Trace
|
31
|
+
<!-- Please provide the stack trace that shows the bug. -->
|
32
|
+
```shell
|
33
|
+
# Stack Trace
|
34
|
+
```
|
35
|
+
|
36
|
+
### Expected Behavior
|
37
|
+
<!-- Please outline the expected behavior of the SDK. -->
|
38
|
+
|
39
|
+
### Suggested Fix
|
40
|
+
<!-- If you have a fix or a suggestion for how this bug may be resolved, describe it here. -->
|
@@ -0,0 +1,42 @@
|
|
1
|
+
name: Deploy SDK
|
2
|
+
|
3
|
+
on:
|
4
|
+
release:
|
5
|
+
types:
|
6
|
+
- published
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
deploy:
|
10
|
+
name: Deploy to Rubygems
|
11
|
+
if: ${{ !github.event.release.prerelease && github.event.release.target_commitish == 'master' }}
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
steps:
|
14
|
+
- name: Checkout
|
15
|
+
uses: actions/checkout@v2
|
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
|
+
run: rake
|
27
|
+
|
28
|
+
- name: Deploy to Rubygems
|
29
|
+
run: |
|
30
|
+
mkdir -p $HOME/.gem
|
31
|
+
touch $HOME/.gem/credentials
|
32
|
+
chmod 0600 $HOME/.gem/credentials
|
33
|
+
printf -- "---\n:rubygems_api_key: ${{ secrets.RUBYGEMS_API_KEY }}\n" > $HOME/.gem/credentials
|
34
|
+
gem build *.gemspec
|
35
|
+
gem push *.gem
|
36
|
+
|
37
|
+
- uses: Bandwidth/build-notify-slack-action@v1.0.0
|
38
|
+
if: always()
|
39
|
+
with:
|
40
|
+
job-status: ${{ job.status }}
|
41
|
+
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
|
42
|
+
slack-channel: ${{ secrets.SLACK_CHANNEL }}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
name: Create/update draft release
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- main
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
deploy:
|
10
|
+
name: deploy
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
steps:
|
13
|
+
- uses: actions/checkout@v2
|
14
|
+
# Drafts your next Release notes as Pull Requests are merged
|
15
|
+
- uses: release-drafter/release-drafter@v5
|
16
|
+
with:
|
17
|
+
config-name: draft_release.yml
|
18
|
+
env:
|
19
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
name: Test
|
2
|
+
|
3
|
+
on:
|
4
|
+
schedule:
|
5
|
+
- cron: "0 4 * * *"
|
6
|
+
pull_request:
|
7
|
+
workflow_dispatch:
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
name: Test
|
12
|
+
runs-on: ${{ matrix.os }}
|
13
|
+
strategy:
|
14
|
+
matrix:
|
15
|
+
os: [windows-2016, windows-2019, ubuntu-18.04, ubuntu-20.04]
|
16
|
+
ruby-version: [2.6, 2.7, 3.0]
|
17
|
+
steps:
|
18
|
+
- name: Checkout
|
19
|
+
uses: actions/checkout@v2
|
20
|
+
|
21
|
+
- name: Set up Ruby
|
22
|
+
uses: ruby/setup-ruby@v1
|
23
|
+
with:
|
24
|
+
ruby-version: ${{ matrix.ruby-version }}
|
25
|
+
|
26
|
+
- name: Install Packages
|
27
|
+
run: bundle install
|
28
|
+
|
29
|
+
- name: Test
|
30
|
+
run: rake
|
31
|
+
|
32
|
+
- name: Notify Slack of Failures
|
33
|
+
uses: Bandwidth/build-notify-slack-action@v1.0.0
|
34
|
+
if: failure() && !github.event.pull_request.draft
|
35
|
+
with:
|
36
|
+
job-status: ${{ job.status }}
|
37
|
+
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
|
38
|
+
slack-channel: ${{ secrets.SLACK_CHANNEL }}
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -20,6 +20,9 @@ Ruby Client library for IRIS / BBS API
|
|
20
20
|
| 2.6.0 | Added Emergency Calling Notification, Emergeny Notification Group, Emergency Notification Endpoint, and Alternate End User Identity methods |
|
21
21
|
| 2.7.0 | Added TNOptions endpoints |
|
22
22
|
| 3.0.0 | Removed functionality that causes an error to be raised when some type of `error` field is returned in the XML body response. This change reduces the situations that cause an error to be thrown to simply be 4XX and 5XX http responses. This change was made to improve communication when an error is found. Please update your code to handle this change. |
|
23
|
+
| 3.0.2 | Fixed an incorrect retrieval of DLDA objects |
|
24
|
+
| 4.0.0 | Removed certify gem. Users will now need to set their own SSL settings |
|
25
|
+
| 4.1.0 | Added support for SIP credentials.
|
23
26
|
|
24
27
|
### 3.x.x release
|
25
28
|
|
@@ -459,6 +462,7 @@ BandwidthIris::RateCenter.list(query)
|
|
459
462
|
|
460
463
|
## SIP Peers
|
461
464
|
### Create SIP Peer
|
465
|
+
A Sip Peer is what is called Location in the web UI.
|
462
466
|
```ruby
|
463
467
|
data = {
|
464
468
|
:peer_name => "A New SIP Peer",
|
@@ -521,7 +525,7 @@ sipPeer.move_tns(numbers_to_move)
|
|
521
525
|
## Sites
|
522
526
|
|
523
527
|
### Create A Site
|
524
|
-
A site is what is called
|
528
|
+
A site is what is called Sub-Account in the web UI.
|
525
529
|
```ruby
|
526
530
|
site = {
|
527
531
|
:name =>"A new site",
|
data/examples/config.yml.example
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'faraday'
|
2
2
|
require 'faraday_middleware'
|
3
|
-
require 'certified'
|
4
3
|
require 'active_support/xml_mini'
|
5
4
|
require 'active_support/core_ext/hash/conversions'
|
6
5
|
require 'active_support/core_ext/string/inflections'
|
@@ -29,7 +28,7 @@ module BandwidthIris
|
|
29
28
|
@set_adapter = lambda {|faraday| faraday.adapter(Faraday.default_adapter)}
|
30
29
|
@create_connection = lambda{||
|
31
30
|
Faraday.new(api_endpoint) { |faraday|
|
32
|
-
faraday.basic_auth
|
31
|
+
faraday.request :basic_auth, user_name, password
|
33
32
|
#faraday.response :logger
|
34
33
|
faraday.headers['Accept'] = 'application/xml'
|
35
34
|
faraday.headers['user-agent'] = 'Ruby-Bandwidth-Iris'
|
data/lib/bandwidth-iris/dlda.rb
CHANGED
@@ -17,8 +17,8 @@ module BandwidthIris
|
|
17
17
|
wrap_client_arg :list
|
18
18
|
|
19
19
|
def self.get(client, id)
|
20
|
-
data = client.make_request(:get, "#{client.concat_account_path(DLDA_PATH)}/#{id}")[0]
|
21
|
-
data[:id] = data[:order_id]
|
20
|
+
data = client.make_request(:get, "#{client.concat_account_path(DLDA_PATH)}/#{id}")[0]
|
21
|
+
data[:id] = data[:dlda_order][:order_id]
|
22
22
|
Dlda.new(data, client)
|
23
23
|
end
|
24
24
|
wrap_client_arg :get
|
@@ -11,7 +11,7 @@ module BandwidthIris
|
|
11
11
|
wrap_client_arg :list
|
12
12
|
|
13
13
|
def self.get(client, number)
|
14
|
-
client.make_request(:get, "#{client.concat_account_path(INSERVICE_NUMBER_PATH)}/#{
|
14
|
+
client.make_request(:get, "#{client.concat_account_path(INSERVICE_NUMBER_PATH)}/#{CGI.escape(number)}")[0]
|
15
15
|
end
|
16
16
|
wrap_client_arg :get
|
17
17
|
|
@@ -64,12 +64,12 @@ module BandwidthIris
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def get_file_metadata(file_name)
|
67
|
-
@client.make_request(:get, "#{@client.concat_account_path(PORT_IN_PATH)}/#{id}/#{LOAS_PATH}/#{
|
67
|
+
@client.make_request(:get, "#{@client.concat_account_path(PORT_IN_PATH)}/#{id}/#{LOAS_PATH}/#{CGI.escape(file_name)}/metadata")[0]
|
68
68
|
end
|
69
69
|
|
70
70
|
def get_file(file_name)
|
71
71
|
connection = @client.create_connection()
|
72
|
-
response = connection.get("/#{@client.api_version}#{@client.concat_account_path(PORT_IN_PATH)}/#{id}/#{LOAS_PATH}/#{
|
72
|
+
response = connection.get("/#{@client.api_version}#{@client.concat_account_path(PORT_IN_PATH)}/#{id}/#{LOAS_PATH}/#{CGI.escape(file_name)}")
|
73
73
|
[response.body, response.headers['Content-Type'] || 'application/octet-stream']
|
74
74
|
end
|
75
75
|
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module BandwidthIris
|
2
|
+
SIP_CREDENTIAL_PATH = 'sipcredentials'
|
3
|
+
|
4
|
+
class SipCredential
|
5
|
+
extend ClientWrapper
|
6
|
+
include ApiItem
|
7
|
+
|
8
|
+
def self.list(client, query = nil)
|
9
|
+
list = client.make_request(:get, client.concat_account_path(SIP_CREDENTIAL_PATH), query)[0][:sip_credential]
|
10
|
+
list = if list.is_a?(Array) then list else [list] end
|
11
|
+
list.map do |i|
|
12
|
+
SipCredential.new(i, client)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
wrap_client_arg :list
|
16
|
+
|
17
|
+
def self.get(client, id)
|
18
|
+
data = client.make_request(:get, "#{client.concat_account_path(SIP_CREDENTIAL_PATH)}/#{id}")[0]
|
19
|
+
SipCredential.new(data[:sip_credential], client)
|
20
|
+
end
|
21
|
+
wrap_client_arg :get
|
22
|
+
|
23
|
+
def self.create(client, item)
|
24
|
+
data = client.make_request(
|
25
|
+
:post,
|
26
|
+
client.concat_account_path(SIP_CREDENTIAL_PATH),
|
27
|
+
{ :sip_credentials => { :sip_credential => item } }
|
28
|
+
)[0][:valid_sip_credentials]
|
29
|
+
SipCredential.new(data[:sip_credential], client)
|
30
|
+
end
|
31
|
+
wrap_client_arg :create
|
32
|
+
|
33
|
+
|
34
|
+
def update(data)
|
35
|
+
@client.make_request(:put,"#{@client.concat_account_path(SIP_CREDENTIAL_PATH)}/#{user_name}", {:sip_credential => data})
|
36
|
+
end
|
37
|
+
|
38
|
+
def delete
|
39
|
+
@client.make_request(:delete,"#{@client.concat_account_path(SIP_CREDENTIAL_PATH)}/#{user_name}")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -26,7 +26,7 @@ module BandwidthIris
|
|
26
26
|
|
27
27
|
|
28
28
|
def get_tns(number = nil)
|
29
|
-
r = @client.make_request(:get,"#{@client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{id}/tns#{if number then '/' +
|
29
|
+
r = @client.make_request(:get,"#{@client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{id}/tns#{if number then '/' + CGI.escape(number) else '' end}")[0]
|
30
30
|
if number
|
31
31
|
r[:sip_peer_telephone_number]
|
32
32
|
else
|
@@ -37,7 +37,7 @@ module BandwidthIris
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def update_tns(number, data)
|
40
|
-
@client.make_request(:put,"#{@client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{id}/tns/#{
|
40
|
+
@client.make_request(:put,"#{@client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{id}/tns/#{CGI.escape(number)}", {:sip_peer_telephone_number => data})[0]
|
41
41
|
end
|
42
42
|
|
43
43
|
def move_tns(numbers)
|
data/lib/bandwidth-iris/tn.rb
CHANGED
@@ -6,7 +6,7 @@ module BandwidthIris
|
|
6
6
|
include ApiItem
|
7
7
|
|
8
8
|
def self.get(client, number)
|
9
|
-
data = client.make_request(:get, "#{TN_PATH}/#{
|
9
|
+
data = client.make_request(:get, "#{TN_PATH}/#{CGI.escape(number)}")[0]
|
10
10
|
Tn.new(data, client)
|
11
11
|
end
|
12
12
|
wrap_client_arg :get
|
@@ -23,19 +23,19 @@ module BandwidthIris
|
|
23
23
|
wrap_client_arg :list
|
24
24
|
|
25
25
|
def get_sites()
|
26
|
-
@client.make_request(:get, "#{TN_PATH}/#{
|
26
|
+
@client.make_request(:get, "#{TN_PATH}/#{CGI.escape(telephone_number)}/sites")[0]
|
27
27
|
end
|
28
28
|
|
29
29
|
def get_sip_peers()
|
30
|
-
@client.make_request(:get, "#{TN_PATH}/#{
|
30
|
+
@client.make_request(:get, "#{TN_PATH}/#{CGI.escape(telephone_number)}/sippeers")[0]
|
31
31
|
end
|
32
32
|
|
33
33
|
def get_rate_center()
|
34
|
-
@client.make_request(:get, "#{TN_PATH}/#{
|
34
|
+
@client.make_request(:get, "#{TN_PATH}/#{CGI.escape(telephone_number)}/ratecenter")[0][:telephone_number_details]
|
35
35
|
end
|
36
36
|
|
37
37
|
def get_details()
|
38
|
-
@client.make_request(:get, "#{TN_PATH}/#{
|
38
|
+
@client.make_request(:get, "#{TN_PATH}/#{CGI.escape(telephone_number)}/tndetails")[0][:telephone_number_details]
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
data/lib/ruby-bandwidth-iris.rb
CHANGED
@@ -20,6 +20,7 @@ require 'bandwidth-iris/order'
|
|
20
20
|
require 'bandwidth-iris/port_in'
|
21
21
|
require 'bandwidth-iris/port_out'
|
22
22
|
require 'bandwidth-iris/rate_center'
|
23
|
+
require 'bandwidth-iris/sip_credential'
|
23
24
|
require 'bandwidth-iris/sip_peer'
|
24
25
|
require 'bandwidth-iris/site'
|
25
26
|
require 'bandwidth-iris/subscription'
|
data/ruby-bandwidth-iris.gemspec
CHANGED
@@ -18,8 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.add_dependency "faraday"
|
19
19
|
spec.add_dependency "faraday_middleware"
|
20
20
|
spec.add_dependency "nori"
|
21
|
-
spec.add_dependency "activesupport","
|
22
|
-
spec.add_dependency "certified"
|
21
|
+
spec.add_dependency "activesupport", "~> 4.2.7"
|
23
22
|
|
24
23
|
spec.add_development_dependency "bundler", ">= 1.3"
|
25
24
|
spec.add_development_dependency "rake", ">= 11.1.0"
|
@@ -46,7 +46,6 @@ describe BandwidthIris::Client do
|
|
46
46
|
it 'should create new faraday connection' do
|
47
47
|
connection = client.create_connection()
|
48
48
|
expect(connection).to be_a(Faraday::Connection)
|
49
|
-
expect(connection.headers['Authorization']).to eql("Basic #{Base64.strict_encode64('username:password')}")
|
50
49
|
end
|
51
50
|
end
|
52
51
|
|
@@ -60,6 +59,12 @@ describe BandwidthIris::Client do
|
|
60
59
|
client.stubs.verify_stubbed_calls()
|
61
60
|
end
|
62
61
|
|
62
|
+
it 'should pass basic auth headers' do
|
63
|
+
# Note: This endpoint does not exist. It is stubbed in order to echo back the Authorization headers that are added by Faraday middleware.
|
64
|
+
client.stubs.get('/v1.0/test-auth') { |env| [200, {}, "<Result><EchoedAuth>#{env[:request_headers]['Authorization']}</EchoedAuth></Result>"] }
|
65
|
+
expect(client.make_request(:get, '/test-auth')).to eql([{:echoed_auth=>"Basic #{Base64.strict_encode64('username:password')}"}, {}])
|
66
|
+
end
|
67
|
+
|
63
68
|
it 'should make GET request and return xml data' do
|
64
69
|
client.stubs.get('/v1.0/path1') { |env| [200, {}, '<Result><Test>data</Test></Result>'] }
|
65
70
|
client.stubs.get('/v1.0/path2?testField=10') { |env| [200, {'Location'=>'url'}, '<Root><TestValue>10</TestValue><DataArray>1</DataArray><DataArray>2</DataArray><BoolValue>true</BoolValue><BoolValue2>false</BoolValue2><DateTimeValue>2015-05-29T01:02:03Z</DateTimeValue></Root>'] }
|
@@ -0,0 +1,54 @@
|
|
1
|
+
describe BandwidthIris::SipCredential do
|
2
|
+
client = nil
|
3
|
+
|
4
|
+
before :each do
|
5
|
+
client = Helper.get_client()
|
6
|
+
end
|
7
|
+
|
8
|
+
after :each do
|
9
|
+
client.stubs.verify_stubbed_calls()
|
10
|
+
end
|
11
|
+
|
12
|
+
describe '#list' do
|
13
|
+
it 'should return sip credentials' do
|
14
|
+
client.stubs.get('/v1.0/accounts/accountId/sipcredentials') {|env| [200, {}, Helper.xml['sip_credentials']]}
|
15
|
+
list = SipCredential.list(client)
|
16
|
+
expect(list.length).to eql(1)
|
17
|
+
expect(list[0][:user_name]).to eql(1)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe '#get' do
|
22
|
+
it 'should return a sip credential' do
|
23
|
+
client.stubs.get('/v1.0/accounts/accountId/sipcredentials/1') {|env| [200, {}, Helper.xml['sip_credentials']]}
|
24
|
+
item = SipCredential.get(client, 1)
|
25
|
+
expect(item[:user_name]).to eql(1)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe '#create' do
|
30
|
+
it 'should create a sip credential' do
|
31
|
+
data = {:name => "test", :description => "test"}
|
32
|
+
client.stubs.post('/v1.0/accounts/accountId/sipcredentials', client.build_xml({:sip_credentials => { sip_credential: data }})) {|env| [200, {}, Helper.xml['valid_sip_credentials']]}
|
33
|
+
item = SipCredential.create(client, data)
|
34
|
+
expect(item[:user_name]).to eql(1)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe '#update' do
|
39
|
+
it 'should update a sip credential' do
|
40
|
+
data = {:hash1 => "1g32gadgs433dd4"}
|
41
|
+
client.stubs.put('/v1.0/accounts/accountId/sipcredentials/1', client.build_xml({:sip_credential => data})) {|env| [200, {}, '']}
|
42
|
+
item = SipCredential.new({:user_name => 1}, client)
|
43
|
+
item.update(data)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe '#delete' do
|
48
|
+
it 'should remove a sip credential' do
|
49
|
+
client.stubs.delete('/v1.0/accounts/accountId/sipcredentials/1') {|env| [200, {}, '']}
|
50
|
+
item = SipCredential.new({:user_name => 1}, client)
|
51
|
+
item.delete
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
data/spec/helper.rb
CHANGED
@@ -2,10 +2,10 @@ require 'simplecov'
|
|
2
2
|
require 'coveralls'
|
3
3
|
require 'yaml'
|
4
4
|
|
5
|
-
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter::new
|
6
|
+
SimpleCov::Formatter::HTMLFormatter
|
7
|
+
Coveralls::SimpleCov::Formatter
|
8
|
+
|
9
9
|
SimpleCov.start()
|
10
10
|
|
11
11
|
require 'ruby-bandwidth-iris'
|
data/spec/xml.yml
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
---
|
2
2
|
sites: "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><SitesResponse><Sites><Site><Id>1</Id><Name>Test Site</Name><Description>A site description</Description></Site></Sites></SitesResponse>"
|
3
3
|
site: "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><SiteResponse><Site><Id>1</Id><Name>Test Site</Name><Description>A Site Description</Description><Address><HouseNumber>900</HouseNumber><StreetName>Main Campus Drive</StreetName><City>Raleigh</City><StateCode>NC</StateCode><Zip>27615</Zip><Country>United States</Country><AddressType>Service</AddressType></Address></Site></SiteResponse>"
|
4
|
+
sip_credentials: "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><SipCredentialsResponse><SipCredential><UserName>1</UserName></SipCredential></SipCredentialsResponse>"
|
5
|
+
valid_sip_credentials: "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><SipCredentialsResponse><ValidSipCredentials><SipCredential><UserName>1</UserName></SipCredential></ValidSipCredentials></SipCredentialsResponse>"
|
4
6
|
sip_peers: "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><TNSipPeersResponse><SipPeers><SipPeer xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"SipPeer\"><PeerId>12345</PeerId><PeerName>SIP Peer 1</PeerName><Description>Sip Peer 1 description</Description><IsDefaultPeer>true</IsDefaultPeer><ShortMessagingProtocol>SIP</ShortMessagingProtocol><VoiceHosts><Host><HostName>70.62.112.156</HostName></Host></VoiceHosts><VoiceHostGroups/><SmsHosts><Host><HostName>70.62.112.156</HostName></Host></SmsHosts><TerminationHosts><TerminationHost><HostName>70.62.112.156</HostName><Port>5060</Port><CustomerTrafficAllowed>DOMESTIC</CustomerTrafficAllowed><DataAllowed>true</DataAllowed></TerminationHost></TerminationHosts><CallingName><Display>true</Display><Enforced>false</Enforced></CallingName></SipPeer></SipPeers></TNSipPeersResponse>"
|
5
7
|
sip_peer: "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><SipPeerResponse><SipPeer><PeerId>10</PeerId><PeerName>SIP Peer 1</PeerName><Description>Sip Peer 1 description</Description><IsDefaultPeer>true</IsDefaultPeer><ShortMessagingProtocol>SIP</ShortMessagingProtocol><VoiceHosts/><VoiceHostGroups/><SmsHosts/><TerminationHosts/><CallingName><Display>true</Display><Enforced>false</Enforced></CallingName></SipPeer></SipPeerResponse>"
|
6
8
|
sip_peer_tns: "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><SipPeerTelephoneNumbersResponse><SipPeerTelephoneNumbers><SipPeerTelephoneNumber><FullNumber>3034162216</FullNumber></SipPeerTelephoneNumber><SipPeerTelephoneNumber><FullNumber>3034162218</FullNumber></SipPeerTelephoneNumber><SipPeerTelephoneNumber><FullNumber>3034162227</FullNumber></SipPeerTelephoneNumber><SipPeerTelephoneNumber><FullNumber>7025097265</FullNumber></SipPeerTelephoneNumber><SipPeerTelephoneNumber><FullNumber>3034162212</FullNumber></SipPeerTelephoneNumber><SipPeerTelephoneNumber><FullNumber>7024759964</FullNumber></SipPeerTelephoneNumber><SipPeerTelephoneNumber><FullNumber>3034162226</FullNumber></SipPeerTelephoneNumber><SipPeerTelephoneNumber><FullNumber>3034162231</FullNumber></SipPeerTelephoneNumber><SipPeerTelephoneNumber><FullNumber>3034162223</FullNumber></SipPeerTelephoneNumber><SipPeerTelephoneNumber><FullNumber>2143770078</FullNumber></SipPeerTelephoneNumber><SipPeerTelephoneNumber><FullNumber>3302699968</FullNumber></SipPeerTelephoneNumber><SipPeerTelephoneNumber><FullNumber>8665711365</FullNumber></SipPeerTelephoneNumber><SipPeerTelephoneNumber><FullNumber>9284448929</FullNumber></SipPeerTelephoneNumber><SipPeerTelephoneNumber><FullNumber>3302710174</FullNumber></SipPeerTelephoneNumber><SipPeerTelephoneNumber><FullNumber>7024797571</FullNumber></SipPeerTelephoneNumber><SipPeerTelephoneNumber><FullNumber>7025091999</FullNumber></SipPeerTelephoneNumber><SipPeerTelephoneNumber><FullNumber>7022579119</FullNumber></SipPeerTelephoneNumber></SipPeerTelephoneNumbers></SipPeerTelephoneNumbersResponse>"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-bandwidth-iris
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Belchikov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: builder
|
@@ -70,30 +70,16 @@ dependencies:
|
|
70
70
|
name: activesupport
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 4.2.7
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 4.2.7
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: certified
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :runtime
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
84
|
name: bundler
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -143,6 +129,11 @@ extensions: []
|
|
143
129
|
extra_rdoc_files: []
|
144
130
|
files:
|
145
131
|
- ".editorconfig"
|
132
|
+
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
133
|
+
- ".github/ISSUE_TEMPLATE/config.yml"
|
134
|
+
- ".github/workflows/deploy.yml"
|
135
|
+
- ".github/workflows/release-draft.yml"
|
136
|
+
- ".github/workflows/test.yml"
|
146
137
|
- ".gitignore"
|
147
138
|
- ".rspec"
|
148
139
|
- ".travis.yml"
|
@@ -195,6 +186,7 @@ files:
|
|
195
186
|
- lib/bandwidth-iris/port_out.rb
|
196
187
|
- lib/bandwidth-iris/rate_center.rb
|
197
188
|
- lib/bandwidth-iris/remove_imported_tn_orders.rb
|
189
|
+
- lib/bandwidth-iris/sip_credential.rb
|
198
190
|
- lib/bandwidth-iris/sip_peer.rb
|
199
191
|
- lib/bandwidth-iris/sip_peer_products.rb
|
200
192
|
- lib/bandwidth-iris/site.rb
|
@@ -235,6 +227,7 @@ files:
|
|
235
227
|
- spec/bandwidth-iris/remove_imported_tn_orders_spec.rb
|
236
228
|
- spec/bandwidth-iris/sip_peer_products_spec.rb
|
237
229
|
- spec/bandwidth-iris/sip_peer_spec.rb
|
230
|
+
- spec/bandwidth-iris/sipcredential_spec.rb
|
238
231
|
- spec/bandwidth-iris/site_spec.rb
|
239
232
|
- spec/bandwidth-iris/subscription_spec.rb
|
240
233
|
- spec/bandwidth-iris/tn_options_spec.rb
|
@@ -262,7 +255,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
262
255
|
- !ruby/object:Gem::Version
|
263
256
|
version: '0'
|
264
257
|
requirements: []
|
265
|
-
rubygems_version: 3.
|
258
|
+
rubygems_version: 3.2.32
|
266
259
|
signing_key:
|
267
260
|
specification_version: 4
|
268
261
|
summary: Gem for integrating to Bandwidth's Iris API
|
@@ -296,6 +289,7 @@ test_files:
|
|
296
289
|
- spec/bandwidth-iris/remove_imported_tn_orders_spec.rb
|
297
290
|
- spec/bandwidth-iris/sip_peer_products_spec.rb
|
298
291
|
- spec/bandwidth-iris/sip_peer_spec.rb
|
292
|
+
- spec/bandwidth-iris/sipcredential_spec.rb
|
299
293
|
- spec/bandwidth-iris/site_spec.rb
|
300
294
|
- spec/bandwidth-iris/subscription_spec.rb
|
301
295
|
- spec/bandwidth-iris/tn_options_spec.rb
|