ruby-bandwidth-iris 5.1.0 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +22 -0
- data/lib/bandwidth-iris/errors.rb +1 -2
- data/lib/bandwidth-iris/sip_peer.rb +6 -6
- data/lib/bandwidth-iris/site.rb +3 -2
- data/lib/bandwidth-iris/version.rb +1 -1
- data/spec/bandwidth-iris/client_spec.rb +0 -1
- data/spec/bandwidth-iris/sip_peer_spec.rb +8 -8
- data/spec/bandwidth-iris/site_spec.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a078992d099b9230e03bf89a886d2a20722f589487fe42cf60870cf8d58a78f2
|
4
|
+
data.tar.gz: 16a89092f0ade496f0fe8f7b38bfe99aa33262dda8c5d2ecde7d3108fd692ace
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55cec4a52822fac10792cd040b6837acc876241dbeb7cfb7e238b1a699e00ebe3ca7ecc60b32915180edf370009dfa9d021fd5ba31f6a6a82d1e455f9206a180
|
7
|
+
data.tar.gz: b313d0f487d7816a73a0631c863b44a3b8ca3f35154562265dd625c2f0671367c4dcad04cb8da8d823ce8b6ba8d68e494a3fb628604d3779cf5107c5c782e516
|
data/README.md
CHANGED
@@ -510,6 +510,28 @@ BandwidthIris::SipPeer.list(sipPeer.siteId)
|
|
510
510
|
```ruby
|
511
511
|
sipPeer.delete()
|
512
512
|
```
|
513
|
+
|
514
|
+
### SipPeer Attributes
|
515
|
+
```ruby
|
516
|
+
#peer_id
|
517
|
+
sipPeer.peer_id
|
518
|
+
|
519
|
+
#peer_name
|
520
|
+
sipPeer.peer_name
|
521
|
+
|
522
|
+
#is_default_peer
|
523
|
+
sipPeer.is_default_peer
|
524
|
+
|
525
|
+
#products
|
526
|
+
sipPeer.products
|
527
|
+
|
528
|
+
#ss_send_to_customer
|
529
|
+
sipPeer.ss_send_to_customer
|
530
|
+
|
531
|
+
#site_id
|
532
|
+
sipPeer.site_id
|
533
|
+
```
|
534
|
+
|
513
535
|
### SipPeer TN Methods
|
514
536
|
```ruby
|
515
537
|
# get TN for this peer
|
@@ -23,8 +23,7 @@ module BandwidthIris
|
|
23
23
|
@reason = reason
|
24
24
|
@headers = headers
|
25
25
|
@body = body
|
26
|
-
|
27
|
-
super message = "HTTP Error\nStatus Code: #{@http_status}\nReason: #{@reason}\nHTTP Headers: #{@headers}\nResponse Body: #{@body}\nIris Error Code: #{@code}"
|
26
|
+
super message = "HTTP Error\nStatus Code: #{@http_status}\nReason: #{@reason}\nHTTP Headers: #{@headers}\nResponse Body: #{@body}"
|
28
27
|
end
|
29
28
|
end
|
30
29
|
|
@@ -10,8 +10,8 @@ module BandwidthIris
|
|
10
10
|
end
|
11
11
|
wrap_client_arg :list
|
12
12
|
|
13
|
-
def self.get(client, site_id,
|
14
|
-
Site.new({:id => site_id}, client).get_sip_peer(
|
13
|
+
def self.get(client, site_id, peer_id)
|
14
|
+
Site.new({:id => site_id}, client).get_sip_peer(peer_id)
|
15
15
|
end
|
16
16
|
wrap_client_arg :get
|
17
17
|
|
@@ -21,12 +21,12 @@ module BandwidthIris
|
|
21
21
|
wrap_client_arg :create
|
22
22
|
|
23
23
|
def delete()
|
24
|
-
@client.make_request(:delete,"#{@client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{
|
24
|
+
@client.make_request(:delete,"#{@client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{peer_id}")
|
25
25
|
end
|
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}/#{
|
29
|
+
r = @client.make_request(:get,"#{@client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{peer_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,11 +37,11 @@ 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}/#{
|
40
|
+
@client.make_request(:put,"#{@client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{peer_id}/tns/#{CGI.escape(number)}", {:sip_peer_telephone_number => data})[0]
|
41
41
|
end
|
42
42
|
|
43
43
|
def move_tns(numbers)
|
44
|
-
@client.make_request(:post,"#{@client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{
|
44
|
+
@client.make_request(:post,"#{@client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{peer_id}/movetns", {:sip_peer_telephone_numbers => {:full_number => numbers}})[0]
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|
data/lib/bandwidth-iris/site.rb
CHANGED
@@ -38,7 +38,8 @@ module BandwidthIris
|
|
38
38
|
|
39
39
|
def get_sip_peer(peer_id)
|
40
40
|
item = @client.make_request(:get, "#{@client.concat_account_path(SITE_PATH)}/#{id}/sippeers/#{peer_id}")[0][:sip_peer]
|
41
|
-
item[:
|
41
|
+
item[:site_id] = id
|
42
|
+
puts item
|
42
43
|
item
|
43
44
|
end
|
44
45
|
|
@@ -46,7 +47,7 @@ module BandwidthIris
|
|
46
47
|
list = @client.make_request(:get, "#{@client.concat_account_path(SITE_PATH)}/#{id}/sippeers")[0][:sip_peers][:sip_peer]
|
47
48
|
return [] if !list
|
48
49
|
list = if list.is_a?(Array) then list else [list] end
|
49
|
-
list.each {|i| i[:
|
50
|
+
list.each {|i| i[:site_id] = id}
|
50
51
|
list
|
51
52
|
end
|
52
53
|
|
@@ -92,7 +92,6 @@ describe BandwidthIris::Client do
|
|
92
92
|
expect{client.make_request(:get, '/path1')}.to raise_error(an_instance_of(Errors::GenericError).and having_attributes({
|
93
93
|
http_status: 400,
|
94
94
|
headers: {"content-type"=>"application/xml"},
|
95
|
-
code: 4010,
|
96
95
|
body: {:error=>{:code=>4010, :description=>"The state abbreviation N is not valid."}}
|
97
96
|
}))
|
98
97
|
end
|
@@ -14,7 +14,7 @@ describe BandwidthIris::SipPeer do
|
|
14
14
|
client.stubs.get('/v1.0/accounts/accountId/sites/1/sippeers') {|env| [200, {}, Helper.xml['sip_peers']]}
|
15
15
|
list = SipPeer.list(client, 1)
|
16
16
|
expect(list.length).to eql(1)
|
17
|
-
expect(list[0][:
|
17
|
+
expect(list[0][:peer_id]).to eql(12345)
|
18
18
|
expect(list[0][:peer_name]).to eql("SIP Peer 1")
|
19
19
|
expect(list[0][:description]).to eql("Sip Peer 1 description")
|
20
20
|
end
|
@@ -24,7 +24,7 @@ describe BandwidthIris::SipPeer do
|
|
24
24
|
it 'should return a peer' do
|
25
25
|
client.stubs.get('/v1.0/accounts/accountId/sites/1/sippeers/11') {|env| [200, {}, Helper.xml['sip_peer']]}
|
26
26
|
item = SipPeer.get(client, 1, 11)
|
27
|
-
expect(item[:
|
27
|
+
expect(item[:peer_id]).to eql(10)
|
28
28
|
expect(item[:peer_name]).to eql("SIP Peer 1")
|
29
29
|
expect(item[:description]).to eql("Sip Peer 1 description")
|
30
30
|
end
|
@@ -36,7 +36,7 @@ describe BandwidthIris::SipPeer do
|
|
36
36
|
client.stubs.post('/v1.0/accounts/accountId/sites/1/sippeers', client.build_xml({:sip_peer => data})) {|env| [201, {'Location' => '/v1.0/accounts/accountId/sites/1/sippeers/11'}, '']}
|
37
37
|
client.stubs.get('/v1.0/accounts/accountId/sites/1/sippeers/11') {|env| [200, {}, Helper.xml['sip_peer']]}
|
38
38
|
item = SipPeer.create(client, 1, data)
|
39
|
-
expect(item[:
|
39
|
+
expect(item[:peer_id]).to eql(10)
|
40
40
|
expect(item[:peer_name]).to eql("SIP Peer 1")
|
41
41
|
expect(item[:description]).to eql("Sip Peer 1 description")
|
42
42
|
end
|
@@ -45,7 +45,7 @@ describe BandwidthIris::SipPeer do
|
|
45
45
|
describe '#delete' do
|
46
46
|
it 'should remove a peer' do
|
47
47
|
client.stubs.delete('/v1.0/accounts/accountId/sites/1/sippeers/11') {|env| [200, {}, '']}
|
48
|
-
item = SipPeer.new({:site_id => 1, :
|
48
|
+
item = SipPeer.new({:site_id => 1, :peer_id => 11}, client)
|
49
49
|
item.delete()
|
50
50
|
end
|
51
51
|
end
|
@@ -53,14 +53,14 @@ describe BandwidthIris::SipPeer do
|
|
53
53
|
describe '#get_tns' do
|
54
54
|
it 'should return list of numbers' do
|
55
55
|
client.stubs.get('/v1.0/accounts/accountId/sites/1/sippeers/10/tns') {|env| [200, {}, Helper.xml['sip_peer_tns']]}
|
56
|
-
item = SipPeer.new({:site_id => 1, :
|
56
|
+
item = SipPeer.new({:site_id => 1, :peer_id => 10}, client)
|
57
57
|
list = item.get_tns()
|
58
58
|
expect(list.length).to eql(17)
|
59
59
|
expect(list[0][:full_number]).to eql("3034162216")
|
60
60
|
end
|
61
61
|
it 'should return a number' do
|
62
62
|
client.stubs.get('/v1.0/accounts/accountId/sites/1/sippeers/10/tns/12345') {|env| [200, {}, Helper.xml['sip_peer_tn']]}
|
63
|
-
item = SipPeer.new({:site_id => 1, :
|
63
|
+
item = SipPeer.new({:site_id => 1, :peer_id => 10}, client)
|
64
64
|
item = item.get_tns('12345')
|
65
65
|
expect(item[:full_number]).to eql("9195551212")
|
66
66
|
end
|
@@ -70,7 +70,7 @@ describe BandwidthIris::SipPeer do
|
|
70
70
|
it 'should update a number' do
|
71
71
|
data = {:full_number => "123456", :rewrite_user => "test"}
|
72
72
|
client.stubs.put('/v1.0/accounts/accountId/sites/1/sippeers/10/tns/123456', client.build_xml({:sip_peer_telephone_number => data})) {|env| [200, {}, '']}
|
73
|
-
item = SipPeer.new({:site_id => 1, :
|
73
|
+
item = SipPeer.new({:site_id => 1, :peer_id => 10}, client)
|
74
74
|
item.update_tns('123456', data)
|
75
75
|
end
|
76
76
|
end
|
@@ -79,7 +79,7 @@ describe BandwidthIris::SipPeer do
|
|
79
79
|
it 'should move numbers' do
|
80
80
|
data = ["11111", "22222"]
|
81
81
|
client.stubs.post('/v1.0/accounts/accountId/sites/1/sippeers/10/movetns', client.build_xml({:sip_peer_telephone_numbers => {:full_number => data}})) {|env| [200, {}, '']}
|
82
|
-
item = SipPeer.new({:site_id => 1, :
|
82
|
+
item = SipPeer.new({:site_id => 1, :peer_id => 10}, client)
|
83
83
|
item.move_tns(data)
|
84
84
|
end
|
85
85
|
end
|
@@ -63,7 +63,7 @@ describe BandwidthIris::Site do
|
|
63
63
|
site = Site.new({:id => 1}, client)
|
64
64
|
list = site.get_sip_peers()
|
65
65
|
expect(list.length).to eql(1)
|
66
|
-
expect(list[0][:
|
66
|
+
expect(list[0][:peer_id]).to eql(12345)
|
67
67
|
expect(list[0][:peer_name]).to eql("SIP Peer 1")
|
68
68
|
expect(list[0][:description]).to eql("Sip Peer 1 description")
|
69
69
|
end
|
@@ -74,7 +74,7 @@ describe BandwidthIris::Site do
|
|
74
74
|
client.stubs.get('/v1.0/accounts/accountId/sites/1/sippeers/11') {|env| [200, {}, Helper.xml['sip_peer']]}
|
75
75
|
site = Site.new({:id => 1}, client)
|
76
76
|
item = site.get_sip_peer(11)
|
77
|
-
expect(item[:
|
77
|
+
expect(item[:peer_id]).to eql(10)
|
78
78
|
expect(item[:peer_name]).to eql("SIP Peer 1")
|
79
79
|
expect(item[:description]).to eql("Sip Peer 1 description")
|
80
80
|
end
|
@@ -87,7 +87,7 @@ describe BandwidthIris::Site do
|
|
87
87
|
client.stubs.get('/v1.0/accounts/accountId/sites/1/sippeers/11') {|env| [200, {}, Helper.xml['sip_peer']]}
|
88
88
|
site = Site.new({:id => 1}, client)
|
89
89
|
item = site.create_sip_peer(data)
|
90
|
-
expect(item[:
|
90
|
+
expect(item[:peer_id]).to eql(10)
|
91
91
|
expect(item[:peer_name]).to eql("SIP Peer 1")
|
92
92
|
expect(item[:description]).to eql("Sip Peer 1 description")
|
93
93
|
end
|
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: 6.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Belchikov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: builder
|