Skip to content

Instantly share code, notes, and snippets.

@michaelfairley
Created October 16, 2012 04:36
Show Gist options
  • Save michaelfairley/3897255 to your computer and use it in GitHub Desktop.
Save michaelfairley/3897255 to your computer and use it in GitHub Desktop.
Ruby version of Jersey
the `path_param`/`auth` stuff seems ugly :-/
How to convert response to json, etc. (ActiveModel Serializers?)
Providers?
Routing/registry
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