ruby-bandwidth-iris 2.0.1 → 2.5.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.
@@ -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, item)
16
- location = client.make_request(:post, client.concat_account_path(TN_RESERVATION_PATH), {:tn_reservation => item})[1][:location]
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
@@ -1,4 +1,4 @@
1
1
  module BandwidthIris
2
2
  # Version of this gem
3
- VERSION = "2.0.1"
3
+ VERSION = "2.5.0"
4
4
  end
@@ -29,5 +29,8 @@ require 'bandwidth-iris/user'
29
29
  require 'bandwidth-iris/import_tn_orders'
30
30
  require 'bandwidth-iris/import_tn_checker'
31
31
  require 'bandwidth-iris/remove_imported_tn_orders'
32
+ require 'bandwidth-iris/csr'
33
+ require 'bandwidth-iris/applications'
34
+ require 'bandwidth-iris/sip_peer_products'
32
35
 
33
36
  require 'bandwidth-iris/version'
@@ -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,73 @@
1
+ describe BandwidthIris::Csr 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 '#create' do
13
+ it 'should create a csr' do
14
+ data = {
15
+ :customer_order_id => "123",
16
+ :working_or_billing_telephone_number => "5554443333"
17
+ }
18
+ client.stubs.post("/v1.0/accounts/accountId/csrs", client.build_xml({:csr => data})) {|env| [200, {}, Helper.xml['csr']]}
19
+ item = BandwidthIris::Csr.create(client, data)
20
+ expect(item[0][:status]).to eql("RECEIVED")
21
+ end
22
+ end
23
+
24
+ describe '#get' do
25
+ it 'should get a csr' do
26
+ client.stubs.get("/v1.0/accounts/accountId/csrs/123") {|env| [200, {}, Helper.xml['csr']]}
27
+ item = BandwidthIris::Csr.get(client, "123")
28
+ expect(item[0][:status]).to eql("RECEIVED")
29
+ end
30
+ end
31
+
32
+ describe '#replace' do
33
+ it 'should replace a csr' do
34
+ data = {
35
+ :customer_order_id => "123",
36
+ :working_or_billing_telephone_number => "5554443333"
37
+ }
38
+ client.stubs.put("/v1.0/accounts/accountId/csrs/123", client.build_xml({:csr => data})) {|env| [200, {}, Helper.xml['csr']]}
39
+ item = BandwidthIris::Csr.replace(client, "123", data)
40
+ expect(item[0][:status]).to eql("RECEIVED")
41
+ end
42
+ end
43
+
44
+ describe '#getnotes' do
45
+ it 'should get csr notes' do
46
+ client.stubs.get("/v1.0/accounts/accountId/csrs/123/notes") {|env| [200, {}, Helper.xml['notes']]}
47
+ item = BandwidthIris::Csr.get_notes(client, "123")
48
+ expect(item[0][:note][0][:id]).to eql(11299)
49
+ end
50
+ end
51
+
52
+ describe '#addnote' do
53
+ it 'should add csr note' do
54
+ data = {
55
+ :user_id => "id",
56
+ :description => "description"
57
+ }
58
+ client.stubs.post("/v1.0/accounts/accountId/csrs/123/notes", client.build_xml({:note => data})) {|env| [200, {}, ""]}
59
+ BandwidthIris::Csr.add_note(client, "123", data)
60
+ end
61
+ end
62
+
63
+ describe '#updatenote' do
64
+ it 'should update csr note' do
65
+ data = {
66
+ :user_id => "id",
67
+ :description => "description"
68
+ }
69
+ client.stubs.put("/v1.0/accounts/accountId/csrs/123/notes/456", client.build_xml({:note => data})) {|env| [200, {}, ""]}
70
+ BandwidthIris::Csr.update_note(client, "123", "456", data)
71
+ end
72
+ end
73
+ 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/importTnOrders', {}) {|env| [200, {}, '']}
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/importTnOrders/#{order}", {}) {|env| [200, {}, '']}
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/importTnOrders/#{order}/history", {}) {|env| [200, {}, '']}
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/importTnOrders", client.build_xml({:import_tn_order => data})) {|env| [200, {}, '']}
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
@@ -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 => "Test",
16
- :siteId => "10",
17
- :customerOrderId => "11",
18
- :lataSearchAndOrderType => {
19
- :lata => "224",
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['order']]}
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(101)
26
- expect(order.name).to eql("Test")
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