Skip to content

Commit

Permalink
Implement all of the properties
Browse files Browse the repository at this point in the history
  • Loading branch information
ajrice6713 committed Aug 29, 2024
1 parent 9fee2fc commit e2d8726
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 6 deletions.
8 changes: 8 additions & 0 deletions bandwidth_numbers/models/data/messaging_settings.py
Original file line number Diff line number Diff line change
@@ -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
38 changes: 34 additions & 4 deletions bandwidth_numbers/models/data/tndetails.py
Original file line number Diff line number Diff line change
@@ -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):
Expand All @@ -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
Expand All @@ -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
1 change: 0 additions & 1 deletion bandwidth_numbers/models/maps/messaging_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions bandwidth_numbers/models/maps/tndetails.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from bandwidth_numbers.models.maps.base_map import BaseMap


class TndetailsMap(BaseMap):

account_id = None
Expand Down
11 changes: 11 additions & 0 deletions bandwidth_numbers/models/messaging_settings.py
Original file line number Diff line number Diff line change
@@ -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
28 changes: 28 additions & 0 deletions bandwidth_numbers/models/tndetails.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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()
8 changes: 7 additions & 1 deletion tests/test_tns.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Expand Down

0 comments on commit e2d8726

Please sign in to comment.