diff --git a/src/sipcentric/__init__.py b/src/sipcentric/__init__.py index d4f8e49..3251f03 100644 --- a/src/sipcentric/__init__.py +++ b/src/sipcentric/__init__.py @@ -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: