fix runtime

master
Marek Isalski 3 years ago
parent 34b782ca28
commit e41106ec71

@ -220,7 +220,7 @@ class Customer(APIObject):
yield Endpoint(self._api, data=c)
def phonenumbers(self):
for c in self._api.getMany(PhoneNumber.makeUrl(parent=self.makurleUrl())):
for c in self._api.getMany(PhoneNumber.makeUrl(parent=self.url())):
yield PhoneNumber(self._api, data=c)
def calls(self, params=None):
@ -259,6 +259,33 @@ class Customer(APIObject):
for c in self._api.getMany(CreditStatus.makeUrl(parent=self.url())):
yield CreditStatus(self._api, data=c)
def create(self, **kwargs):
self._data = kwargs
for k in ("accountType", "company", "firstName", "lastName", "email", "address1", "city", "postcode", "telephone"):
if k not in self._data:
raise ValueError('missing mandatory field "%s"' % k)
return super(Customer, self).create()
# {
# "type": "customer",
# "accountType": "BUSINESS",
# "company": "API TEST",
# "firstName": "Marek",
# "lastName": "Isalski",
# "email": "marek@isal.ski",
# "country": "GB",
# "properties": {
# },
# "enabled": true,
# "currency": "GBP",
# "partnerId": "56",
# "userEmailUpdatable": false,
# "postcode": "SA48 7LJ",
# "address1": "Llygad-yr-Haul",
# "city": "Llanwnnen",
# "telephone": "07779270405"
# }
class Endpoint(APIObject):
URLPART = "endpoints"

Loading…
Cancel
Save