Sha256: 1acdb334e0dd63a22aae607df2347a4a0200f7c30342f3b6f3e5ae036d5b44ad

Contents?: true

Size: 875 Bytes

Versions: 6

Compression:

Stored size: 875 Bytes

Contents

describe_service "/hello_world" do |service|
  service.formats   :json
  service.http_verb :get
  service.disable_auth # on by default

  # INPUT
  service.param.string  :name, :default => 'World'

  # OUTPUT
  service.response do |response|
    response.object do |obj|
      obj.string :message, :doc => "The greeting message sent back. Defaults to 'World'"
      obj.datetime :at, :doc => "The timestamp of when the message was dispatched"
    end
  end

  # DOCUMENTATION
  service.documentation do |doc|
    doc.overall "This service provides a simple hello world implementation example."
    doc.param :name, "The name of the person to greet."
    doc.example "<code>curl -I 'http://localhost:9292/hello_world?name=Matt'</code>"
  end

  # ACTION/IMPLEMENTATION
  service.implementation do
    {:message => "Hello #{params[:name]}", :at => Time.now}.to_json
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
wd_sinatra-1.0.6 templates/api/hello_world.rb
wd_sinatra-1.0.5 templates/api/hello_world.rb
wd_sinatra-1.0.4 templates/api/hello_world.rb
wd_sinatra-1.0.3 templates/api/hello_world.rb
wd_sinatra-1.0.2 templates/api/hello_world.rb
wd_sinatra-1.0.1 templates/api/hello_world.rb