Created
October 16, 2012 04:36
-
-
Save michaelfairley/3897255 to your computer and use it in GitHub Desktop.
Ruby version of Jersey
This file contains hidden or 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
the `path_param`/`auth` stuff seems ugly :-/ | |
How to convert response to json, etc. (ActiveModel Serializers?) | |
Providers? | |
Routing/registry |
This file contains hidden or 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 UserResource | |
include Referee::Resource | |
path "/user/{id}" | |
def initialize(user_repository) | |
@user_repository = user_repository | |
end | |
GET() | |
returns :json | |
path_param :id, Integer | |
def get(id) | |
@user_repository.find(id) | |
end | |
DELETE() | |
accepts :json | |
path_param :id, Integer | |
auth User | |
def delete(id, current_user) | |
@user_repository.delete(id) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment