Skip to content

Instantly share code, notes, and snippets.

@stabenfeldt
Last active August 29, 2015 14:06
Show Gist options
  • Select an option

  • Save stabenfeldt/dce9220cecb30481fe95 to your computer and use it in GitHub Desktop.

Select an option

Save stabenfeldt/dce9220cecb30481fe95 to your computer and use it in GitHub Desktop.
module V1
class Users < Base
resource :users do
desc 'Lookup of single user'
get 'martin' do
'hello'
end
desc "unconfirmed_tasks"
params do
requires :id, type: Integer, desc: "Status id."
end
route_param :id do
get 'unconfirmed_tasks' do
u = User.find(params[:id])
u.tasks # TODO only return UNconfirmed tasks
end
end
desc "confirmed_tasks"
params do
requires :id, type: Integer, desc: "Status id."
end
route_param :id do
get 'confirmed_tasks' do
u = User.find(params[:id])
u.tasks # TODO only return confirmed tasks
end
end
params { requires :id }
route_param :id do
get do
user = User.find(params[:id])
present :user, user, with: V1::Entities::Users
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment