forked from TechneauxCMPS/Ticket-API
-
Notifications
You must be signed in to change notification settings - Fork 2
[internal] Responses Design
Jensen Cochran edited this page Oct 29, 2015
·
3 revisions
FailureResponse must take in an error_code, nice_message, and debug_message in its __init__ method. Please ensure that the response uses camel case keys in the response itself (not the Python class).
FailureResponse must implement a method called as_json() which will convert the provided data into json via the json.dumps() method.
FailureResponse must, lastly, implement a method called response() which will return flask's make_response(self.as_json(), self.error_code). If possible, this function may also take in a headers dictionary and update the response headers before returning it.
FailureResponse must also implement logging on a call to response().