ruby-bandwidth-iris 2.3.0 → 2.4.0.pre

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3978f9cb23b6ccd98b3324561287e355989f2f2ccb448889c8e9ee7c4d2b44e8
4
- data.tar.gz: cdf8e79ee66a665f3078c2248629b60301b39ba2c4451fe250b14cda0289a4fe
3
+ metadata.gz: 83627fd824b9f64805e8b53a930425df17356dd3f2fbde9f4161922522e9db3b
4
+ data.tar.gz: 5ab48b9dfb000c1031818570571c12848c5d5bd7fce08f54cfd24afbaa5905cd
5
5
  SHA512:
6
- metadata.gz: e44534d1e0f6d257ccb3dddd8b92d2f110f02b038e48308938d41cd42c5308307192054432584dbc96fc5ad8e23a67e736d42298b6c0f0b5fe4f641fa753f5a5
7
- data.tar.gz: 244feb0ca080e43a618acad67d6178b528b6b09f0b6d9685b7a85173fd3eeffe91c58abaff4151aa0443478f53e4c35362863cde3b9d851396e57e06c2c26ec4
6
+ metadata.gz: a0511c5e66d201afa467304182fac712ee02e2675802682c47fc4679093fdb2e97252cb46daa654a9db1d8c23b0dc6ca3fa71310f2b679fef872d81e5592fd3f
7
+ data.tar.gz: 5219a155537a1de18c1666b739c4c308860ad7f48b148bcb14052072363c2f6abf3210a1141464d725f50d9396ecc7e85ba6cb885a375ca9c0a3042f39749757
data/README.md CHANGED
@@ -14,6 +14,7 @@ Ruby Client library for IRIS / BBS API
14
14
  | 2.1.0 | Added `csrs` endpoints |
15
15
  | 2.2.0 | Added `loas` endpoints to `importTnOrders` |
16
16
  | 2.3.0 | Added `get_tns_by_order_id` to the Orders class |
17
+ | 2.4.0 | Added application management and sippeer products endpoints |
17
18
 
18
19
  ## Install
19
20
 
@@ -827,3 +828,252 @@ note_data = {
827
828
 
828
829
  BandwidthIris::Csr.update_note("csr_id", "note_id", note_data)
829
830
  ```
831
+
832
+ ## Application Management
833
+
834
+ ### Create Application
835
+
836
+ ```ruby
837
+ data = {
838
+ :service_type => "Messaging-V2",
839
+ :app_name => "Name",
840
+ :msg_callback_url => "https://test.com"
841
+ }
842
+ application = BandwidthIris::Applications.create_application(data)
843
+ puts application
844
+ ```
845
+
846
+ ### Get Applications
847
+
848
+ ```ruby
849
+ applications = BandwidthIris::Applications.get_applications()
850
+ puts applications[0]
851
+ ```
852
+
853
+ ### Get An Application
854
+
855
+ ```ruby
856
+ application = BandwidthIris::Applications.get_application("id")
857
+ puts application
858
+ ```
859
+
860
+ ### Partially Update An Application
861
+
862
+ ```ruby
863
+ data = {
864
+ :app_name => "Name2"
865
+ }
866
+ application = BandwidthIris::Applications.partial_update_application("id", data)
867
+ puts application
868
+ ```
869
+
870
+ ### Completely Update An Application
871
+
872
+ ```ruby
873
+ data = {
874
+ :service_type => "Messaging-V2",
875
+ :app_name => "Name2",
876
+ :msg_callback_url => "https://test2.com"
877
+ }
878
+ application = BandwidthIris::Applications.complete_update_application("id", data)
879
+ puts application
880
+ ```
881
+
882
+ ### Remove An Application
883
+
884
+ ```ruby
885
+ BandwidthIris::Applications.delete_application("id")
886
+ ```
887
+
888
+ ### List Application Sippeers
889
+
890
+ ```ruby
891
+ sippeers = BandwidthIris::Applications.get_application_sippeers("id")
892
+ puts sippeers[0]
893
+ ```
894
+
895
+ ## SipPeer Products
896
+
897
+ ### Get Origination Settings
898
+
899
+ ```ruby
900
+ puts BandwidthIris::SipPeerProducts.get_origination_settings("site_id", "sippeer_id")
901
+ ```
902
+
903
+ ### Create Origination Settings
904
+
905
+ ```ruby
906
+ data = {
907
+ :voice_protocol => "HTTP"
908
+ }
909
+ puts BandwidthIris::SipPeerProducts.create_origination_settings("site_id", "sippeer_id", data)
910
+ ```
911
+
912
+ ### Update Origination Settings
913
+
914
+ ```ruby
915
+ data = {
916
+ :voice_protocol => "HTTP"
917
+ }
918
+ BandwidthIris::SipPeerProducts.update_origination_settings("site_id", "sippeer_id", data)
919
+ ```
920
+
921
+ ### Get Termination Settings
922
+
923
+ ```ruby
924
+ puts BandwidthIris::SipPeerProducts.get_termination_settings("site_id", "sippeer_id")
925
+ ```
926
+
927
+ ### Create Termination Settings
928
+
929
+ ```ruby
930
+ data = {
931
+ :voice_protocol => "HTTP"
932
+ }
933
+ puts BandwidthIris::SipPeerProducts.create_termination_settings("site_id", "sippeer_id", data)
934
+ ```
935
+
936
+ ### Update Termination Settings
937
+
938
+ ```ruby
939
+ data = {
940
+ :voice_protocol => "HTTP"
941
+ }
942
+ BandwidthIris::SipPeerProducts.update_termination_settings("site_id", "sippeer_id", data)
943
+ ```
944
+
945
+ ### Get Sms Feature Settings
946
+
947
+ ```ruby
948
+ puts BandwidthIris::SipPeerProducts.get_sms_feature_settings("site_id", "sippeer_id")
949
+ ```
950
+
951
+ ### Create Sms Feature Settings
952
+
953
+ ```ruby
954
+ data = {
955
+ :sip_peer_sms_feature_settings => {
956
+ :toll_free => true,
957
+ :protocol => "HTTP",
958
+ :zone_1 => true,
959
+ :zone_2 => false,
960
+ :zone_3 => false,
961
+ :zone_4 => false,
962
+ :zone_5 => false
963
+ },
964
+ :http_settings => {}
965
+ }
966
+
967
+ puts BandwidthIris::SipPeerProducts.create_sms_feature_settings("site_id", "sippeer_id", data)
968
+ ```
969
+
970
+ ### Update Sms Feature Settings
971
+
972
+ ```ruby
973
+ data = {
974
+ :sip_peer_sms_feature_settings => {
975
+ :toll_free => true,
976
+ :protocol => "HTTP",
977
+ :zone_1 => true,
978
+ :zone_2 => false,
979
+ :zone_3 => false,
980
+ :zone_4 => false,
981
+ :zone_5 => false
982
+ },
983
+ :http_settings => {}
984
+ }
985
+
986
+ puts BandwidthIris::SipPeerProducts.update_sms_feature_settings("site_id", "sippeer_id", data)
987
+ ```
988
+
989
+ ### Delete Sms Feature Settings
990
+
991
+ ```ruby
992
+ BandwidthIris::SipPeerProducts.delete_sms_feature_settings("site_id", "sippeer_id")
993
+ ```
994
+
995
+ ### Get Mms Feature Settings
996
+
997
+ ```ruby
998
+ puts BandwidthIris::SipPeerProducts.get_mms_feature_settings("site_id", "sippeer_id")
999
+ ```
1000
+
1001
+ ### Create Mms Feature Settings
1002
+
1003
+ ```ruby
1004
+ data = {
1005
+ :mms_settings => {
1006
+ :protocol => "HTTP"
1007
+ },
1008
+ :protocols => {
1009
+ :HTTP => {
1010
+ :http_settings => {}
1011
+ }
1012
+ }
1013
+ }
1014
+
1015
+ puts BandwidthIris::SipPeerProducts.create_mms_feature_settings("site_id", "sippeer_id", data)
1016
+ ```
1017
+
1018
+ ### Update Mms Feature Settings
1019
+
1020
+ ```ruby
1021
+ data = {
1022
+ :mms_settings => {
1023
+ :protocol => "HTTP"
1024
+ },
1025
+ :protocols => {
1026
+ :HTTP => {
1027
+ :http_settings => {}
1028
+ }
1029
+ }
1030
+ }
1031
+
1032
+ BandwidthIris::SipPeerProducts.update_mms_feature_settings("site_id", "sippeer_id", data)
1033
+ ```
1034
+
1035
+ ### Delete Mms Feature Settings
1036
+
1037
+ ```ruby
1038
+ BandwidthIris::SipPeerProducts.delete_mms_feature_settings("site_id", "sippeer_id")
1039
+ ```
1040
+
1041
+ ### Get Mms Feature Mms Settings
1042
+
1043
+ ```ruby
1044
+ puts BandwidthIris::SipPeerProducts.get_mms_feature_mms_settings("site_id", "sippeer_id")
1045
+ ```
1046
+
1047
+ ### Get Messaging Application Settings
1048
+
1049
+ ```ruby
1050
+ puts BandwidthIris::SipPeerProducts.get_messaging_application_settings("site_id", "sippeer_id")
1051
+ ```
1052
+
1053
+ ### Update Messaging Application Settings
1054
+
1055
+ ```ruby
1056
+ data = {
1057
+ :http_messaging_v2_app_id => "4-d-4-8-5"
1058
+ }
1059
+
1060
+ puts BandwidthIris::SipPeerProducts.update_messaging_application_settings("site_id", "sippeer_id", data)
1061
+ ```
1062
+
1063
+ ### Get Messaging Settings
1064
+
1065
+ ```ruby
1066
+ puts BandwidthIris::SipPeerProducts.get_messaging_settings("site_id", "sippeer_id")
1067
+ ```
1068
+
1069
+ ### Update Messaging Settings
1070
+
1071
+ ```ruby
1072
+ data = {
1073
+ :break_out_countries => {
1074
+ :country => "CAN"
1075
+ }
1076
+ }
1077
+
1078
+ puts BandwidthIris::SipPeerProducts.update_messaging_settings("site_id", "sippeer_id", data)
1079
+ ```
@@ -0,0 +1,61 @@
1
+ module BandwidthIris
2
+ APPLICATIONS_PATH = "applications"
3
+
4
+ class Applications
5
+ extend ClientWrapper
6
+ include ApiItem
7
+
8
+ def self.get_applications(client)
9
+ data = client.make_request(:get, client.concat_account_path(APPLICATIONS_PATH))
10
+ list = data[0][:application_list][:application]
11
+ return [] if !list
12
+ if list.is_a?(Array) then
13
+ return list
14
+ else
15
+ return [list]
16
+ end
17
+ end
18
+ wrap_client_arg :get_applications
19
+
20
+ def self.create_application(client, application_data)
21
+ data = client.make_request(:post, client.concat_account_path(APPLICATIONS_PATH), {:application => application_data})
22
+ return data[0][:application]
23
+ end
24
+ wrap_client_arg :create_application
25
+
26
+ def self.get_application(client, application_id)
27
+ data = client.make_request(:get, client.concat_account_path("#{APPLICATIONS_PATH}/#{application_id}"))
28
+ return data[0][:application]
29
+ end
30
+ wrap_client_arg :get_application
31
+
32
+ def self.partial_update_application(client, application_id, application_data)
33
+ data = client.make_request(:patch, client.concat_account_path("#{APPLICATIONS_PATH}/#{application_id}"), {:application => application_data})
34
+ return data[0][:application]
35
+ end
36
+ wrap_client_arg :partial_update_application
37
+
38
+ def self.complete_update_application(client, application_id, application_data)
39
+ data = client.make_request(:put, client.concat_account_path("#{APPLICATIONS_PATH}/#{application_id}"), {:application => application_data})
40
+ return data[0][:application]
41
+ end
42
+ wrap_client_arg :complete_update_application
43
+
44
+ def self.delete_application(client, application_id)
45
+ client.make_request(:delete, client.concat_account_path("#{APPLICATIONS_PATH}/#{application_id}"))
46
+ end
47
+ wrap_client_arg :delete_application
48
+
49
+ def self.get_application_sippeers(client, application_id)
50
+ data = client.make_request(:get, client.concat_account_path("#{APPLICATIONS_PATH}/#{application_id}/associatedsippeers"))
51
+ list = data[0][:associated_sip_peers][:associated_sip_peer]
52
+ return [] if !list
53
+ if list.is_a?(Array) then
54
+ return list
55
+ else
56
+ return [list]
57
+ end
58
+ end
59
+ wrap_client_arg :get_application_sippeers
60
+ end
61
+ 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
@@ -1,4 +1,4 @@
1
1
  module BandwidthIris
2
2
  # Version of this gem
3
- VERSION = "2.3.0"
3
+ VERSION = "2.4.0.pre"
4
4
  end
@@ -30,5 +30,7 @@ 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'
33
35
 
34
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,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
data/spec/xml.yml CHANGED
@@ -47,3 +47,15 @@
47
47
  account: "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><AccountResponse><Account><AccountId>14</AccountId><CompanyName>CWI Hosting</CompanyName><AccountType>Business</AccountType><NenaId></NenaId><Tiers><Tier>0</Tier></Tiers><Address><HouseNumber>60</HouseNumber><HouseSuffix></HouseSuffix><PreDirectional></PreDirectional><StreetName>Pine</StreetName><StreetSuffix>St</StreetSuffix><PostDirectional></PostDirectional><AddressLine2></AddressLine2><City>Denver</City><StateCode>CO</StateCode><Zip>80016</Zip><PlusFour></PlusFour><County></County><Country>United States</Country><AddressType>Service</AddressType></Address><Contact><FirstName>Sanjay</FirstName><LastName>Rao</LastName><Phone>9195441234</Phone><Email>srao@bandwidth.com</Email></Contact><ReservationAllowed>true</ReservationAllowed><LnpEnabled>true</LnpEnabled><AltSpid>X455</AltSpid><SPID>9999</SPID><PortCarrierType>WIRELINE</PortCarrierType></Account></AccountResponse>"
48
48
  import_tn_checker: '<?xml version="1.0" encoding="UTF-8"?><ImportTnCheckerPayload><TelephoneNumbers><TelephoneNumber>5554443333</TelephoneNumber><TelephoneNumber>5553334444</TelephoneNumber></TelephoneNumbers></ImportTnCheckerPayload>'
49
49
  csr: '<?xml version="1.0" encoding="UTF-8"?><CsrResponse><Status>RECEIVED</Status></CsrResponse>'
50
+ application: '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><ApplicationProvisioningResponse><Application><ApplicationId>d1</ApplicationId></Application></ApplicationProvisioningResponse>'
51
+ applicationList: '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><ApplicationProvisioningResponse><ApplicationList><Application><ApplicationId>d1</ApplicationId></Application><Application><ApplicationId>d2</ApplicationId></Application></ApplicationList></ApplicationProvisioningResponse>'
52
+ applicationListOne: '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><ApplicationProvisioningResponse><ApplicationList><Application><ApplicationId>d1</ApplicationId></Application></ApplicationList></ApplicationProvisioningResponse>'
53
+ applicationSippeers: '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><AssociatedSipPeersResponse><AssociatedSipPeers><AssociatedSipPeer><SiteId>1</SiteId></AssociatedSipPeer><AssociatedSipPeer><SiteId>2</SiteId></AssociatedSipPeer></AssociatedSipPeers></AssociatedSipPeersResponse>'
54
+ applicationSippeersOne: '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><AssociatedSipPeersResponse><AssociatedSipPeers><AssociatedSipPeer><SiteId>1</SiteId></AssociatedSipPeer></AssociatedSipPeers></AssociatedSipPeersResponse>'
55
+ sippeerOriginationSettings: '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><SipPeerOriginationSettingsResponse><SipPeerOriginationSettings><VoiceProtocol>HTTP</VoiceProtocol><HttpSettings><HttpVoiceV2AppId>469ebbac-4459-4d98-bc19-a038960e787f</HttpVoiceV2AppId></HttpSettings></SipPeerOriginationSettings></SipPeerOriginationSettingsResponse>'
56
+ sippeerTerminationSettings: '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><SipPeerTerminationSettingsResponse><SipPeerTerminationSettings><VoiceProtocol>HTTP</VoiceProtocol><HttpSettings><HttpVoiceV2AppId>469ebbac-4459-4d98-bc19-a038960e787f</HttpVoiceV2AppId></HttpSettings></SipPeerTerminationSettings></SipPeerTerminationSettingsResponse>'
57
+ sippeerSmsFeature: '<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?><SipPeerSmsFeatureResponse><SipPeerSmsFeature><SipPeerSmsFeatureSettings><TollFree>true</TollFree><ShortCode>true</ShortCode></SipPeerSmsFeatureSettings><SmppHosts><SmppHost><HostName>54.10.88.146</HostName></SmppHost></SmppHosts></SipPeerSmsFeature></SipPeerSmsFeatureResponse>'
58
+ sippeerMmsFeature: '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><MmsFeatureResponse><MmsFeature><MmsSettings><Protocol>MM4</Protocol></MmsSettings></MmsFeature></MmsFeatureResponse>'
59
+ sippeerMmsFeatureMmsSettings: '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><MmsFeatureMmsSettingsResponse><MmsSettings><Protocol>MM4</Protocol></MmsSettings></MmsFeatureMmsSettingsResponse>'
60
+ messagingApplicationSettings: '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><ApplicationsSettingsResponse><ApplicationsSettings><HttpMessagingV2AppId>4a4ca6c1-156b-4fca-84e9-34e35e2afc32</HttpMessagingV2AppId></ApplicationsSettings></ApplicationsSettingsResponse>'
61
+ sippeerMessageSettings: '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><SipPeerMessagingSettingsResponse><SipPeerMessagingSettings><BreakOutCountries><Country>CAN</Country></BreakOutCountries></SipPeerMessagingSettings></SipPeerMessagingSettingsResponse>'
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: 2.3.0
4
+ version: 2.4.0.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey Belchikov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-15 00:00:00.000000000 Z
11
+ date: 2020-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder
@@ -165,6 +165,7 @@ files:
165
165
  - examples/tn.rb
166
166
  - lib/bandwidth-iris/account.rb
167
167
  - lib/bandwidth-iris/api_item.rb
168
+ - lib/bandwidth-iris/applications.rb
168
169
  - lib/bandwidth-iris/available_npa_nxx.rb
169
170
  - lib/bandwidth-iris/available_number.rb
170
171
  - lib/bandwidth-iris/city.rb
@@ -189,6 +190,7 @@ files:
189
190
  - lib/bandwidth-iris/rate_center.rb
190
191
  - lib/bandwidth-iris/remove_imported_tn_orders.rb
191
192
  - lib/bandwidth-iris/sip_peer.rb
193
+ - lib/bandwidth-iris/sip_peer_products.rb
192
194
  - lib/bandwidth-iris/site.rb
193
195
  - lib/bandwidth-iris/subscription.rb
194
196
  - lib/bandwidth-iris/tn.rb
@@ -198,6 +200,7 @@ files:
198
200
  - lib/ruby-bandwidth-iris.rb
199
201
  - ruby-bandwidth-iris.gemspec
200
202
  - spec/bandwidth-iris/account_spec.rb
203
+ - spec/bandwidth-iris/application_spec.rb
201
204
  - spec/bandwidth-iris/available_npa_nxx_spec.rb
202
205
  - spec/bandwidth-iris/available_number_spec.rb
203
206
  - spec/bandwidth-iris/city_spec.rb
@@ -219,6 +222,7 @@ files:
219
222
  - spec/bandwidth-iris/port_out_spec.rb
220
223
  - spec/bandwidth-iris/rate_center_spec.rb
221
224
  - spec/bandwidth-iris/remove_imported_tn_orders_spec.rb
225
+ - spec/bandwidth-iris/sip_peer_products_spec.rb
222
226
  - spec/bandwidth-iris/sip_peer_spec.rb
223
227
  - spec/bandwidth-iris/site_spec.rb
224
228
  - spec/bandwidth-iris/subscription_spec.rb
@@ -242,9 +246,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
242
246
  version: '0'
243
247
  required_rubygems_version: !ruby/object:Gem::Requirement
244
248
  requirements:
245
- - - ">="
249
+ - - ">"
246
250
  - !ruby/object:Gem::Version
247
- version: '0'
251
+ version: 1.3.1
248
252
  requirements: []
249
253
  rubygems_version: 3.0.6
250
254
  signing_key:
@@ -252,6 +256,7 @@ specification_version: 4
252
256
  summary: Gem for integrating to Bandwidth's Iris API
253
257
  test_files:
254
258
  - spec/bandwidth-iris/account_spec.rb
259
+ - spec/bandwidth-iris/application_spec.rb
255
260
  - spec/bandwidth-iris/available_npa_nxx_spec.rb
256
261
  - spec/bandwidth-iris/available_number_spec.rb
257
262
  - spec/bandwidth-iris/city_spec.rb
@@ -273,6 +278,7 @@ test_files:
273
278
  - spec/bandwidth-iris/port_out_spec.rb
274
279
  - spec/bandwidth-iris/rate_center_spec.rb
275
280
  - spec/bandwidth-iris/remove_imported_tn_orders_spec.rb
281
+ - spec/bandwidth-iris/sip_peer_products_spec.rb
276
282
  - spec/bandwidth-iris/sip_peer_spec.rb
277
283
  - spec/bandwidth-iris/site_spec.rb
278
284
  - spec/bandwidth-iris/subscription_spec.rb