Class: Useless::Doc::DSL

Inherits:
Object
  • Object
show all
Defined in:
lib/useless/doc/dsl.rb

Overview

A simple DSL for building API documentation.

Examples:

Useless::Doc.api 'resource.useless.io' do
  description 'A source of resources'

  get '/resources' do
    description 'Returns a full listing of the resources.'
    authentication_required false
    parameter 'page', 'The page of resources to be returned.'
    header 'X-Twiddle', 'The twiddle threshold.'

    response 200, 'The resources were returned successfully.' do
      header 'X-Twonk', 'The twonk coefficient.'

      body do
        content_type 'application/json'
        attribute 'name', 'The name of the resource.', required: true
      end
    end
  end
end

Defined Under Namespace

Modules: Member Classes: API, Body, Domain, Request, Resource, Response