Created
February 16, 2014 14:05
-
-
Save jacklynrose/9034710 to your computer and use it in GitHub Desktop.
RestKit Wrapper Usage Proposal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PostRestStore < RestfulMotion::Store | |
api_endpoint 'http://example.com/v2/posts' | |
model :post | |
# some attribute mapping code | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Keep in mind that the model isn't implemented in RestfulMotion (or whatever it will be called), the store just uses it | |
# GET /v2/posts | |
PostRestStore.all | |
# GET /v2/posts/1 | |
PostRestStore.find(1) | |
# POST /v2/posts | |
PostRestStore.create(Post.new(title: 'Title', content: 'Content')) | |
# PUT /v2/posts/1 | |
PostRestStore.update(@post.update(title: 'Title', content: 'Content')) | |
# DELETE /v2/posts/1 | |
PostRestStore.destroy(@post.id) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment