marmelab / restful.js

A pure JS client for interacting with server-side RESTful resources. Think Restangular without Angular.
MIT License
966 stars 81 forks source link

addRequestInterceptor - No direct access to instantiated instance object #13

Closed tkambler closed 9 years ago

tkambler commented 9 years ago

It doesn't appear that it is currently possible to assign custom methods, etc... to an entity via addResponseInterceptor:

users.addResponseInterceptor(function(users, headers, method, url) {
    users.forEach(function(user) {
        // user === plain object literal. Shouldn't this be the instantiated entity, as is the case w/ Restangular?
    });
    return users;
});
tkambler commented 9 years ago

Also needs some form of resticulateEntity() (lol) so that you can convert attributes into nested entities / collections in their own right.

RobinBressan commented 9 years ago

It is not available right now. Need to think about it.

jeromemacias commented 9 years ago

You will be able to do it with this PR: #32, will be available soon.

fzaninotto commented 9 years ago

Fixed by #32