GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
Currently relations are supported by searching relationName in representation
This hack allows building relations by using relationName_id or relationName_ids, as many Ruby on Rails engines return.
Support relation by foreign id
Make AFPluralizedString extern. Relates #61, #52
Removed static declaration from AFPluralizedString
Relation by foreign id bugfix
De-pluralize foreign id relation name
Don't crash on success if responseObject is nil. Useful if using 304 …
…Not Modified responses.
Changed saving operation to work if no request is specified
Thanks for your pull request, @xslim. There's a lot in here other than the foreign ID stuff, so it's going to take some time for me to determine what I should take from this. Bear with me for a moment.
Sorry for a lot of commits, I'm trying to use the library in current app development, and I stuccoed with the problem of entities are not saved in DB. So some of the commits are fixing this issue.
Also I've made implementation for sending If-Modified-Since and working with 304 Not Modified… but this work is currently in my gist https://gist.github.com/3855430
If you have any comments how to improve the code for pull request - please tell me I'll do that.
No worries at all—thanks for your contributions.
As it were, I just added Last-Modified support myself, with 40bee2d. It takes a different approach from yours by managing Last-Modified in the same way as resource identifiers. Interested to hear any thoughts you have.
You developed Last-Modified for "per-resource request"
What I did in my gist, is developed Last-modified when requesting "array" of items.
The example implementation on rails side is
@areas = parent.areas
if stale?(last_modified: @areas.max(:updated_at))
So I get the last modified area in database, and send this info to server. Server checks it against his DB and returns just :304 if nothing changed, or :200 with the list of areas if there were changes. This saves bandwidth.
https://github.com/xslim/AFIncrementalStore/commit/06041256e5c76190fba714f4b6d8a4c2aff8c180 prevents crashing when server sends 304 Not-Modified and empty data in success.
To make 304 a success response I also added this code in APIClient subclass
// 304 Not-Modified
[AFJSONRequestOperation addAcceptableStatusCodes:[NSIndexSet indexSetWithIndex:304]];
Should I change my pull request to reflect your latest commits?
As of e8c6472, AFIncrementalStore is no longer being actively maintained. Thank you for your contributions; my sincere apologies for any inconvenience this may have caused.