Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 70 lines (62 sloc) 1.555 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
require 'sinatra/base'
require File.join(File.dirname(__FILE__), *%w(lib doc))

# a reference usage of Sinatra::Doc
module Kittens
  class App < Sinatra::Base
    register Sinatra::Doc do
      def title
       "kittenz api"
      end
      
      def header
        (<<-HEADER)
<h1>
<pre>
kittenz
_
\`*-.
) _`-.
. : `. .
: _ ' \
; *` _. `*-._
`-.-' `-.
; ` `.
:. . \
. \ . : .-' .
' `+.; ; ' :
: ' | ; ;-.
; ' : :`-: _.`* ;
.*' / .*' ; .*`- +' `*'
`*-* `*-* `*-*'
</pre>
</h1>
HEADER
      end
    end
    
    doc 'lists all kittens'
    get '/kittens' do
      '...'
    end
    
    doc 'gets a kitten by name', {
      :name => "name of kitten"
    }
    get '/kittens/:name' do |name|
      "..."
    end
    
    doc 'creates a new kitten'
    post '/kittens' do
      '...'
    end
    
    doc 'updates a kitten', {
      :name => 'name of kitten'
    }
    put "/kittens/:id" do
      '...'
    end
    
    doc 'deletes a given kitten', {
      :name => 'name of kitten'
    }
    delete '/kittens/:name' do |name|
      '...'
    end
    
  end
end
Something went wrong with that request. Please try again.