|
|
@ -159,7 +159,10 @@ class APIObject(object):
|
|
|
|
raise ValueError(
|
|
|
|
raise ValueError(
|
|
|
|
"%s ID %d already created" % (self.__class__.__name__, self.id)
|
|
|
|
"%s ID %d already created" % (self.__class__.__name__, self.id)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
self.data.update(**kwargs)
|
|
|
|
if self._data:
|
|
|
|
|
|
|
|
self._data.update(**kwargs)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
self._data = kwargs
|
|
|
|
if not self._data:
|
|
|
|
if not self._data:
|
|
|
|
raise ValueError("No data associated with record.")
|
|
|
|
raise ValueError("No data associated with record.")
|
|
|
|
return self._create(parent=parent,data=self._data)
|
|
|
|
return self._create(parent=parent,data=self._data)
|
|
|
@ -277,7 +280,10 @@ class Customer(APIObject):
|
|
|
|
def create(self, parent=None, **kwargs):
|
|
|
|
def create(self, parent=None, **kwargs):
|
|
|
|
if parent:
|
|
|
|
if parent:
|
|
|
|
raise ValueError("Customer cannot have a parent")
|
|
|
|
raise ValueError("Customer cannot have a parent")
|
|
|
|
self.data.update(**kwargs)
|
|
|
|
if self._data:
|
|
|
|
|
|
|
|
self._data.update(**kwargs)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
self._data = kwargs
|
|
|
|
for k in ("accountType", "company", "firstName", "lastName", "email", "address1", "city", "postcode", "telephone"):
|
|
|
|
for k in ("accountType", "company", "firstName", "lastName", "email", "address1", "city", "postcode", "telephone"):
|
|
|
|
if k not in self._data:
|
|
|
|
if k not in self._data:
|
|
|
|
raise ValueError('missing mandatory field "%s"' % k)
|
|
|
|
raise ValueError('missing mandatory field "%s"' % k)
|
|
|
@ -330,38 +336,47 @@ class MailboxEndpoint(Endpoint):
|
|
|
|
|
|
|
|
|
|
|
|
class PhoneNumber(APIObject):
|
|
|
|
class PhoneNumber(APIObject):
|
|
|
|
URLPART = "phonenumbers"
|
|
|
|
URLPART = "phonenumbers"
|
|
|
|
|
|
|
|
TYPE = "did"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Call(APIObject):
|
|
|
|
class Call(APIObject):
|
|
|
|
URLPART = "calls"
|
|
|
|
URLPART = "calls"
|
|
|
|
|
|
|
|
TYPE = "call"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CallBundle(APIObject):
|
|
|
|
class CallBundle(APIObject):
|
|
|
|
URLPART = "callbundles"
|
|
|
|
URLPART = "callbundles"
|
|
|
|
|
|
|
|
TYPE = "customerbundle"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Recording(APIObject):
|
|
|
|
class Recording(APIObject):
|
|
|
|
URLPART = "recordings"
|
|
|
|
URLPART = "recordings"
|
|
|
|
|
|
|
|
TYPE = "recording"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PhoneBook(APIObject):
|
|
|
|
class PhoneBook(APIObject):
|
|
|
|
URLPART = "phonebook"
|
|
|
|
URLPART = "phonebook"
|
|
|
|
|
|
|
|
TYPE = "phonebookentry"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TimeInterval(APIObject):
|
|
|
|
class TimeInterval(APIObject):
|
|
|
|
URLPART = "timeintervals"
|
|
|
|
URLPART = "timeintervals"
|
|
|
|
|
|
|
|
TYPE = "XXX"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Sound(APIObject):
|
|
|
|
class Sound(APIObject):
|
|
|
|
URLPART = "sounds"
|
|
|
|
URLPART = "sounds"
|
|
|
|
|
|
|
|
TYPE = "music"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class OutgoingCallerId(APIObject):
|
|
|
|
class OutgoingCallerId(APIObject):
|
|
|
|
URLPART = "outgoingcallerids"
|
|
|
|
URLPART = "outgoingcallerids"
|
|
|
|
|
|
|
|
TYPE = "outgoingcallerid"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CreditStatus(APIObject):
|
|
|
|
class CreditStatus(APIObject):
|
|
|
|
URLPART = "creditstatus"
|
|
|
|
URLPART = "creditstatus"
|
|
|
|
|
|
|
|
TYPE = "XXX"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class LinkedUser(APIObject):
|
|
|
|
class LinkedUser(APIObject):
|
|
|
@ -369,7 +384,10 @@ class LinkedUser(APIObject):
|
|
|
|
TYPE = "linkeduser"
|
|
|
|
TYPE = "linkeduser"
|
|
|
|
|
|
|
|
|
|
|
|
def create(self, parent, **kwargs):
|
|
|
|
def create(self, parent, **kwargs):
|
|
|
|
self.data.update(**kwargs)
|
|
|
|
if self._data:
|
|
|
|
|
|
|
|
self._data.update(**kwargs)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
self._data = kwargs
|
|
|
|
for k in ("activateUrl", "email", "recordingAccess", "owner", "enabled"):
|
|
|
|
for k in ("activateUrl", "email", "recordingAccess", "owner", "enabled"):
|
|
|
|
if k not in self._data:
|
|
|
|
if k not in self._data:
|
|
|
|
raise ValueError('missing mandatory field "%s"' % k)
|
|
|
|
raise ValueError('missing mandatory field "%s"' % k)
|
|
|
@ -378,6 +396,7 @@ class LinkedUser(APIObject):
|
|
|
|
|
|
|
|
|
|
|
|
class Sms(APIObject):
|
|
|
|
class Sms(APIObject):
|
|
|
|
URLPART = "sms"
|
|
|
|
URLPART = "sms"
|
|
|
|
|
|
|
|
TYPE = "smsmessage"
|
|
|
|
|
|
|
|
|
|
|
|
# def post(self, to=None, _from=None, body=None):
|
|
|
|
# def post(self, to=None, _from=None, body=None):
|
|
|
|
# data = {"type": "smsmessage", "to": to, "from": _from, "body": body}
|
|
|
|
# data = {"type": "smsmessage", "to": to, "from": _from, "body": body}
|
|
|
|