Last active
August 29, 2015 14:06
-
-
Save stabenfeldt/dce9220cecb30481fe95 to your computer and use it in GitHub Desktop.
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
| 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