fix creation of sub-resources
This commit is contained in:
parent
142a757ffa
commit
2e1c368f53
@ -378,46 +378,51 @@ class OutgoingCallerId(APIObject):
|
|||||||
TYPE = "outgoingcallerid"
|
TYPE = "outgoingcallerid"
|
||||||
|
|
||||||
|
|
||||||
class CreditStatus(APIObject):
|
class CustomerAPIObject(APIObject):
|
||||||
URLPART = "creditstatus"
|
MANDATORY_FIELDS = ()
|
||||||
TYPE = "creditstatus"
|
|
||||||
|
|
||||||
|
|
||||||
class CustomerPricing(APIObject):
|
|
||||||
URLPART = "pricing"
|
|
||||||
TYPE = "customerpricing"
|
|
||||||
|
|
||||||
|
|
||||||
class Limits(APIObject):
|
|
||||||
URLPART = "limits"
|
|
||||||
TYPE = "customerlimits"
|
|
||||||
|
|
||||||
|
|
||||||
class CallCharging(APIObject):
|
|
||||||
URLPART = "callcharging"
|
|
||||||
TYPE = "customercallcharging"
|
|
||||||
|
|
||||||
|
|
||||||
class Permissions(APIObject):
|
|
||||||
URLPART = "permissions"
|
|
||||||
TYPE = "customerpermissions"
|
|
||||||
|
|
||||||
|
|
||||||
class LinkedUser(APIObject):
|
|
||||||
URLPART = "linkedusers"
|
|
||||||
TYPE = "linkeduser"
|
|
||||||
|
|
||||||
def create(self, parent, **kwargs):
|
def create(self, parent, **kwargs):
|
||||||
if self._data:
|
if self._data:
|
||||||
self._data.update(**kwargs)
|
self._data.update(**kwargs)
|
||||||
else:
|
else:
|
||||||
self._data = kwargs
|
self._data = kwargs
|
||||||
for k in ("activateUrl", "email", "recordingAccess", "owner", "enabled"):
|
for k in self.__class__.MANDATORY_FIELDS:
|
||||||
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)
|
||||||
return self._create(parent=parent, data=self._data)
|
return self._create(parent=parent, data=self._data)
|
||||||
|
|
||||||
|
|
||||||
|
class CreditStatus(CustomerAPIObject):
|
||||||
|
URLPART = "creditstatus"
|
||||||
|
TYPE = "creditstatus"
|
||||||
|
|
||||||
|
|
||||||
|
class CustomerPricing(CustomerAPIObject):
|
||||||
|
URLPART = "pricing"
|
||||||
|
TYPE = "customerpricing"
|
||||||
|
|
||||||
|
|
||||||
|
class Limits(CustomerAPIObject):
|
||||||
|
URLPART = "limits"
|
||||||
|
TYPE = "customerlimits"
|
||||||
|
|
||||||
|
|
||||||
|
class CallCharging(CustomerAPIObject):
|
||||||
|
URLPART = "callcharging"
|
||||||
|
TYPE = "customercallcharging"
|
||||||
|
|
||||||
|
|
||||||
|
class Permissions(CustomerAPIObject):
|
||||||
|
URLPART = "permissions"
|
||||||
|
TYPE = "customerpermissions"
|
||||||
|
|
||||||
|
|
||||||
|
class LinkedUser(CustomerAPIObject):
|
||||||
|
URLPART = "linkedusers"
|
||||||
|
TYPE = "linkeduser"
|
||||||
|
MANDATORY_FIELDS = ("activateUrl", "email", "recordingAccess", "owner", "enabled")
|
||||||
|
|
||||||
|
|
||||||
class Sms(APIObject):
|
class Sms(APIObject):
|
||||||
URLPART = "sms"
|
URLPART = "sms"
|
||||||
TYPE = "smsmessage"
|
TYPE = "smsmessage"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user