Function: dispatchLocalApiCall
This is the core where server side API callbacks are dispatched. It is called
by Barefoots <sync> replacement.

It tries to match the given URL with a registered route for the given
httpMethod. If found, the route callback(s) is/are invoked using
<processCallbacks>.

If the data argument contains any information, that stuff gets passed to the
callback. If the options argument contains a success or error element, these
functions are called by the callback in case of success or failure.

Example Call:
> dispatchLocalApiCall('post', '/contacts', { name: foo }, {
>     success: function() { console.log('yay!'); }
>     , error: function() { console.log('nay :('); }
> });

Parameters:
(String) httpMethod - An HTTP verb. Necessary to match a registered
route.
(String) url - The URL of the API callback to dispatch
(Object) data - Optional. Contains information which should be passed to
the callback. (Example: Contact information which should
be saved.)
(Object) options - Should contain an error and success callback function.
function dispatchLocalApiCall(httpMethod, url, data, options) {
	debug('dispatching local api call (httpMethod: `%s`, url: `%s`)'
		, httpMethod, url);

	var self = this
		, params = {}
		, matchedRoute = matchRoute(httpMethod, url, this.apiRoutes, params);
	options = options || {};

	if(_.isUndefined(matchedRoute)) {
		if(_.has(options, 'error')) {
			options.error(new Error('Could not resolve API route: ' + url));
		} else {
			winston.log('info', 'Could not resolve API route', {
				source: toString()
				, apiRoute: url
			});
		}
	}

	var successHandler = function successHandler(apiResult) {
			if(_.has(options, 'success')) {
				options.success(apiResult);
			} else {
				winston.log('info', 'No success callback defined', {
					source: self.toString()
					, apiRoute: url
				});
			}
		}
		, errorHandler = function errorHandler(err) {
			var message
				, stack;

			if(!_.isUndefined(err)) {
				message = err.toString() || err;
				stack = err.stack || undefined;
			}

			if(_.has(options, 'error')) {
				options.error(err);
			} else {
				winston.log('info', 'No error callback defined', {
					source: toString()
					, apiRoute: url
				});
			}

			winston.log('error', 'API callback stopped with error', {
				source: self.toString()
				, apiRoute: url
				, err: message
				, stack: stack
			});
		};

	processCallbacks(
		_.values(params)
		, data
		, this.req
		, {}
		, successHandler
		, errorHandler
		, matchedRoute.callback);
}