fix creation of sub-resources

master
Marek Isalski 2 years ago
parent 142a757ffa
commit 2e1c368f53

@ -378,44 +378,49 @@ class OutgoingCallerId(APIObject):
TYPE = "outgoingcallerid"
class CreditStatus(APIObject):
class CustomerAPIObject(APIObject):
MANDATORY_FIELDS = ()
def create(self, parent, **kwargs):
if self._data:
self._data.update(**kwargs)
else:
self._data = kwargs
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(APIObject):
class CustomerPricing(CustomerAPIObject):
URLPART = "pricing"
TYPE = "customerpricing"
class Limits(APIObject):
class Limits(CustomerAPIObject):
URLPART = "limits"
TYPE = "customerlimits"
class CallCharging(APIObject):
class CallCharging(CustomerAPIObject):
URLPART = "callcharging"
TYPE = "customercallcharging"
class Permissions(APIObject):
class Permissions(CustomerAPIObject):
URLPART = "permissions"
TYPE = "customerpermissions"
class LinkedUser(APIObject):
class LinkedUser(CustomerAPIObject):
URLPART = "linkedusers"
TYPE = "linkeduser"
def create(self, parent, **kwargs):
if self._data:
self._data.update(**kwargs)
else:
self._data = kwargs
for k in ("activateUrl", "email", "recordingAccess", "owner", "enabled"):
if k not in self._data:
raise ValueError('missing mandatory field "%s"' % k)
return self._create(parent=parent, data=self._data)
MANDATORY_FIELDS = ("activateUrl", "email", "recordingAccess", "owner", "enabled")
class Sms(APIObject):

Loading…
Cancel
Save