ruby-bandwidth-iris 3.0.2 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/CODEOWNERS +2 -0
- 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/test.yml +38 -0
- data/Gemfile +2 -0
- data/README.md +2 -0
- data/examples/config.yml.example +1 -1
- data/lib/bandwidth-iris/client.rb +3 -3
- data/lib/bandwidth-iris/dlda.rb +1 -1
- data/lib/bandwidth-iris/errors.rb +18 -6
- 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 -1
- 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 +16 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 357817b797657f2774dcc40552d77a0cb89f40af087ff1ae2b0034be3705a940
|
4
|
+
data.tar.gz: ac3b0522e1bd592dfdadb14ec58cf38e9089e25b74316a912e03458eb8be47a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25debb84b4997bef6beb4863eec6db8fc33f472bab4aacb160dec6435abdb26aeb1e0c5a3f73dc1168a5624cd0604bb9c37b65eecd4700f69e5726550a503fce
|
7
|
+
data.tar.gz: 1c5c4ed9c913d524336887cf618e76c6685d567f565246b8b6770f5f794714b6955ee4ef53341a602d7520dd7e20c36aa86534a4d80a0e785b648efcc9eeb8f4
|
data/.github/CODEOWNERS
ADDED
@@ -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,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-2022, 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
@@ -21,6 +21,8 @@ Ruby Client library for IRIS / BBS API
|
|
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
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.
|
24
26
|
|
25
27
|
### 3.x.x release
|
26
28
|
|
data/examples/config.yml.example
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'faraday'
|
2
2
|
require 'faraday_middleware'
|
3
|
-
require '
|
3
|
+
require 'active_support'
|
4
4
|
require 'active_support/xml_mini'
|
5
5
|
require 'active_support/core_ext/hash/conversions'
|
6
6
|
require 'active_support/core_ext/string/inflections'
|
@@ -29,7 +29,7 @@ module BandwidthIris
|
|
29
29
|
@set_adapter = lambda {|faraday| faraday.adapter(Faraday.default_adapter)}
|
30
30
|
@create_connection = lambda{||
|
31
31
|
Faraday.new(api_endpoint) { |faraday|
|
32
|
-
faraday.basic_auth
|
32
|
+
faraday.request :basic_auth, user_name, password
|
33
33
|
#faraday.response :logger
|
34
34
|
faraday.headers['Accept'] = 'application/xml'
|
35
35
|
faraday.headers['user-agent'] = 'Ruby-Bandwidth-Iris'
|
@@ -120,7 +120,7 @@ module BandwidthIris
|
|
120
120
|
# @param response response object
|
121
121
|
def check_response(response)
|
122
122
|
parsed_body = parse_xml(response.body || '')
|
123
|
-
raise Errors::GenericError.new(
|
123
|
+
raise Errors::GenericError.new(response.status, response.reason_phrase, response.headers, parsed_body) if response.status >= 400
|
124
124
|
parsed_body
|
125
125
|
end
|
126
126
|
|
data/lib/bandwidth-iris/dlda.rb
CHANGED
@@ -18,7 +18,7 @@ module BandwidthIris
|
|
18
18
|
|
19
19
|
def self.get(client, id)
|
20
20
|
data = client.make_request(:get, "#{client.concat_account_path(DLDA_PATH)}/#{id}")[0]
|
21
|
-
data[:id] = data[:order_id]
|
21
|
+
data[:id] = data[:dlda_order][:order_id]
|
22
22
|
Dlda.new(data, client)
|
23
23
|
end
|
24
24
|
wrap_client_arg :get
|
@@ -2,17 +2,29 @@ module BandwidthIris
|
|
2
2
|
module Errors
|
3
3
|
# Generic error class
|
4
4
|
class GenericError < StandardError
|
5
|
+
# @return [String] HTTP status code
|
6
|
+
attr_reader :http_status
|
7
|
+
|
8
|
+
# return [String] Reason
|
9
|
+
attr_reader :reason
|
10
|
+
|
11
|
+
# return [Hash] Headers
|
12
|
+
attr_reader :headers
|
13
|
+
|
14
|
+
# return [Hash] Body
|
15
|
+
attr_reader :body
|
16
|
+
|
5
17
|
# @return [String] Error code
|
6
18
|
attr_reader :code
|
7
19
|
|
8
|
-
# @return [String] Http status code
|
9
|
-
attr_reader :http_status
|
10
|
-
|
11
20
|
# @api private
|
12
|
-
def initialize
|
13
|
-
super message
|
14
|
-
@code = code
|
21
|
+
def initialize http_status, reason, headers, body
|
15
22
|
@http_status = http_status
|
23
|
+
@reason = reason
|
24
|
+
@headers = headers
|
25
|
+
@body = body
|
26
|
+
@code = '' # Iris Error Code can be accessed with body[:error][:code]
|
27
|
+
super message = "Http code #{@http_status}"
|
16
28
|
end
|
17
29
|
end
|
18
30
|
|
@@ -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
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.add_dependency "faraday_middleware"
|
20
20
|
spec.add_dependency "nori"
|
21
21
|
spec.add_dependency "activesupport",">= 4.2.7"
|
22
|
-
spec.add_dependency "
|
22
|
+
spec.add_dependency "rexml"
|
23
23
|
|
24
24
|
spec.add_development_dependency "bundler", ">= 1.3"
|
25
25
|
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.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Belchikov
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: builder
|
@@ -81,7 +81,7 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 4.2.7
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: rexml
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
@@ -137,12 +137,17 @@ dependencies:
|
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
description: Gem for integrating to Bandwidth's Iris API
|
140
|
-
email:
|
140
|
+
email:
|
141
141
|
executables: []
|
142
142
|
extensions: []
|
143
143
|
extra_rdoc_files: []
|
144
144
|
files:
|
145
145
|
- ".editorconfig"
|
146
|
+
- ".github/CODEOWNERS"
|
147
|
+
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
148
|
+
- ".github/ISSUE_TEMPLATE/config.yml"
|
149
|
+
- ".github/workflows/deploy.yml"
|
150
|
+
- ".github/workflows/test.yml"
|
146
151
|
- ".gitignore"
|
147
152
|
- ".rspec"
|
148
153
|
- ".travis.yml"
|
@@ -195,6 +200,7 @@ files:
|
|
195
200
|
- lib/bandwidth-iris/port_out.rb
|
196
201
|
- lib/bandwidth-iris/rate_center.rb
|
197
202
|
- lib/bandwidth-iris/remove_imported_tn_orders.rb
|
203
|
+
- lib/bandwidth-iris/sip_credential.rb
|
198
204
|
- lib/bandwidth-iris/sip_peer.rb
|
199
205
|
- lib/bandwidth-iris/sip_peer_products.rb
|
200
206
|
- lib/bandwidth-iris/site.rb
|
@@ -235,6 +241,7 @@ files:
|
|
235
241
|
- spec/bandwidth-iris/remove_imported_tn_orders_spec.rb
|
236
242
|
- spec/bandwidth-iris/sip_peer_products_spec.rb
|
237
243
|
- spec/bandwidth-iris/sip_peer_spec.rb
|
244
|
+
- spec/bandwidth-iris/sipcredential_spec.rb
|
238
245
|
- spec/bandwidth-iris/site_spec.rb
|
239
246
|
- spec/bandwidth-iris/subscription_spec.rb
|
240
247
|
- spec/bandwidth-iris/tn_options_spec.rb
|
@@ -247,7 +254,7 @@ homepage: https://github.com/bandwidthcom/ruby-bandwidth-iris
|
|
247
254
|
licenses:
|
248
255
|
- MIT
|
249
256
|
metadata: {}
|
250
|
-
post_install_message:
|
257
|
+
post_install_message:
|
251
258
|
rdoc_options: []
|
252
259
|
require_paths:
|
253
260
|
- lib
|
@@ -262,8 +269,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
262
269
|
- !ruby/object:Gem::Version
|
263
270
|
version: '0'
|
264
271
|
requirements: []
|
265
|
-
rubygems_version: 3.
|
266
|
-
signing_key:
|
272
|
+
rubygems_version: 3.2.33
|
273
|
+
signing_key:
|
267
274
|
specification_version: 4
|
268
275
|
summary: Gem for integrating to Bandwidth's Iris API
|
269
276
|
test_files:
|
@@ -296,6 +303,7 @@ test_files:
|
|
296
303
|
- spec/bandwidth-iris/remove_imported_tn_orders_spec.rb
|
297
304
|
- spec/bandwidth-iris/sip_peer_products_spec.rb
|
298
305
|
- spec/bandwidth-iris/sip_peer_spec.rb
|
306
|
+
- spec/bandwidth-iris/sipcredential_spec.rb
|
299
307
|
- spec/bandwidth-iris/site_spec.rb
|
300
308
|
- spec/bandwidth-iris/subscription_spec.rb
|
301
309
|
- spec/bandwidth-iris/tn_options_spec.rb
|