ruby-bandwidth-iris 2.1.0 → 2.6.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 +488 -9
- 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 +33 -1
- 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/import_tn_orders.rb +44 -1
- data/lib/bandwidth-iris/order.rb +15 -0
- data/lib/bandwidth-iris/sip_peer_products.rb +118 -0
- data/lib/bandwidth-iris/tn_reservation.rb +4 -2
- data/lib/bandwidth-iris/version.rb +1 -1
- data/lib/ruby-bandwidth-iris.rb +6 -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/import_tn_orders_spec.rb +82 -4
- 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_reservation_spec.rb +5 -5
- data/spec/xml.yml +25 -3
- metadata +22 -2
data/lib/bandwidth-iris/order.rb
CHANGED
@@ -13,6 +13,14 @@ module BandwidthIris
|
|
13
13
|
|
14
14
|
def self.get(client, id)
|
15
15
|
data = client.make_request(:get, "#{client.concat_account_path(ORDER_PATH)}/#{id}")[0][:order]
|
16
|
+
data[:id] = id
|
17
|
+
Order.new(data, client)
|
18
|
+
end
|
19
|
+
wrap_client_arg :get
|
20
|
+
|
21
|
+
def self.get_order_response(client, id)
|
22
|
+
data = client.make_request(:get, "#{client.concat_account_path(ORDER_PATH)}/#{id}")[0]
|
23
|
+
data[:id] = id
|
16
24
|
Order.new(data, client)
|
17
25
|
end
|
18
26
|
wrap_client_arg :get
|
@@ -25,6 +33,13 @@ module BandwidthIris
|
|
25
33
|
end
|
26
34
|
wrap_client_arg :list
|
27
35
|
|
36
|
+
#`get order` no longer returns an `id`, which means the subsequent `get_tns` call will fail
|
37
|
+
#This is a workaround to provide the "get tns by order id" functionality
|
38
|
+
def self.get_tns_by_order_id(client, id)
|
39
|
+
client.make_request(:get, "#{client.concat_account_path(ORDER_PATH)}/#{id}/tns")[0]
|
40
|
+
end
|
41
|
+
wrap_client_arg :get_tns_by_order_id
|
42
|
+
|
28
43
|
def update(data)
|
29
44
|
@client.make_request(:put, "#{@client.concat_account_path(ORDER_PATH)}/#{id}", {:order => data})[0]
|
30
45
|
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
module BandwidthIris
|
2
|
+
SIPPEER_PRODUCTS_PATH = 'products'
|
3
|
+
|
4
|
+
class SipPeerProducts
|
5
|
+
extend ClientWrapper
|
6
|
+
include ApiItem
|
7
|
+
|
8
|
+
def self.get_origination_settings(client, site_id, sippeer_id)
|
9
|
+
response = client.make_request(:get, "#{client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{sippeer_id}/#{SIPPEER_PRODUCTS_PATH}/origination/settings")
|
10
|
+
return response[0][:sip_peer_origination_settings]
|
11
|
+
end
|
12
|
+
wrap_client_arg :get_origination_settings
|
13
|
+
|
14
|
+
def self.create_origination_settings(client, site_id, sippeer_id, data)
|
15
|
+
response = client.make_request(:post, "#{client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{sippeer_id}/#{SIPPEER_PRODUCTS_PATH}/origination/settings", {:sip_peer_origination_settings => data})
|
16
|
+
return response[0][:sip_peer_origination_settings]
|
17
|
+
end
|
18
|
+
wrap_client_arg :create_origination_settings
|
19
|
+
|
20
|
+
def self.update_origination_settings(client, site_id, sippeer_id, data)
|
21
|
+
client.make_request(:put, "#{client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{sippeer_id}/#{SIPPEER_PRODUCTS_PATH}/origination/settings", {:sip_peer_origination_settings => data})
|
22
|
+
end
|
23
|
+
wrap_client_arg :update_origination_settings
|
24
|
+
|
25
|
+
def self.get_termination_settings(client, site_id, sippeer_id)
|
26
|
+
response = client.make_request(:get, "#{client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{sippeer_id}/#{SIPPEER_PRODUCTS_PATH}/termination/settings")
|
27
|
+
return response[0][:sip_peer_termination_settings]
|
28
|
+
end
|
29
|
+
wrap_client_arg :get_termination_settings
|
30
|
+
|
31
|
+
def self.create_termination_settings(client, site_id, sippeer_id, data)
|
32
|
+
response = client.make_request(:post, "#{client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{sippeer_id}/#{SIPPEER_PRODUCTS_PATH}/termination/settings", {:sip_peer_termination_settings => data})
|
33
|
+
return response[0][:sip_peer_termination_settings]
|
34
|
+
end
|
35
|
+
wrap_client_arg :create_termination_settings
|
36
|
+
|
37
|
+
def self.update_termination_settings(client, site_id, sippeer_id, data)
|
38
|
+
client.make_request(:put, "#{client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{sippeer_id}/#{SIPPEER_PRODUCTS_PATH}/termination/settings", {:sip_peer_termination_settings => data})
|
39
|
+
end
|
40
|
+
wrap_client_arg :update_termination_settings
|
41
|
+
|
42
|
+
def self.get_sms_feature_settings(client, site_id, sippeer_id)
|
43
|
+
response = client.make_request(:get, "#{client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{sippeer_id}/#{SIPPEER_PRODUCTS_PATH}/messaging/features/sms")
|
44
|
+
return response[0][:sip_peer_sms_feature]
|
45
|
+
end
|
46
|
+
wrap_client_arg :get_sms_feature_settings
|
47
|
+
|
48
|
+
def self.create_sms_feature_settings(client, site_id, sippeer_id, data)
|
49
|
+
response = client.make_request(:post, "#{client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{sippeer_id}/#{SIPPEER_PRODUCTS_PATH}/messaging/features/sms", {:sip_peer_sms_feature => data})
|
50
|
+
return response[0][:sip_peer_sms_feature]
|
51
|
+
end
|
52
|
+
wrap_client_arg :create_sms_feature_settings
|
53
|
+
|
54
|
+
def self.update_sms_feature_settings(client, site_id, sippeer_id, data)
|
55
|
+
response = client.make_request(:put, "#{client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{sippeer_id}/#{SIPPEER_PRODUCTS_PATH}/messaging/features/sms", {:sip_peer_sms_feature => data})
|
56
|
+
return response[0][:sip_peer_sms_feature]
|
57
|
+
end
|
58
|
+
wrap_client_arg :update_sms_feature_settings
|
59
|
+
|
60
|
+
def self.delete_sms_feature_settings(client, site_id, sippeer_id)
|
61
|
+
response = client.make_request(:delete, "#{client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{sippeer_id}/#{SIPPEER_PRODUCTS_PATH}/messaging/features/sms")
|
62
|
+
return response
|
63
|
+
end
|
64
|
+
wrap_client_arg :delete_sms_feature_settings
|
65
|
+
|
66
|
+
def self.get_mms_feature_settings(client, site_id, sippeer_id)
|
67
|
+
response = client.make_request(:get, "#{client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{sippeer_id}/#{SIPPEER_PRODUCTS_PATH}/messaging/features/mms")
|
68
|
+
return response[0][:mms_feature]
|
69
|
+
end
|
70
|
+
wrap_client_arg :get_mms_feature_settings
|
71
|
+
|
72
|
+
def self.create_mms_feature_settings(client, site_id, sippeer_id, data)
|
73
|
+
response = client.make_request(:post, "#{client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{sippeer_id}/#{SIPPEER_PRODUCTS_PATH}/messaging/features/mms", {:mms_feature => data})
|
74
|
+
return response[0][:mms_feature]
|
75
|
+
end
|
76
|
+
wrap_client_arg :create_mms_feature_settings
|
77
|
+
|
78
|
+
def self.update_mms_feature_settings(client, site_id, sippeer_id, data)
|
79
|
+
client.make_request(:put, "#{client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{sippeer_id}/#{SIPPEER_PRODUCTS_PATH}/messaging/features/mms", {:mms_feature => data})
|
80
|
+
end
|
81
|
+
wrap_client_arg :update_mms_feature_settings
|
82
|
+
|
83
|
+
def self.delete_mms_feature_settings(client, site_id, sippeer_id)
|
84
|
+
client.make_request(:delete, "#{client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{sippeer_id}/#{SIPPEER_PRODUCTS_PATH}/messaging/features/mms")
|
85
|
+
end
|
86
|
+
wrap_client_arg :delete_mms_feature_settings
|
87
|
+
|
88
|
+
def self.get_mms_feature_mms_settings(client, site_id, sippeer_id)
|
89
|
+
response = client.make_request(:get, "#{client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{sippeer_id}/#{SIPPEER_PRODUCTS_PATH}/messaging/features/mms/settings")
|
90
|
+
return response[0][:mms_settings]
|
91
|
+
end
|
92
|
+
wrap_client_arg :get_mms_feature_mms_settings
|
93
|
+
|
94
|
+
def self.get_messaging_application_settings(client, site_id, sippeer_id)
|
95
|
+
response = client.make_request(:get, "#{client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{sippeer_id}/#{SIPPEER_PRODUCTS_PATH}/messaging/applicationSettings")
|
96
|
+
return response[0][:applications_settings]
|
97
|
+
end
|
98
|
+
wrap_client_arg :get_messaging_application_settings
|
99
|
+
|
100
|
+
def self.update_messaging_application_settings(client, site_id, sippeer_id, data)
|
101
|
+
response = client.make_request(:put, "#{client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{sippeer_id}/#{SIPPEER_PRODUCTS_PATH}/messaging/applicationSettings", {:applications_settings => data})
|
102
|
+
return response[0][:applications_settings]
|
103
|
+
end
|
104
|
+
wrap_client_arg :update_messaging_application_settings
|
105
|
+
|
106
|
+
def self.get_messaging_settings(client, site_id, sippeer_id)
|
107
|
+
response = client.make_request(:get, "#{client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{sippeer_id}/#{SIPPEER_PRODUCTS_PATH}/messaging/settings")
|
108
|
+
return response[0][:sip_peer_messaging_settings]
|
109
|
+
end
|
110
|
+
wrap_client_arg :get_messaging_settings
|
111
|
+
|
112
|
+
def self.update_messaging_settings(client, site_id, sippeer_id, data)
|
113
|
+
response = client.make_request(:put, "#{client.concat_account_path(SITE_PATH)}/#{site_id}/#{SIPPEER_PATH}/#{sippeer_id}/#{SIPPEER_PRODUCTS_PATH}/messaging/settings", {:sip_peer_messaging_settings => data})
|
114
|
+
return response[0][:sip_peer_messaging_settings]
|
115
|
+
end
|
116
|
+
wrap_client_arg :update_messaging_settings
|
117
|
+
end
|
118
|
+
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,11 @@ 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'
|
33
39
|
|
34
40
|
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
|
@@ -11,7 +11,7 @@ describe BandwidthIris::ImportTnOrders do
|
|
11
11
|
|
12
12
|
describe '#create' do
|
13
13
|
it 'should get an order' do
|
14
|
-
client.stubs.get('/v1.0/accounts/accountId/
|
14
|
+
client.stubs.get('/v1.0/accounts/accountId/importtnorders', {}) {|env| [200, {}, '']}
|
15
15
|
item = ImportTnOrders.get_import_tn_orders(client)
|
16
16
|
end
|
17
17
|
end
|
@@ -19,7 +19,7 @@ describe BandwidthIris::ImportTnOrders do
|
|
19
19
|
describe '#get' do
|
20
20
|
it 'should get an order' do
|
21
21
|
order = "123"
|
22
|
-
client.stubs.get("/v1.0/accounts/accountId/
|
22
|
+
client.stubs.get("/v1.0/accounts/accountId/importtnorders/#{order}", {}) {|env| [200, {}, '']}
|
23
23
|
item = ImportTnOrders.get_import_tn_order(client, order)
|
24
24
|
end
|
25
25
|
end
|
@@ -27,7 +27,7 @@ describe BandwidthIris::ImportTnOrders do
|
|
27
27
|
describe '#get history' do
|
28
28
|
it 'should get an order history' do
|
29
29
|
order = "123"
|
30
|
-
client.stubs.get("/v1.0/accounts/accountId/
|
30
|
+
client.stubs.get("/v1.0/accounts/accountId/importtnorders/#{order}/history", {}) {|env| [200, {}, '']}
|
31
31
|
item = ImportTnOrders.get_import_tn_order_history(client, order)
|
32
32
|
end
|
33
33
|
end
|
@@ -37,8 +37,86 @@ describe BandwidthIris::ImportTnOrders do
|
|
37
37
|
data = {
|
38
38
|
:id => "id"
|
39
39
|
}
|
40
|
-
client.stubs.post("/v1.0/accounts/accountId/
|
40
|
+
client.stubs.post("/v1.0/accounts/accountId/importtnorders", client.build_xml({:import_tn_order => data})) {|env| [200, {}, '']}
|
41
41
|
item = ImportTnOrders.create_import_tn_order(client, data)
|
42
42
|
end
|
43
43
|
end
|
44
|
+
|
45
|
+
describe '#get loa files' do
|
46
|
+
it 'should get loa files' do
|
47
|
+
order = "123"
|
48
|
+
client.stubs.get("/v1.0/accounts/accountId/importtnorders/#{order}/loas") {|env| [200, {}, '']}
|
49
|
+
item = ImportTnOrders.get_loa_files(client, order)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe '#upload loa file' do
|
54
|
+
it 'should upload loa file' do
|
55
|
+
file = '12345'
|
56
|
+
mime_type = 'text/plain'
|
57
|
+
order = '123'
|
58
|
+
client.stubs.post("/v1.0/accounts/accountId/importtnorders/#{order}/loas", file) {|env| [200, {}, '']}
|
59
|
+
item = ImportTnOrders.upload_loa_file(client, order, file, mime_type)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe '#download loa file' do
|
64
|
+
it 'should download loa file' do
|
65
|
+
order = "123"
|
66
|
+
file_id = "456"
|
67
|
+
client.stubs.get("/v1.0/accounts/accountId/importtnorders/#{order}/loas/#{file_id}") {|env| [200, {}, '']}
|
68
|
+
item = ImportTnOrders.download_loa_file(client, order, file_id)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe '#replace loa file' do
|
73
|
+
it 'should replace loa file' do
|
74
|
+
file = '12345'
|
75
|
+
mime_type = 'text/plain'
|
76
|
+
order = '123'
|
77
|
+
file_id = '456'
|
78
|
+
client.stubs.put("/v1.0/accounts/accountId/importtnorders/#{order}/loas/#{file_id}", file) {|env| [200, {}, '']}
|
79
|
+
item = ImportTnOrders.replace_loa_file(client, order, file_id, file, mime_type)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
describe '#delete loa file' do
|
84
|
+
it 'should delete loa file' do
|
85
|
+
order = '123'
|
86
|
+
file_id = '456'
|
87
|
+
client.stubs.delete("/v1.0/accounts/accountId/importtnorders/#{order}/loas/#{file_id}") {|env| [200, {}, '']}
|
88
|
+
item = ImportTnOrders.delete_loa_file(client, order, file_id)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
describe '#get loa file metadata' do
|
93
|
+
it 'should get loa file metadata' do
|
94
|
+
order = "123"
|
95
|
+
file_id = "456"
|
96
|
+
client.stubs.get("/v1.0/accounts/accountId/importtnorders/#{order}/loas/#{file_id}/metadata") {|env| [200, {}, '']}
|
97
|
+
item = ImportTnOrders.get_loa_file_metadata(client, order, file_id)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
describe '#update loa file metadata' do
|
102
|
+
it 'should update loa file metadata' do
|
103
|
+
data = {
|
104
|
+
:test => "1234"
|
105
|
+
}
|
106
|
+
order = "123"
|
107
|
+
file_id = "456"
|
108
|
+
client.stubs.put("/v1.0/accounts/accountId/importtnorders/#{order}/loas/#{file_id}/metadata", client.build_xml({:file_meta_data => data})) {|env| [200, {}, '']}
|
109
|
+
item = ImportTnOrders.update_loa_file_metadata(client, order, file_id, data)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
describe '#delete loa file metadata' do
|
114
|
+
it 'should delete loa file metadata' do
|
115
|
+
order = "123"
|
116
|
+
file_id = "456"
|
117
|
+
client.stubs.delete("/v1.0/accounts/accountId/importtnorders/#{order}/loas/#{file_id}/metadata") {|env| [200, {}, '']}
|
118
|
+
item = ImportTnOrders.delete_loa_file_metadata(client, order, file_id)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
44
122
|
end
|