ruby-bandwidth-iris 2.2.0 → 2.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +515 -11
- data/examples/create_reservation_and_order.rb +79 -0
- data/examples/order_number.rb +83 -0
- data/lib/bandwidth-iris/aeui.rb +20 -0
- data/lib/bandwidth-iris/applications.rb +61 -0
- data/lib/bandwidth-iris/client.rb +5 -3
- data/lib/bandwidth-iris/emergency_notification_endpoints.rb +26 -0
- data/lib/bandwidth-iris/emergency_notification_groups.rb +39 -0
- data/lib/bandwidth-iris/emergency_notification_recipients.rb +37 -0
- data/lib/bandwidth-iris/order.rb +15 -0
- data/lib/bandwidth-iris/sip_peer_products.rb +118 -0
- data/lib/bandwidth-iris/tn_options.rb +26 -0
- data/lib/bandwidth-iris/tn_reservation.rb +4 -2
- data/lib/bandwidth-iris/version.rb +1 -1
- data/lib/ruby-bandwidth-iris.rb +7 -0
- data/spec/bandwidth-iris/aeui_spec.rb +25 -0
- data/spec/bandwidth-iris/application_spec.rb +90 -0
- data/spec/bandwidth-iris/emergency_notification_endpoints_spec.rb +35 -0
- data/spec/bandwidth-iris/emergency_notification_groups_spec.rb +48 -0
- data/spec/bandwidth-iris/emergency_notification_recipients_spec.rb +48 -0
- data/spec/bandwidth-iris/order_spec.rb +18 -9
- data/spec/bandwidth-iris/sip_peer_products_spec.rb +162 -0
- data/spec/bandwidth-iris/tn_options_spec.rb +42 -0
- data/spec/bandwidth-iris/tn_reservation_spec.rb +5 -5
- data/spec/xml.yml +28 -3
- metadata +25 -2
@@ -0,0 +1,26 @@
|
|
1
|
+
module BandwidthIris
|
2
|
+
TN_OPTIONS_PATH = 'tnoptions'
|
3
|
+
|
4
|
+
class TnOptions
|
5
|
+
extend ClientWrapper
|
6
|
+
include ApiItem
|
7
|
+
|
8
|
+
def self.get_tn_option_orders(client, query = nil)
|
9
|
+
response = client.make_request(:get, "#{client.concat_account_path(TN_OPTIONS_PATH)}", query)
|
10
|
+
return response[0]
|
11
|
+
end
|
12
|
+
wrap_client_arg :get_tn_option_orders
|
13
|
+
|
14
|
+
def self.create_tn_option_order(client, data)
|
15
|
+
response = client.make_request(:post, "#{client.concat_account_path(TN_OPTIONS_PATH)}", {:tn_option_order => data})
|
16
|
+
return response[0][:tn_option_order]
|
17
|
+
end
|
18
|
+
wrap_client_arg :create_tn_option_order
|
19
|
+
|
20
|
+
def self.get_tn_option_order(client, order_id)
|
21
|
+
response = client.make_request(:get, "#{client.concat_account_path(TN_OPTIONS_PATH)}/#{order_id}")
|
22
|
+
return response[0]
|
23
|
+
end
|
24
|
+
wrap_client_arg :get_tn_option_order
|
25
|
+
end
|
26
|
+
end
|
@@ -8,12 +8,14 @@ module BandwidthIris
|
|
8
8
|
|
9
9
|
def self.get(client, id)
|
10
10
|
data = client.make_request(:get, "#{client.concat_account_path(TN_RESERVATION_PATH)}/#{id}")[0][:reservation]
|
11
|
+
data[:id] = id
|
11
12
|
TnReservation.new(data, client)
|
12
13
|
end
|
13
14
|
wrap_client_arg :get
|
14
15
|
|
15
|
-
def self.create(client,
|
16
|
-
|
16
|
+
def self.create(client, number)
|
17
|
+
reservation_request = {:reservation => {:reserved_tn => number } }
|
18
|
+
location = client.make_request(:post, client.concat_account_path(TN_RESERVATION_PATH), reservation_request)[1][:location]
|
17
19
|
id = Client.get_id_from_location_header(location)
|
18
20
|
self.get(client, id)
|
19
21
|
end
|
data/lib/ruby-bandwidth-iris.rb
CHANGED
@@ -30,5 +30,12 @@ require 'bandwidth-iris/import_tn_orders'
|
|
30
30
|
require 'bandwidth-iris/import_tn_checker'
|
31
31
|
require 'bandwidth-iris/remove_imported_tn_orders'
|
32
32
|
require 'bandwidth-iris/csr'
|
33
|
+
require 'bandwidth-iris/applications'
|
34
|
+
require 'bandwidth-iris/sip_peer_products'
|
35
|
+
require 'bandwidth-iris/emergency_notification_endpoints'
|
36
|
+
require 'bandwidth-iris/emergency_notification_groups'
|
37
|
+
require 'bandwidth-iris/emergency_notification_recipients'
|
38
|
+
require 'bandwidth-iris/aeui'
|
39
|
+
require 'bandwidth-iris/tn_options'
|
33
40
|
|
34
41
|
require 'bandwidth-iris/version'
|
@@ -0,0 +1,25 @@
|
|
1
|
+
describe BandwidthIris::AlternateEndUserIdentity 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 '#aeui' do
|
13
|
+
it 'should get aeuis' do
|
14
|
+
client.stubs.get("/v1.0/accounts/accountId/aeuis") {|env| [200, {}, Helper.xml['aeuis']]}
|
15
|
+
aeuis = AlternateEndUserIdentity.get_alternate_end_user_information(client)
|
16
|
+
expect(aeuis[:alternate_end_user_identifiers][:alternate_end_user_identifier][0][:identifier]).to eql("DavidAcid")
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should get aeui' do
|
20
|
+
client.stubs.get("/v1.0/accounts/accountId/aeuis/id") {|env| [200, {}, Helper.xml['aeui']]}
|
21
|
+
aeui = AlternateEndUserIdentity.get_alternate_caller_information(client, "id")
|
22
|
+
expect(aeui[:identifier]).to eql("DavidAcid")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
describe BandwidthIris::Applications 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 '#get' do
|
13
|
+
it 'should get applications' do
|
14
|
+
client.stubs.get("/v1.0/accounts/accountId/applications", ){|env| [200, {}, Helper.xml['applicationList']]}
|
15
|
+
applications = Applications.get_applications(client)
|
16
|
+
expect(applications[0][:application_id]).to eql("d1")
|
17
|
+
expect(applications[1][:application_id]).to eql("d2")
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should get applications with one item' do
|
21
|
+
client.stubs.get("/v1.0/accounts/accountId/applications", ){|env| [200, {}, Helper.xml['applicationListOne']]}
|
22
|
+
applications = Applications.get_applications(client)
|
23
|
+
expect(applications[0][:application_id]).to eql("d1")
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should get an application' do
|
27
|
+
client.stubs.get("/v1.0/accounts/accountId/applications/id", ){|env| [200, {}, Helper.xml['application']]}
|
28
|
+
application = Applications.get_application(client, "id")
|
29
|
+
expect(application[:application_id]).to eql("d1")
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should get an application\'s sippeers' do
|
33
|
+
client.stubs.get("/v1.0/accounts/accountId/applications/id/associatedsippeers", ){|env| [200, {}, Helper.xml['applicationSippeers']]}
|
34
|
+
sippeers = Applications.get_application_sippeers(client, "id")
|
35
|
+
expect(sippeers[0][:site_id]).to eql(1)
|
36
|
+
expect(sippeers[1][:site_id]).to eql(2)
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should get an application\'s sippeers with one item' do
|
40
|
+
client.stubs.get("/v1.0/accounts/accountId/applications/id/associatedsippeers", ){|env| [200, {}, Helper.xml['applicationSippeersOne']]}
|
41
|
+
sippeers = Applications.get_application_sippeers(client, "id")
|
42
|
+
expect(sippeers[0][:site_id]).to eql(1)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe '#create' do
|
47
|
+
it' should create an application' do
|
48
|
+
data = {
|
49
|
+
:service_type => "Messaging-V2",
|
50
|
+
:app_name => "Name",
|
51
|
+
:msg_callback_url => "https://test.com"
|
52
|
+
}
|
53
|
+
client.stubs.post("/v1.0/accounts/accountId/applications", client.build_xml({:application => data})){|env| [200, {}, Helper.xml['application']]}
|
54
|
+
application = Applications.create_application(client, data)
|
55
|
+
expect(application[:application_id]).to eql("d1")
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe '#update' do
|
60
|
+
it 'should partial update an application' do
|
61
|
+
data = {
|
62
|
+
:service_type => "Messaging-V2",
|
63
|
+
:app_name => "Name",
|
64
|
+
:msg_callback_url => "https://test.com"
|
65
|
+
}
|
66
|
+
client.stubs.patch("/v1.0/accounts/accountId/applications/id", client.build_xml({:application => data})){|env| [200, {}, Helper.xml['application']]}
|
67
|
+
application = Applications.partial_update_application(client, "id", data)
|
68
|
+
expect(application[:application_id]).to eql("d1")
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'should complete update an application' do
|
72
|
+
data = {
|
73
|
+
:service_type => "Messaging-V2",
|
74
|
+
:app_name => "Name",
|
75
|
+
:msg_callback_url => "https://test.com"
|
76
|
+
}
|
77
|
+
client.stubs.put("/v1.0/accounts/accountId/applications/id", client.build_xml({:application => data})){|env| [200, {}, Helper.xml['application']]}
|
78
|
+
application = Applications.complete_update_application(client, "id", data)
|
79
|
+
expect(application[:application_id]).to eql("d1")
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
describe '#delete' do
|
84
|
+
it 'should delete an application' do
|
85
|
+
client.stubs.delete("/v1.0/accounts/accountId/applications/id"){|env| [200, {}, '']}
|
86
|
+
Applications.delete_application(client, "id")
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
describe BandwidthIris::EmergencyNotificationEndpoints 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 '#EneTests' do
|
13
|
+
it 'should create ene order' do
|
14
|
+
data = {
|
15
|
+
:value => "value"
|
16
|
+
}
|
17
|
+
client.stubs.post("/v1.0/accounts/accountId/emergencyNotificationEndpointOrders", client.build_xml({:emergency_notification_endpoint_order => data})) {|env| [200, {}, Helper.xml['emergencyNotificationEndpointOrder']]}
|
18
|
+
ene_order = EmergencyNotificationEndpoints.create_emergency_notification_endpoint_order(client, data)
|
19
|
+
expect(ene_order[:order_id]).to eql("3e9a852e-2d1d-4e2d-84c3-87223a78cb70")
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'should get ene orders' do
|
23
|
+
client.stubs.get("/v1.0/accounts/accountId/emergencyNotificationEndpointOrders") {|env| [200, {}, Helper.xml['emergencyNotificationEndpointOrders']]}
|
24
|
+
ene_orders = EmergencyNotificationEndpoints.get_emergency_notification_endpoint_orders(client)
|
25
|
+
expect(ene_orders[:emergency_notification_endpoint_orders][:emergency_notification_endpoint_order][0][:order_id]).to eql("3e9a852e-2d1d-4e2d-84c3-87223a78cb70")
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should get ene order' do
|
29
|
+
client.stubs.get("/v1.0/accounts/accountId/emergencyNotificationEndpointOrders/id") {|env| [200, {}, Helper.xml['emergencyNotificationEndpointOrder']]}
|
30
|
+
ene_order = EmergencyNotificationEndpoints.get_emergency_notification_endpoint_order(client, "id")
|
31
|
+
expect(ene_order[:order_id]).to eql("3e9a852e-2d1d-4e2d-84c3-87223a78cb70")
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
@@ -0,0 +1,48 @@
|
|
1
|
+
describe BandwidthIris::EmergencyNotificationGroups 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 '#EngOrderTests' do
|
13
|
+
it 'should create eng order' do
|
14
|
+
data = {
|
15
|
+
:value => "value"
|
16
|
+
}
|
17
|
+
client.stubs.post("/v1.0/accounts/accountId/emergencyNotificationGroupOrders", client.build_xml({:emergency_notification_group_order => data})) {|env| [200, {}, Helper.xml['emergencyNotificationGroupOrder']]}
|
18
|
+
order = EmergencyNotificationGroups.create_emergency_notification_group_order(client, data)
|
19
|
+
expect(order[:order_id]).to eql("900b3646-18df-4626-b237-3a8de648ebf6")
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'should get eng orders' do
|
23
|
+
client.stubs.get("/v1.0/accounts/accountId/emergencyNotificationGroupOrders") {|env| [200, {}, Helper.xml['emergencyNotificationGroupOrders']]}
|
24
|
+
orders = EmergencyNotificationGroups.get_emergency_notification_group_orders(client)
|
25
|
+
expect(orders[:emergency_notification_group_orders][:emergency_notification_group_order][0][:order_id]).to eql("092815dc-9ced-4d67-a070-a80eb243b914")
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should get eng order' do
|
29
|
+
client.stubs.get("/v1.0/accounts/accountId/emergencyNotificationGroupOrders/id") {|env| [200, {}, Helper.xml['emergencyNotificationGroupOrder']]}
|
30
|
+
order = EmergencyNotificationGroups.get_emergency_notification_group_order(client, "id")
|
31
|
+
expect(order[:order_id]).to eql("900b3646-18df-4626-b237-3a8de648ebf6")
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe '#EngTests' do
|
36
|
+
it 'should get eng' do
|
37
|
+
client.stubs.get("/v1.0/accounts/accountId/emergencyNotificationGroups/id") {|env| [200, {}, Helper.xml['emergencyNotificationGroup']]}
|
38
|
+
eng = EmergencyNotificationGroups.get_emergency_notification_group(client, "id")
|
39
|
+
expect(eng[:identifier]).to eql("63865500-0904-46b1-9b4f-7bd237a26363")
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'should get engs' do
|
43
|
+
client.stubs.get("/v1.0/accounts/accountId/emergencyNotificationGroups") {|env| [200, {}, Helper.xml['emergencyNotificationGroups']]}
|
44
|
+
engs = EmergencyNotificationGroups.get_emergency_notification_groups(client)
|
45
|
+
expect(engs[:emergency_notification_groups][:emergency_notification_group][0][:identifier]).to eql("63865500-0904-46b1-9b4f-7bd237a26363")
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
describe BandwidthIris::EmergencyNotificationRecipients 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 '#EnrTests' do
|
13
|
+
it 'should create enr' do
|
14
|
+
data = {
|
15
|
+
:value => "value"
|
16
|
+
}
|
17
|
+
client.stubs.post("/v1.0/accounts/accountId/emergencyNotificationRecipients", client.build_xml({:emergency_notification_recipient => data})) {|env| [200, {}, Helper.xml['emergencyNotificationRecipient']]}
|
18
|
+
enr = EmergencyNotificationRecipients.create_emergency_notification_recipient(client, data)
|
19
|
+
expect(enr[:identifier]).to eql(" 63865500-0904-46b1-9b4f-7bd237a26363 ")
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'should get enrs' do
|
23
|
+
client.stubs.get("/v1.0/accounts/accountId/emergencyNotificationRecipients") {|env| [200, {}, Helper.xml['emergencyNotificationRecipients']]}
|
24
|
+
enrs = EmergencyNotificationRecipients.get_emergency_notification_recipients(client)
|
25
|
+
expect(enrs[:emergency_notification_recipients][:emergency_notification_recipient][0][:identifier]).to eql(" 63865500-0904-46b1-9b4f-7bd237a26363 ")
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should get enr' do
|
29
|
+
client.stubs.get("/v1.0/accounts/accountId/emergencyNotificationRecipients/id") {|env| [200, {}, Helper.xml['emergencyNotificationRecipient']]}
|
30
|
+
enr = EmergencyNotificationRecipients.get_emergency_notification_recipient(client, "id")
|
31
|
+
expect(enr[:identifier]).to eql(" 63865500-0904-46b1-9b4f-7bd237a26363 ")
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should replace enr' do
|
35
|
+
data = {
|
36
|
+
:value => "value"
|
37
|
+
}
|
38
|
+
client.stubs.put("/v1.0/accounts/accountId/emergencyNotificationRecipients/id", client.build_xml({:emergency_notification_recipient => data})) {|env| [200, {}, Helper.xml['emergencyNotificationRecipient']]}
|
39
|
+
enr = EmergencyNotificationRecipients.replace_emergency_notification_recipient(client, "id", data)
|
40
|
+
expect(enr[:identifier]).to eql(" 63865500-0904-46b1-9b4f-7bd237a26363 ")
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'should delete enr' do
|
44
|
+
client.stubs.delete("/v1.0/accounts/accountId/emergencyNotificationRecipients/id") {|env| [200, {}, '']}
|
45
|
+
EmergencyNotificationRecipients.delete_emergency_notification_recipient(client, "id")
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -12,18 +12,18 @@ describe BandwidthIris::Order do
|
|
12
12
|
describe '#create' do
|
13
13
|
it 'should create an order' do
|
14
14
|
data = {
|
15
|
-
:name => "
|
16
|
-
:siteId => "
|
17
|
-
:customerOrderId => "
|
18
|
-
:
|
19
|
-
:
|
15
|
+
:name => "Local Order",
|
16
|
+
:siteId => "29976",
|
17
|
+
:customerOrderId => "123456789",
|
18
|
+
:area_code_search_and_order_type => {
|
19
|
+
:area_code => 919,
|
20
20
|
:quantity => 1
|
21
21
|
}
|
22
22
|
}
|
23
|
-
client.stubs.post("/v1.0/accounts/accountId/orders", client.build_xml({:order => data})){|env| [200, {}, Helper.xml['
|
23
|
+
client.stubs.post("/v1.0/accounts/accountId/orders", client.build_xml({:order => data})){|env| [200, {}, Helper.xml['create_order_response']]}
|
24
24
|
order = Order.create(client, data)
|
25
|
-
expect(order.id).to eql(
|
26
|
-
expect(order.name).to eql("
|
25
|
+
expect(order.id).to eql("a7af704e-2ec0-4c4d-9dc5-1b77fa62c92a")
|
26
|
+
expect(order.name).to eql("Local Order")
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
@@ -31,11 +31,20 @@ describe BandwidthIris::Order do
|
|
31
31
|
it 'should return an order' do
|
32
32
|
client.stubs.get("/v1.0/accounts/accountId/orders/101"){|env| [200, {}, Helper.xml['order']]}
|
33
33
|
order = Order.get(client, "101")
|
34
|
-
expect(order.id).to eql(101)
|
34
|
+
expect(order.id).to eql("101")
|
35
35
|
expect(order.name).to eql("Test")
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
+
describe '#get_order_response' do
|
40
|
+
it 'should return an order with details' do
|
41
|
+
client.stubs.get("/v1.0/accounts/accountId/orders/101"){|env| [200, {}, Helper.xml['order']]}
|
42
|
+
order = Order.get_order_response(client, "101")
|
43
|
+
completed_number = order.completed_numbers[:telephone_number][:full_number]
|
44
|
+
expect(completed_number).to eql("9194464166")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
39
48
|
describe '#list' do
|
40
49
|
it 'should return orders' do
|
41
50
|
client.stubs.get("/v1.0/accounts/accountId/orders"){|env| [200, {}, Helper.xml['orders']]}
|
@@ -0,0 +1,162 @@
|
|
1
|
+
describe BandwidthIris::SipPeerProducts 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 '#originationSettings' do
|
13
|
+
it 'should get origination settings' do
|
14
|
+
client.stubs.get("/v1.0/accounts/accountId/sites/siteId/sippeers/sippeerId/products/origination/settings"){|env| [200, {}, Helper.xml['sippeerOriginationSettings']]}
|
15
|
+
settings = SipPeerProducts.get_origination_settings(client, "siteId", "sippeerId")
|
16
|
+
expect(settings[:voice_protocol]).to eql("HTTP")
|
17
|
+
end
|
18
|
+
it 'should create origination settings' do
|
19
|
+
data = {
|
20
|
+
:voice_protocol => "HTTP"
|
21
|
+
}
|
22
|
+
client.stubs.post("/v1.0/accounts/accountId/sites/siteId/sippeers/sippeerId/products/origination/settings", client.build_xml({:sip_peer_origination_settings => data})){|env| [200, {}, Helper.xml['sippeerOriginationSettings']]}
|
23
|
+
settings = SipPeerProducts.create_origination_settings(client, "siteId", "sippeerId", data)
|
24
|
+
expect(settings[:voice_protocol]).to eql("HTTP")
|
25
|
+
end
|
26
|
+
it 'should update origination settings' do
|
27
|
+
data = {
|
28
|
+
:voice_protocol => "HTTP"
|
29
|
+
}
|
30
|
+
client.stubs.put("/v1.0/accounts/accountId/sites/siteId/sippeers/sippeerId/products/origination/settings", client.build_xml({:sip_peer_origination_settings => data})){|env| [200, {}, Helper.xml['sippeerOriginationSettings']]}
|
31
|
+
SipPeerProducts.update_origination_settings(client, "siteId", "sippeerId", data)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe '#terminationSettings' do
|
36
|
+
it 'should get termination settings' do
|
37
|
+
client.stubs.get("/v1.0/accounts/accountId/sites/siteId/sippeers/sippeerId/products/termination/settings"){|env| [200, {}, Helper.xml['sippeerTerminationSettings']]}
|
38
|
+
settings = SipPeerProducts.get_termination_settings(client, "siteId", "sippeerId")
|
39
|
+
expect(settings[:voice_protocol]).to eql("HTTP")
|
40
|
+
end
|
41
|
+
it 'should create termination settings' do
|
42
|
+
data = {
|
43
|
+
:voice_protocol => "HTTP"
|
44
|
+
}
|
45
|
+
client.stubs.post("/v1.0/accounts/accountId/sites/siteId/sippeers/sippeerId/products/termination/settings", client.build_xml({:sip_peer_termination_settings => data})){|env| [200, {}, Helper.xml['sippeerTerminationSettings']]}
|
46
|
+
settings = SipPeerProducts.create_termination_settings(client, "siteId", "sippeerId", data)
|
47
|
+
expect(settings[:voice_protocol]).to eql("HTTP")
|
48
|
+
end
|
49
|
+
it 'should update termination settings' do
|
50
|
+
data = {
|
51
|
+
:voice_protocol => "HTTP"
|
52
|
+
}
|
53
|
+
client.stubs.put("/v1.0/accounts/accountId/sites/siteId/sippeers/sippeerId/products/termination/settings", client.build_xml({:sip_peer_termination_settings => data})){|env| [200, {}, Helper.xml['sippeerTerminationSettings']]}
|
54
|
+
SipPeerProducts.update_termination_settings(client, "siteId", "sippeerId", data)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe '#smsFeatureSettings' do
|
59
|
+
it 'should get sms feature settings' do
|
60
|
+
client.stubs.get("/v1.0/accounts/accountId/sites/siteId/sippeers/sippeerId/products/messaging/features/sms"){|env| [200, {}, Helper.xml['sippeerSmsFeature']]}
|
61
|
+
settings = SipPeerProducts.get_sms_feature_settings(client, "siteId", "sippeerId")
|
62
|
+
expect(settings[:sip_peer_sms_feature_settings][:toll_free]).to eql(true)
|
63
|
+
end
|
64
|
+
it 'should create sms feature settings' do
|
65
|
+
data = {
|
66
|
+
:sip_peer_sms_feature_settings => {
|
67
|
+
:toll_free => true
|
68
|
+
}
|
69
|
+
}
|
70
|
+
client.stubs.post("/v1.0/accounts/accountId/sites/siteId/sippeers/sippeerId/products/messaging/features/sms", client.build_xml({:sip_peer_sms_feature => data})){|env| [200, {}, Helper.xml['sippeerSmsFeature']]}
|
71
|
+
settings = SipPeerProducts.create_sms_feature_settings(client, "siteId", "sippeerId", data)
|
72
|
+
expect(settings[:sip_peer_sms_feature_settings][:toll_free]).to eql(true)
|
73
|
+
end
|
74
|
+
it 'should update sms feature settings' do
|
75
|
+
data = {
|
76
|
+
:sip_peer_sms_feature_settings => {
|
77
|
+
:toll_free => true
|
78
|
+
}
|
79
|
+
}
|
80
|
+
client.stubs.put("/v1.0/accounts/accountId/sites/siteId/sippeers/sippeerId/products/messaging/features/sms", client.build_xml({:sip_peer_sms_feature => data})){|env| [200, {}, Helper.xml['sippeerSmsFeature']]}
|
81
|
+
settings = SipPeerProducts.update_sms_feature_settings(client, "siteId", "sippeerId", data)
|
82
|
+
expect(settings[:sip_peer_sms_feature_settings][:toll_free]).to eql(true)
|
83
|
+
end
|
84
|
+
it 'should delete sms feature settings' do
|
85
|
+
client.stubs.delete("/v1.0/accounts/accountId/sites/siteId/sippeers/sippeerId/products/messaging/features/sms"){|env| [200, {}, Helper.xml['sippeerSmsFeature']]}
|
86
|
+
SipPeerProducts.delete_sms_feature_settings(client, "siteId", "sippeerId")
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
describe '#mmsFeatureSettings' do
|
91
|
+
it 'should get mms feature settings' do
|
92
|
+
client.stubs.get("/v1.0/accounts/accountId/sites/siteId/sippeers/sippeerId/products/messaging/features/mms"){|env| [200, {}, Helper.xml['sippeerMmsFeature']]}
|
93
|
+
settings = SipPeerProducts.get_mms_feature_settings(client, "siteId", "sippeerId")
|
94
|
+
expect(settings[:mms_settings][:protocol]).to eql("MM4")
|
95
|
+
end
|
96
|
+
it 'should create mms feature settings' do
|
97
|
+
data = {
|
98
|
+
:mms_settings => {
|
99
|
+
:protocol => "MM4"
|
100
|
+
}
|
101
|
+
}
|
102
|
+
client.stubs.post("/v1.0/accounts/accountId/sites/siteId/sippeers/sippeerId/products/messaging/features/mms", client.build_xml({:mms_feature => data})){|env| [200, {}, Helper.xml['sippeerMmsFeature']]}
|
103
|
+
settings = SipPeerProducts.create_mms_feature_settings(client, "siteId", "sippeerId", data)
|
104
|
+
expect(settings[:mms_settings][:protocol]).to eql("MM4")
|
105
|
+
end
|
106
|
+
it 'should update mms feature settings' do
|
107
|
+
data = {
|
108
|
+
:mms_settings => {
|
109
|
+
:protocol => "MM4"
|
110
|
+
}
|
111
|
+
}
|
112
|
+
client.stubs.put("/v1.0/accounts/accountId/sites/siteId/sippeers/sippeerId/products/messaging/features/mms", client.build_xml({:mms_feature => data})){|env| [200, {}, Helper.xml['sippeerMmsFeature']]}
|
113
|
+
SipPeerProducts.update_mms_feature_settings(client, "siteId", "sippeerId", data)
|
114
|
+
end
|
115
|
+
it 'should delete mms feature settings' do
|
116
|
+
client.stubs.delete("/v1.0/accounts/accountId/sites/siteId/sippeers/sippeerId/products/messaging/features/mms"){|env| [200, {}, Helper.xml['sippeerMmsFeature']]}
|
117
|
+
SipPeerProducts.delete_mms_feature_settings(client, "siteId", "sippeerId")
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
describe '#mmsFeatureMmsSettings' do
|
122
|
+
it 'should get mms feature mms settings' do
|
123
|
+
client.stubs.get("/v1.0/accounts/accountId/sites/siteId/sippeers/sippeerId/products/messaging/features/mms/settings"){|env| [200, {}, Helper.xml['sippeerMmsFeatureMmsSettings']]}
|
124
|
+
settings = SipPeerProducts.get_mms_feature_mms_settings(client, "siteId", "sippeerId")
|
125
|
+
expect(settings[:protocol]).to eql("MM4")
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
describe '#messagingApplicationSettings' do
|
130
|
+
it 'should get messaging application settings' do
|
131
|
+
client.stubs.get("/v1.0/accounts/accountId/sites/siteId/sippeers/sippeerId/products/messaging/applicationSettings"){|env| [200, {}, Helper.xml['messagingApplicationSettings']]}
|
132
|
+
settings = SipPeerProducts.get_messaging_application_settings(client, "siteId", "sippeerId")
|
133
|
+
expect(settings[:http_messaging_v2_app_id]).to eql("4a4ca6c1-156b-4fca-84e9-34e35e2afc32")
|
134
|
+
end
|
135
|
+
it 'should update messaging application settings' do
|
136
|
+
data = {
|
137
|
+
:http_messaging_v2_app_id => "4a4ca6c1-156b-4fca-84e9-34e35e2afc32"
|
138
|
+
}
|
139
|
+
client.stubs.put("/v1.0/accounts/accountId/sites/siteId/sippeers/sippeerId/products/messaging/applicationSettings", client.build_xml({:applications_settings => data})){|env| [200, {}, Helper.xml['messagingApplicationSettings']]}
|
140
|
+
settings = SipPeerProducts.update_messaging_application_settings(client, "siteId", "sippeerId", data)
|
141
|
+
expect(settings[:http_messaging_v2_app_id]).to eql("4a4ca6c1-156b-4fca-84e9-34e35e2afc32")
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
describe '#messagingSettings' do
|
146
|
+
it 'should get messaging settings' do
|
147
|
+
client.stubs.get("/v1.0/accounts/accountId/sites/siteId/sippeers/sippeerId/products/messaging/settings"){|env| [200, {}, Helper.xml['sippeerMessageSettings']]}
|
148
|
+
settings = SipPeerProducts.get_messaging_settings(client, "siteId", "sippeerId")
|
149
|
+
expect(settings[:break_out_countries][:country]).to eql("CAN")
|
150
|
+
end
|
151
|
+
it 'should update messaging settings' do
|
152
|
+
data = {
|
153
|
+
:break_out_countries => {
|
154
|
+
:country => "CAN"
|
155
|
+
}
|
156
|
+
}
|
157
|
+
client.stubs.put("/v1.0/accounts/accountId/sites/siteId/sippeers/sippeerId/products/messaging/settings", client.build_xml({:sip_peer_messaging_settings => data})){|env| [200, {}, Helper.xml['sippeerMessageSettings']]}
|
158
|
+
settings = SipPeerProducts.update_messaging_settings(client, "siteId", "sippeerId", data)
|
159
|
+
expect(settings[:break_out_countries][:country]).to eql("CAN")
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|