diff --git a/corepos/api.py b/corepos/api.py index 9a6b5de..5c2a66f 100644 --- a/corepos/api.py +++ b/corepos/api.py @@ -116,11 +116,11 @@ class CoreWebAPI(object): assert set(js['result'].keys()) == set(['result']) return js['result']['result'] - def get_customer(self, cardNo, **columns): + def get_member(self, cardNo): """ - Fetch an existing Customer record from CORE. + Fetch an existing Member record from CORE. - :returns: Either a customer dict record, or ``None``. + :returns: Either a member dict record, or ``None``. """ params = { 'cardNo': cardNo, @@ -131,6 +131,27 @@ class CoreWebAPI(object): if result: return result + def set_member(self, cardNo, **kwargs): + """ + Update an existing Member record in CORE. + + :returns: Boolean indicating success of the operation. + + .. warning:: + Only simple updates have been attempted thus far; have yet to try + creation or deletion. Neither of those should be expected to work. + """ + kwargs['cardNo'] = cardNo + params = { + 'cardNo': cardNo, + 'method': 'set', + 'member': kwargs, + } + response = self.post(params, method='FannieMember') + result = self.parse_response(response, method='FannieMember') + if result: + return result + def get_departments(self, **columns): """ Fetch some or all of Department records from CORE.