From e41106ec718ce0db2f3baea977a7544c3ca967a7 Mon Sep 17 00:00:00 2001 From: Marek Isalski Date: Sat, 22 Jan 2022 18:08:33 +0000 Subject: [PATCH] fix runtime --- src/sipcentric/__init__.py | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/sipcentric/__init__.py b/src/sipcentric/__init__.py index 2a22f0d..b629d62 100644 --- a/src/sipcentric/__init__.py +++ b/src/sipcentric/__init__.py @@ -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"