ruby-bandwidth-iris 2.0.1 → 2.5.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 +403 -7
- data/examples/create_reservation_and_order.rb +79 -0
- data/examples/order_number.rb +83 -0
- data/lib/bandwidth-iris/applications.rb +61 -0
- data/lib/bandwidth-iris/client.rb +33 -1
- data/lib/bandwidth-iris/csr.rb +44 -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 +3 -0
- data/spec/bandwidth-iris/application_spec.rb +90 -0
- data/spec/bandwidth-iris/csr_spec.rb +73 -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 +16 -3
- metadata +13 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '08d149b50259af28149c7018f600fcbf22d694c15604b85073a38fa4255ebff7'
|
4
|
+
data.tar.gz: 0beef4622c48e6e119475e37644a16a09a4c74fb9cac935cf10ea82b7e55d377
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8e8fc95953e9bb5ed6c00a24c5cccef35cea81a31c710c6560eb7c4b0b96a6c3a533cb365fbad0a2aea3a1ac854fb79318b49412d3e5a9125b5219d379e70f9
|
7
|
+
data.tar.gz: 308bdcbc9d7124297535b1656befc3da6fbe574fc878c90573000ae43867da64f05c7349bb4fd27621927393487d3d6ad09b35b8f97b01c252ef42fb0e0b01eb
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -6,11 +6,17 @@ Ruby Client library for IRIS / BBS API
|
|
6
6
|
|
7
7
|
## Release Notes
|
8
8
|
|
9
|
-
| Release Version | Notes
|
10
|
-
|
11
|
-
| 1.0.5
|
12
|
-
| 2.0.0
|
13
|
-
| 2.0.1
|
9
|
+
| Release Version | Notes |
|
10
|
+
|:----------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
11
|
+
| 1.0.5 | Fixed incorrect generation of XML for a Disconnect request |
|
12
|
+
| 2.0.0 | Added `importTnOrders`, `removeImportedTnOrders`, `inserviceNumbers`, and `importTnChecker` endpoints. This release also changed the response body of `BandwidthIris::InServiceNumber.list()`. Please make sure to update your code to include this change. |
|
13
|
+
| 2.0.1 | Updated gem dependencies to be less restrictive |
|
14
|
+
| 2.1.0 | Added `csrs` endpoints |
|
15
|
+
| 2.2.0 | Added `loas` endpoints to `importTnOrders` |
|
16
|
+
| 2.3.0 | Added `get_tns_by_order_id` to the Orders class |
|
17
|
+
| 2.4.0.pre | Added application management and sippeer products endpoints |
|
18
|
+
| 2.5.0 | Added `get_order_response` to pull full `<OrderResponse>` object from API, added `id` back to order object on get requests |
|
19
|
+
| 2.6.0 | Fixed TN Reservation and updated tests to match reality |
|
14
20
|
|
15
21
|
## Install
|
16
22
|
|
@@ -74,6 +80,7 @@ When fetching objects from the API, it will always return an object that has the
|
|
74
80
|
instantiated so that you can call dependent methods as well as update, delete.
|
75
81
|
|
76
82
|
Example:
|
83
|
+
|
77
84
|
```ruby
|
78
85
|
site = BandwidthIris::Site.create({siteObject})
|
79
86
|
|
@@ -308,6 +315,16 @@ BandwidthIris::Order.create(order_data)
|
|
308
315
|
```ruby
|
309
316
|
order = BandwidthIris::Order.get("order_id")
|
310
317
|
```
|
318
|
+
|
319
|
+
### Get Order Response
|
320
|
+
|
321
|
+
The order response object contains more details returned in the `GET` `/orders/order-id` API.
|
322
|
+
|
323
|
+
```ruby
|
324
|
+
order = BandwidthIris::Order.get_order_response(client, "101")
|
325
|
+
completed_number = order.completed_numbers[:telephone_number][:full_number]
|
326
|
+
```
|
327
|
+
|
311
328
|
### List Orders
|
312
329
|
```ruby
|
313
330
|
BandwidthIris::Order.list(query)
|
@@ -329,6 +346,8 @@ order.get_totals()
|
|
329
346
|
|
330
347
|
// get all Tns for an order
|
331
348
|
order.get_tns()
|
349
|
+
##Use the below method to grab TNs via an already existing Order ID##
|
350
|
+
BandwidthIris::Order.get_tns_by_order_id("id")
|
332
351
|
|
333
352
|
// get order history
|
334
353
|
order.get_history()
|
@@ -458,7 +477,7 @@ sipPeer.delete()
|
|
458
477
|
### SipPeer TN Methods
|
459
478
|
```ruby
|
460
479
|
# get TN for this peer
|
461
|
-
sipPeer.get_tns(number)
|
480
|
+
sipPeer.get_tns(number)
|
462
481
|
|
463
482
|
# get all TNs for this peer
|
464
483
|
sipPeer.get_tns()
|
@@ -583,7 +602,7 @@ tn.get_rate_center()
|
|
583
602
|
|
584
603
|
### Create TN Reservation
|
585
604
|
```ruby
|
586
|
-
BandwidthIris::TnReservation.create(
|
605
|
+
BandwidthIris::TnReservation.create("9195551212")
|
587
606
|
```
|
588
607
|
|
589
608
|
### Get TN Reservation
|
@@ -603,6 +622,7 @@ tn.delete()
|
|
603
622
|
import_tn_order = {
|
604
623
|
:customer_order_id => "id",
|
605
624
|
:site_id => "12345",
|
625
|
+
:sip_peer_id => "23456",
|
606
626
|
:subscriber => {
|
607
627
|
:service_address => {
|
608
628
|
:city => "city",
|
@@ -694,3 +714,379 @@ remove_imported_tn_order = {
|
|
694
714
|
response = BandwidthIris::RemoveImportedTnOrders.create_remove_imported_tn_order(remove_imported_tn_order)
|
695
715
|
puts response
|
696
716
|
```
|
717
|
+
|
718
|
+
### Get LOAs
|
719
|
+
```ruby
|
720
|
+
response = BandwidthIris::ImportTnOrders.get_loa_files("order_id")
|
721
|
+
puts response[0][:result_message]
|
722
|
+
puts response[0][:file_names] #this can be a single string (if there's 1 file) or an array of strings (if there's multiple files)
|
723
|
+
```
|
724
|
+
|
725
|
+
### Upload LOA
|
726
|
+
Valid `mime_types` can be found on the [Dashboard API Reference](https://dev.bandwidth.com/numbers/apiReference.html) under `/accounts /{accountId} /importTnOrders /{orderid} /loas`
|
727
|
+
|
728
|
+
Mime types are expected to be in the format `x/y`, such as `application/pdf` or `text/plain`
|
729
|
+
|
730
|
+
```ruby
|
731
|
+
BandwidthIris::ImportTnOrders.upload_loa_file("order_id", "binary_file_contents", "mime_type")
|
732
|
+
```
|
733
|
+
|
734
|
+
```ruby
|
735
|
+
f = open("loa.pdf", "rb")
|
736
|
+
file_content = f.read
|
737
|
+
f.close()
|
738
|
+
|
739
|
+
BandwidthIris::ImportTnOrders.upload_loa_file("order_id", file_content, "application/pdf")
|
740
|
+
```
|
741
|
+
|
742
|
+
### Download LOA
|
743
|
+
Note: Make sure to grab the desired file ID from the response of `BandwidthIris::ImportTnOrders.get_loa_files("order_id")` in the field `response[0][:file_names]`
|
744
|
+
|
745
|
+
```ruby
|
746
|
+
f = open("write.pdf", "wb")
|
747
|
+
response = BandwidthIris::ImportTnOrders.download_loa_file("order_id", "file_id")
|
748
|
+
f.puts(response)
|
749
|
+
f.close()
|
750
|
+
```
|
751
|
+
|
752
|
+
### Replace LOA
|
753
|
+
```ruby
|
754
|
+
BandwidthIris::ImportTnOrders.replace_loa_file("order_id", "file_id", "binary_file_contents", "mime_type")
|
755
|
+
```
|
756
|
+
|
757
|
+
### Delete LOA
|
758
|
+
```ruby
|
759
|
+
BandwidthIris::ImportTnOrders.delete_loa_file("order_id", "file_id")
|
760
|
+
```
|
761
|
+
|
762
|
+
### Get LOA Metadata
|
763
|
+
```ruby
|
764
|
+
response = BandwidthIris::ImportTnOrders.get_loa_file_metadata("order_id", "file_id")
|
765
|
+
puts response[0][:document_name]
|
766
|
+
puts response[0][:file_name]
|
767
|
+
```
|
768
|
+
|
769
|
+
### Update LOA Metadata
|
770
|
+
```ruby
|
771
|
+
metadata = {
|
772
|
+
:document_name => "file_name",
|
773
|
+
:document_type => "LOA"
|
774
|
+
}
|
775
|
+
BandwidthIris::ImportTnOrders.update_loa_file_metadata("order_id", "file_id", metadata)
|
776
|
+
```
|
777
|
+
|
778
|
+
### Delete LOA Metadata
|
779
|
+
```ruby
|
780
|
+
BandwidthIris::ImportTnOrders.delete_loa_file_metadata("order_id", "file_id")
|
781
|
+
```
|
782
|
+
|
783
|
+
## CSR
|
784
|
+
|
785
|
+
### Create CSR Order
|
786
|
+
|
787
|
+
```ruby
|
788
|
+
csr_data = {
|
789
|
+
:customer_order_id => "order id",
|
790
|
+
:working_or_billing_telephone_number => "5554443333"
|
791
|
+
}
|
792
|
+
|
793
|
+
response = BandwidthIris::Csr.create(csr_data)
|
794
|
+
puts response[0][:order_id]
|
795
|
+
```
|
796
|
+
|
797
|
+
### Replace CSR Order
|
798
|
+
|
799
|
+
```ruby
|
800
|
+
csr_data = {
|
801
|
+
:customer_order_id => "order id",
|
802
|
+
:working_or_billing_telephone_number => "5554443333"
|
803
|
+
}
|
804
|
+
|
805
|
+
response = BandwidthIris::Csr.replace("csr_id", csr_data)
|
806
|
+
puts response[0][:order_id]
|
807
|
+
```
|
808
|
+
|
809
|
+
### Get CSR Order
|
810
|
+
|
811
|
+
```ruby
|
812
|
+
response = BandwidthIris::Csr.get("csr_id")
|
813
|
+
puts response[0][:order_id]
|
814
|
+
```
|
815
|
+
|
816
|
+
### Get CSR Order Notes
|
817
|
+
|
818
|
+
```ruby
|
819
|
+
response = BandwidthIris::Csr.get_notes("csr_id")
|
820
|
+
puts response[0][:note][0][:id]
|
821
|
+
```
|
822
|
+
|
823
|
+
### Add CSR Order Note
|
824
|
+
|
825
|
+
```ruby
|
826
|
+
note_data = {
|
827
|
+
:user_id => "id",
|
828
|
+
:description => "description"
|
829
|
+
}
|
830
|
+
|
831
|
+
BandwidthIris::Csr.add_note("csr_id", note_data)
|
832
|
+
```
|
833
|
+
|
834
|
+
### Update CSR Order Note
|
835
|
+
|
836
|
+
```ruby
|
837
|
+
note_data = {
|
838
|
+
:user_id => "id",
|
839
|
+
:description => "description"
|
840
|
+
}
|
841
|
+
|
842
|
+
BandwidthIris::Csr.update_note("csr_id", "note_id", note_data)
|
843
|
+
```
|
844
|
+
|
845
|
+
## Application Management
|
846
|
+
|
847
|
+
### Create Application
|
848
|
+
|
849
|
+
```ruby
|
850
|
+
data = {
|
851
|
+
:service_type => "Messaging-V2",
|
852
|
+
:app_name => "Name",
|
853
|
+
:msg_callback_url => "https://test.com"
|
854
|
+
}
|
855
|
+
application = BandwidthIris::Applications.create_application(data)
|
856
|
+
puts application
|
857
|
+
```
|
858
|
+
|
859
|
+
### Get Applications
|
860
|
+
|
861
|
+
```ruby
|
862
|
+
applications = BandwidthIris::Applications.get_applications()
|
863
|
+
puts applications[0]
|
864
|
+
```
|
865
|
+
|
866
|
+
### Get An Application
|
867
|
+
|
868
|
+
```ruby
|
869
|
+
application = BandwidthIris::Applications.get_application("id")
|
870
|
+
puts application
|
871
|
+
```
|
872
|
+
|
873
|
+
### Partially Update An Application
|
874
|
+
|
875
|
+
```ruby
|
876
|
+
data = {
|
877
|
+
:app_name => "Name2"
|
878
|
+
}
|
879
|
+
application = BandwidthIris::Applications.partial_update_application("id", data)
|
880
|
+
puts application
|
881
|
+
```
|
882
|
+
|
883
|
+
### Completely Update An Application
|
884
|
+
|
885
|
+
```ruby
|
886
|
+
data = {
|
887
|
+
:service_type => "Messaging-V2",
|
888
|
+
:app_name => "Name2",
|
889
|
+
:msg_callback_url => "https://test2.com"
|
890
|
+
}
|
891
|
+
application = BandwidthIris::Applications.complete_update_application("id", data)
|
892
|
+
puts application
|
893
|
+
```
|
894
|
+
|
895
|
+
### Remove An Application
|
896
|
+
|
897
|
+
```ruby
|
898
|
+
BandwidthIris::Applications.delete_application("id")
|
899
|
+
```
|
900
|
+
|
901
|
+
### List Application Sippeers
|
902
|
+
|
903
|
+
```ruby
|
904
|
+
sippeers = BandwidthIris::Applications.get_application_sippeers("id")
|
905
|
+
puts sippeers[0]
|
906
|
+
```
|
907
|
+
|
908
|
+
## SipPeer Products
|
909
|
+
|
910
|
+
### Get Origination Settings
|
911
|
+
|
912
|
+
```ruby
|
913
|
+
puts BandwidthIris::SipPeerProducts.get_origination_settings("site_id", "sippeer_id")
|
914
|
+
```
|
915
|
+
|
916
|
+
### Create Origination Settings
|
917
|
+
|
918
|
+
```ruby
|
919
|
+
data = {
|
920
|
+
:voice_protocol => "HTTP"
|
921
|
+
}
|
922
|
+
puts BandwidthIris::SipPeerProducts.create_origination_settings("site_id", "sippeer_id", data)
|
923
|
+
```
|
924
|
+
|
925
|
+
### Update Origination Settings
|
926
|
+
|
927
|
+
```ruby
|
928
|
+
data = {
|
929
|
+
:voice_protocol => "HTTP"
|
930
|
+
}
|
931
|
+
BandwidthIris::SipPeerProducts.update_origination_settings("site_id", "sippeer_id", data)
|
932
|
+
```
|
933
|
+
|
934
|
+
### Get Termination Settings
|
935
|
+
|
936
|
+
```ruby
|
937
|
+
puts BandwidthIris::SipPeerProducts.get_termination_settings("site_id", "sippeer_id")
|
938
|
+
```
|
939
|
+
|
940
|
+
### Create Termination Settings
|
941
|
+
|
942
|
+
```ruby
|
943
|
+
data = {
|
944
|
+
:voice_protocol => "HTTP"
|
945
|
+
}
|
946
|
+
puts BandwidthIris::SipPeerProducts.create_termination_settings("site_id", "sippeer_id", data)
|
947
|
+
```
|
948
|
+
|
949
|
+
### Update Termination Settings
|
950
|
+
|
951
|
+
```ruby
|
952
|
+
data = {
|
953
|
+
:voice_protocol => "HTTP"
|
954
|
+
}
|
955
|
+
BandwidthIris::SipPeerProducts.update_termination_settings("site_id", "sippeer_id", data)
|
956
|
+
```
|
957
|
+
|
958
|
+
### Get Sms Feature Settings
|
959
|
+
|
960
|
+
```ruby
|
961
|
+
puts BandwidthIris::SipPeerProducts.get_sms_feature_settings("site_id", "sippeer_id")
|
962
|
+
```
|
963
|
+
|
964
|
+
### Create Sms Feature Settings
|
965
|
+
|
966
|
+
```ruby
|
967
|
+
data = {
|
968
|
+
:sip_peer_sms_feature_settings => {
|
969
|
+
:toll_free => true,
|
970
|
+
:protocol => "HTTP",
|
971
|
+
:zone_1 => true,
|
972
|
+
:zone_2 => false,
|
973
|
+
:zone_3 => false,
|
974
|
+
:zone_4 => false,
|
975
|
+
:zone_5 => false
|
976
|
+
},
|
977
|
+
:http_settings => {}
|
978
|
+
}
|
979
|
+
|
980
|
+
puts BandwidthIris::SipPeerProducts.create_sms_feature_settings("site_id", "sippeer_id", data)
|
981
|
+
```
|
982
|
+
|
983
|
+
### Update Sms Feature Settings
|
984
|
+
|
985
|
+
```ruby
|
986
|
+
data = {
|
987
|
+
:sip_peer_sms_feature_settings => {
|
988
|
+
:toll_free => true,
|
989
|
+
:protocol => "HTTP",
|
990
|
+
:zone_1 => true,
|
991
|
+
:zone_2 => false,
|
992
|
+
:zone_3 => false,
|
993
|
+
:zone_4 => false,
|
994
|
+
:zone_5 => false
|
995
|
+
},
|
996
|
+
:http_settings => {}
|
997
|
+
}
|
998
|
+
|
999
|
+
puts BandwidthIris::SipPeerProducts.update_sms_feature_settings("site_id", "sippeer_id", data)
|
1000
|
+
```
|
1001
|
+
|
1002
|
+
### Delete Sms Feature Settings
|
1003
|
+
|
1004
|
+
```ruby
|
1005
|
+
BandwidthIris::SipPeerProducts.delete_sms_feature_settings("site_id", "sippeer_id")
|
1006
|
+
```
|
1007
|
+
|
1008
|
+
### Get Mms Feature Settings
|
1009
|
+
|
1010
|
+
```ruby
|
1011
|
+
puts BandwidthIris::SipPeerProducts.get_mms_feature_settings("site_id", "sippeer_id")
|
1012
|
+
```
|
1013
|
+
|
1014
|
+
### Create Mms Feature Settings
|
1015
|
+
|
1016
|
+
```ruby
|
1017
|
+
data = {
|
1018
|
+
:mms_settings => {
|
1019
|
+
:protocol => "HTTP"
|
1020
|
+
},
|
1021
|
+
:protocols => {
|
1022
|
+
:HTTP => {
|
1023
|
+
:http_settings => {}
|
1024
|
+
}
|
1025
|
+
}
|
1026
|
+
}
|
1027
|
+
|
1028
|
+
puts BandwidthIris::SipPeerProducts.create_mms_feature_settings("site_id", "sippeer_id", data)
|
1029
|
+
```
|
1030
|
+
|
1031
|
+
### Update Mms Feature Settings
|
1032
|
+
|
1033
|
+
```ruby
|
1034
|
+
data = {
|
1035
|
+
:mms_settings => {
|
1036
|
+
:protocol => "HTTP"
|
1037
|
+
},
|
1038
|
+
:protocols => {
|
1039
|
+
:HTTP => {
|
1040
|
+
:http_settings => {}
|
1041
|
+
}
|
1042
|
+
}
|
1043
|
+
}
|
1044
|
+
|
1045
|
+
BandwidthIris::SipPeerProducts.update_mms_feature_settings("site_id", "sippeer_id", data)
|
1046
|
+
```
|
1047
|
+
|
1048
|
+
### Delete Mms Feature Settings
|
1049
|
+
|
1050
|
+
```ruby
|
1051
|
+
BandwidthIris::SipPeerProducts.delete_mms_feature_settings("site_id", "sippeer_id")
|
1052
|
+
```
|
1053
|
+
|
1054
|
+
### Get Mms Feature Mms Settings
|
1055
|
+
|
1056
|
+
```ruby
|
1057
|
+
puts BandwidthIris::SipPeerProducts.get_mms_feature_mms_settings("site_id", "sippeer_id")
|
1058
|
+
```
|
1059
|
+
|
1060
|
+
### Get Messaging Application Settings
|
1061
|
+
|
1062
|
+
```ruby
|
1063
|
+
puts BandwidthIris::SipPeerProducts.get_messaging_application_settings("site_id", "sippeer_id")
|
1064
|
+
```
|
1065
|
+
|
1066
|
+
### Update Messaging Application Settings
|
1067
|
+
|
1068
|
+
```ruby
|
1069
|
+
data = {
|
1070
|
+
:http_messaging_v2_app_id => "4-d-4-8-5"
|
1071
|
+
}
|
1072
|
+
|
1073
|
+
puts BandwidthIris::SipPeerProducts.update_messaging_application_settings("site_id", "sippeer_id", data)
|
1074
|
+
```
|
1075
|
+
|
1076
|
+
### Get Messaging Settings
|
1077
|
+
|
1078
|
+
```ruby
|
1079
|
+
puts BandwidthIris::SipPeerProducts.get_messaging_settings("site_id", "sippeer_id")
|
1080
|
+
```
|
1081
|
+
|
1082
|
+
### Update Messaging Settings
|
1083
|
+
|
1084
|
+
```ruby
|
1085
|
+
data = {
|
1086
|
+
:break_out_countries => {
|
1087
|
+
:country => "CAN"
|
1088
|
+
}
|
1089
|
+
}
|
1090
|
+
|
1091
|
+
puts BandwidthIris::SipPeerProducts.update_messaging_settings("site_id", "sippeer_id", data)
|
1092
|
+
```
|