turns out you need type on most of these

master
Marek Isalski 3 years ago
parent 3969b7f0d1
commit 6fe93923d7

@ -165,6 +165,7 @@ class APIObject(object):
return self._create(parent=parent,data=self._data)
def _create(self, parent, data):
data['type'] = self.__class__.TYPE
self._data = self._api.post(self.__class__.makeUrl(parent=parent), data=data)
self.id = int(self._data.get("id"))
return self._data
@ -212,6 +213,8 @@ class Partner(APIObject):
class Customer(APIObject):
TYPE = "customer"
@classmethod
def makeUrl(cls, id=None, parent=None):
if parent:
@ -305,6 +308,26 @@ class Endpoint(APIObject):
URLPART = "endpoints"
class PhoneEndpoint(Endpoint):
TYPE = "phone"
class VirtualEndpoint(Endpoint):
TYPE = "virtual"
class GroupEndpoint(Endpoint):
TYPE = "group"
class QueueEndpoint(Endpoint):
TYPE = "queue"
class MailboxEndpoint(Endpoint):
TYPE = "mailbox"
class PhoneNumber(APIObject):
URLPART = "phonenumbers"
@ -343,9 +366,9 @@ class CreditStatus(APIObject):
class LinkedUser(APIObject):
URLPART = "linkedusers"
TYPE = "linkeduser"
def create(self, parent, **kwargs):
kwargs['type'] = "linkeduser"
self.data.update(**kwargs)
for k in ("activateUrl", "email", "recordingAccess", "owner", "enabled"):
if k not in self._data:

Loading…
Cancel
Save