function APIClient(routes, onlyGetters) {
        var self = this;
        var slices = {};

        function recurse(o, path) {
            Object.keys(o).forEach(function (k) {
                if (k === 'SLICE') {
                    slices[path[0]] = o[k];
                } else if (k.toUpperCase() === k) {
                    if (onlyGetters) {
                        if (k !== 'GET') return;
                        console.log(k);
                        var name = path.toName(slices[path[0]]);
                    } else {
                        var name = path.toName(slices[path[0]], k);
                    }

                    if (name) {
                        var target = self[path[0]] || (self[path[0]] = {});
                    } else {
                        name = path[0];
                        var target = self;
                    }

                    target[name] = makeCtor(path.args().concat(o[k]), self);

                    Object.defineProperty(target[name].prototype, 'path', {
                        get: function () {
                            return path.map(function (s) {
                                return s[0] === 'Δ' ? this[s.slice(1)] : s;
                            }, this).join('/');
                        }
                    });

                } else if (isObject(o[k])) {
                    recurse(o[k], path.concat(k));
                }
            });
        }

        recurse(routes, new Path);
    }
// generalized REST API handler that turns routes into functions
generalized REST API handler that turns routes into functions
generalized REST API handler that turns routes into functions
function APIClient(routes, onlyGetters) {
        var self = this;
        var slices = {};
        function recurse(o, path) {
            Object.keys(o).forEach(function (k) {
                if (k === 'SLICE') {
                    slices[path[0]] = o[k];
                } else if (k.toUpperCase() === k) {
                    if (onlyGetters) {
                        if (k !== 'GET') return;
                        console.log(k);
                        var name = path.toName(slices[path[0]]);
                    } else {
                        var name = path.toName(slices[path[0]], k);
                    }
                    if (name) {
                        var target = self[path[0]] || (self[path[0]] = {});
                    } else {
                        name = path[0];
                        var target = self;
                    }
                    target[name] = makeCtor(path.args().concat(o[k]), self);
                    Object.defineProperty(target[name].prototype, 'path', {
                        get: function () {
                            return path.map(function (s) {
                                return s[0] === 'Δ' ? this[s.slice(1)] : s;
                            }, this).join('/');
                        }
                    });
                } else if (isObject(o[k])) {
                    recurse(o[k], path.concat(k));
                }
            });
        }
        recurse(routes, new Path);
    }
function APIClient ( routes , onlyGetters ) { var self = this ; var slices = { } ; function recurse ( o , path ) { Object . keys ( o ) . forEach ( function ( k ) { if ( k === 'SLICE' ) { slices [ path [ 0 ] ] = o [ k ] ; } else if ( k . toUpperCase ( ) === k ) { if ( onlyGetters ) { if ( k !== 'GET' ) return ; console . log ( k ) ; var name = path . toName ( slices [ path [ 0 ] ] ) ; } else { var name = path . toName ( slices [ path [ 0 ] ] , k ) ; } if ( name ) { var target = self [ path [ 0 ] ] || ( self [ path [ 0 ] ] = { } ) ; } else { name = path [ 0 ] ; var target = self ; } target [ name ] = makeCtor ( path . args ( ) . concat ( o [ k ] ) , self ) ; Object . defineProperty ( target [ name ] . prototype , 'path' , { get : function ( ) { return path . map ( function ( s ) { return s [ 0 ] === 'Δ'  his[ s . s lice( 1 ) ] ; } , this ) . join ( '/' ) ; } } ) ; } else if ( isObject ( o [ k ] ) ) { recurse ( o [ k ] , path . concat ( k ) ) ; } } ) ; } recurse ( routes , new Path ) ; }
generalized REST API handler that turns routes into functions
generalized REST API handler that turns routes into functions