Module Apipie::DSL::Common
In: lib/apipie/dsl_definition.rb

Methods

Public Instance methods

api_version(*versions)

Alias for api_versions

Describe the next method.

Example:

  desc "print hello world"
  def hello_world
    puts "hello world"
  end
description(description)

Alias for desc

describe next method with document in given path in convension, these doc located under "#{Rails.root}/doc" Example: document "hello_world.md" def hello_world

  puts "hello world"

end

Describe possible errors

Example:

  error :desc => "speaker is sleeping", :code => 500, :meta => [:some, :more, :data]
  error 500, "speaker is sleeping"
  def hello_world
    return 500 if self.speaker.sleeping?
    puts "hello world"
  end

Describe available request/response formats

  formats ['json', 'jsonp', 'xml']
full_description(description)

Alias for desc

Describe request header.

 Headers can't be validated with config.validate_presence = true

Example:

  header 'ClientId', "client-id"
  def show
    render :text => headers['HTTP_CLIENT_ID']
  end

Describe additional metadata

  meta :author => { :name => 'John', :surname => 'Doe' }

[Validate]