Sha256: 91018615802f9ec09e44d095461d8e128d8b1ca44a1fbd9f950ba30813f28dab

Contents?: true

Size: 874 Bytes

Versions: 14

Compression:

Stored size: 874 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

14 entries across 14 versions & 1 rubygems

Version Path
wd_sinatra-1.0.0 templates/api/hello_world.rb
wd_sinatra-0.3.2 templates/api/hello_world.rb
wd_sinatra-0.3.1 templates/api/hello_world.rb
wd_sinatra-0.3.0 templates/api/hello_world.rb
wd_sinatra-0.2.6 templates/api/hello_world.rb
wd_sinatra-0.2.5 templates/api/hello_world.rb
wd_sinatra-0.2.4 templates/api/hello_world.rb
wd_sinatra-0.2.3 templates/api/hello_world.rb
wd_sinatra-0.2.2 templates/api/hello_world.rb
wd_sinatra-0.2.1 templates/api/hello_world.rb
wd_sinatra-0.2.0 templates/api/hello_world.rb
wd_sinatra-0.1.0 templates/api/hello_world.rb
wd_sinatra-0.0.2 templates/api/hello_world.rb
wd_sinatra-0.0.1 templates/api/hello_world.rb