diff --git a/bandwidth_numbers/models/data/messaging_settings.py b/bandwidth_numbers/models/data/messaging_settings.py new file mode 100644 index 0000000..ab9437c --- /dev/null +++ b/bandwidth_numbers/models/data/messaging_settings.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python + +from bandwidth_numbers.models.base_resource import BaseData +from bandwidth_numbers.models.maps.messaging_settings import MessagingSettingsMap + + +class MessagingSettingsData(MessagingSettingsMap, BaseData): + pass diff --git a/bandwidth_numbers/models/data/tndetails.py b/bandwidth_numbers/models/data/tndetails.py index 3f76694..58c172d 100644 --- a/bandwidth_numbers/models/data/tndetails.py +++ b/bandwidth_numbers/models/data/tndetails.py @@ -1,8 +1,13 @@ #!/usr/bin/env python +from traceback import print_last from bandwidth_numbers.models.base_resource import BaseData from bandwidth_numbers.models.data.features import Features +from bandwidth_numbers.models.data.site import SiteData +from bandwidth_numbers.models.data.sip_peer import SipPeerData from bandwidth_numbers.models.maps.tndetails import TndetailsMap +from bandwidth_numbers.models.data.messaging_settings import MessagingSettingsData + class TndetailsData(TndetailsMap, BaseData): @@ -13,6 +18,28 @@ def id(self): def id(self, id): self.full_number = id + @property + def site(self): + return self.site + @site.setter + def site(self, site): + self.site = site + + @property + def sip_peer(self): + return self._sip_peer + @sip_peer.setter + def sip_peer(self, sip_peer): + self._sip_peer = sip_peer + + + @property + def messaging_settings(self): + return self.messaging_settings + @messaging_settings.setter + def messaging_settings(self, messaging_settings): + self.messaging_settings = messaging_settings + @property def last_modified_date(self): return self.last_modified @@ -22,3 +49,10 @@ def last_modified_date(self, last_modified_date): def __init__(self): self.features = Features() + self.site = SiteData() + self.sip_peer = SipPeerData() + self.messaging_settings = MessagingSettingsData() + + @messaging_settings.setter + def messaging_settings(self, value): + self._messaging_settings = value diff --git a/bandwidth_numbers/models/maps/messaging_settings.py b/bandwidth_numbers/models/maps/messaging_settings.py new file mode 100644 index 0000000..24750cd --- /dev/null +++ b/bandwidth_numbers/models/maps/messaging_settings.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python + +from bandwidth_numbers.models.maps.base_map import BaseMap + +class MessagingSettingsMap(BaseMap): + sms_enabled = None + campaign_id = None + message_class = None + campaign_fully_provisioned = None + a2p_state = None diff --git a/bandwidth_numbers/models/maps/tndetails.py b/bandwidth_numbers/models/maps/tndetails.py index 7738c94..ede3473 100644 --- a/bandwidth_numbers/models/maps/tndetails.py +++ b/bandwidth_numbers/models/maps/tndetails.py @@ -2,6 +2,7 @@ from bandwidth_numbers.models.maps.base_map import BaseMap + class TndetailsMap(BaseMap): account_id = None @@ -16,3 +17,7 @@ class TndetailsMap(BaseMap): tier = None vendor_id = None vendor_name = None + site = None + sip_peer = None + service_types = None + messaging_settings = None diff --git a/bandwidth_numbers/models/messaging_settings.py b/bandwidth_numbers/models/messaging_settings.py new file mode 100644 index 0000000..d2bace0 --- /dev/null +++ b/bandwidth_numbers/models/messaging_settings.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python + +from __future__ import division, absolute_import, print_function + +from bandwidth_numbers.models.base_resource import BaseResource +from bandwidth_numbers.models.data.messaging_settings import MessagingSettingsData + +XML_NAME_MESSAGING_SETTINGS = "MessagingSettings" + +class MessagingSettings(BaseResource, MessagingSettingsData): + pass diff --git a/bandwidth_numbers/models/tndetails.py b/bandwidth_numbers/models/tndetails.py index 742623e..62faf1d 100644 --- a/bandwidth_numbers/models/tndetails.py +++ b/bandwidth_numbers/models/tndetails.py @@ -5,6 +5,9 @@ from bandwidth_numbers.models.base_resource import BaseResource from bandwidth_numbers.models.data.tndetails import TndetailsData +from bandwidth_numbers.models.messaging_settings import MessagingSettings +from bandwidth_numbers.models.site import Site +from bandwidth_numbers.models.sip_peer import SipPeer XML_NAME_TNDETAILS = "TelephoneNumberDetails" XPATH_TNDETAILS = "/tndetails" @@ -16,9 +19,34 @@ class Tndetails(BaseResource, TndetailsData): _node_name = XML_NAME_TNDETAILS _xpath = XPATH_TNDETAILS + @property + def site(self): + return self._site + @site.setter + def site(self, site): + self._site = site + + @property + def sip_peer(self): + return self._sip_peer + @sip_peer.setter + def sip_peer(self, sip_peer): + self._sip_peer = sip_peer + + @property + def messaging_settings(self): + return self._messaging_settings + @messaging_settings.setter + def messaging_settings(self, messaging_settings): + self._messaging_settings = messaging_settings + def __init__(self, parent=None, client=None): super().__init__(parent, client) TndetailsData.__init__(self) + self._site = Site(self, client) + self._sip_peer = SipPeer(self, client) + self._messaging_settings = MessagingSettings(self, client) + def get(self): return self._get_data() diff --git a/tests/test_tns.py b/tests/test_tns.py index af21755..f6c3c18 100644 --- a/tests/test_tns.py +++ b/tests/test_tns.py @@ -104,6 +104,10 @@ b"49Bandwidth CLEC" b"JERSEYCITYInservice" b"14" + b"135927PROD" + b"VoiceMessaging" + b"trueCU9B04MCampaign-Etrueoverridden103775BW A2P - SVR - E151 (103775)" + b"971438Uptravifalse" b"2014-07-30T11:29:37.000Z" b"Success" b"Pending" @@ -305,6 +309,13 @@ def test_tndetails(self): self.assertEqual(tnd.account_id, "14") self.assertEqual(tnd.last_modified, "2014-07-30T11:29:37.000Z") self.assertEqual(tnd.features.lidb.status, "Pending") + self.assertEqual(tnd.messaging_settings.sms_enabled, 'true') + self.assertEqual(tnd.messaging_settings.campaign_id, 'CU9B04M') + self.assertEqual(tnd.messaging_settings.message_class, 'Campaign-E') + self.assertEqual(tnd.site.id, '135927') + self.assertEqual(tnd.site.name, 'PROD') + self.assertEqual(tnd.sip_peer.peer_id, '971438') + self.assertEqual(tnd.sip_peer.peer_name, 'Uptravi') def test_tnreservation(self):