Add set_member()
API method
also rename `get_customer()` to `get_member`
This commit is contained in:
parent
9e850496e7
commit
d8e93c9d2e
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue