Changeset - d8e93c9d2ee6
[Not reviewed]
0 1 0
Lance Edgar - 5 years ago 2020-03-17 16:04:22
lance@edbob.org
Add `set_member()` API method

also rename `get_customer()` to `get_member`
1 file changed with 24 insertions and 3 deletions:
0 comments (0 inline, 0 general) First comment
corepos/api.py
Show inline comments
 
@@ -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.
0 comments (0 inline, 0 general) First comment
You need to be logged in to comment. Login now