fix creation of sub-resources
This commit is contained in:
parent
142a757ffa
commit
2e1c368f53
@ -378,46 +378,51 @@ class OutgoingCallerId(APIObject):
|
||||
TYPE = "outgoingcallerid"
|
||||
|
||||
|
||||
class CreditStatus(APIObject):
|
||||
URLPART = "creditstatus"
|
||||
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"
|
||||
class CustomerAPIObject(APIObject):
|
||||
MANDATORY_FIELDS = ()
|
||||
|
||||
def create(self, parent, **kwargs):
|
||||
if self._data:
|
||||
self._data.update(**kwargs)
|
||||
else:
|
||||
self._data = kwargs
|
||||
for k in ("activateUrl", "email", "recordingAccess", "owner", "enabled"):
|
||||
for k in self.__class__.MANDATORY_FIELDS:
|
||||
if k not in self._data:
|
||||
raise ValueError('missing mandatory field "%s"' % k)
|
||||
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):
|
||||
URLPART = "sms"
|
||||
TYPE = "smsmessage"
|
||||
|
Loading…
x
Reference in New Issue
Block a user