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 948532f..58c172d 100644 --- a/bandwidth_numbers/models/data/tndetails.py +++ b/bandwidth_numbers/models/data/tndetails.py @@ -1,14 +1,15 @@ #!/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.maps.site import SiteMap -from bandwidth_numbers.models.maps.sip_peer import SipPeerMap -from bandwidth_numbers.models.maps.messaging_settings import MessagingSettingsMap +from bandwidth_numbers.models.data.messaging_settings import MessagingSettingsData -class TndetailsData(TndetailsMap, SiteMap, SipPeerMap, MessagingSettingsMap, BaseData): +class TndetailsData(TndetailsMap, BaseData): @property def id(self): @@ -17,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 @@ -26,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 index 97e1535..24750cd 100644 --- a/bandwidth_numbers/models/maps/messaging_settings.py +++ b/bandwidth_numbers/models/maps/messaging_settings.py @@ -3,7 +3,6 @@ from bandwidth_numbers.models.maps.base_map import BaseMap class MessagingSettingsMap(BaseMap): - sms_enabled = None campaign_id = None message_class = None diff --git a/bandwidth_numbers/models/maps/tndetails.py b/bandwidth_numbers/models/maps/tndetails.py index 37abce7..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 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 b9990f7..f6c3c18 100644 --- a/tests/test_tns.py +++ b/tests/test_tns.py @@ -309,7 +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.sip_peer.peer_id, "971438") + 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):