Skip to content

Instantly share code, notes, and snippets.

@T-Dnzt
T-Dnzt / index.rb
Last active April 21, 2016 05:20
Extract APIPIE documentation from your controllers
# api/documentation/spaceships/index.rb
module Api::Documentation::Spaceships::Index
extend ActiveSupport::Concern
included do
api :GET, "/api/spaceships", "Get a list of awesome spaceships!"
param :limit, Integer, desc: "How many awesome spaceships do you want?"
param :offset, Integer, desc: "By how many awesome spaceships do you want to offset your query?"
error code: 404, desc: "Spaceship not found! Must have been destroyed."
error code: 500, desc: "Unplanned Alien invasion reduced our spaceships fleet..."