Skip to content

Instantly share code, notes, and snippets.

@jacklynrose
Created February 16, 2014 14:05
Show Gist options
  • Save jacklynrose/9034710 to your computer and use it in GitHub Desktop.
Save jacklynrose/9034710 to your computer and use it in GitHub Desktop.
RestKit Wrapper Usage Proposal
class PostRestStore < RestfulMotion::Store
api_endpoint 'http://example.com/v2/posts'
model :post
# some attribute mapping code
end
# 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