Sha256: b459c046f9bff75a466c170d17db0c46d486a938fe5792d5f9bca9de97fc7535

Contents?: true

Size: 787 Bytes

Versions: 1

Compression:

Stored size: 787 Bytes

Contents

require 'sinatra/base'

module Voom
  module Presenters
    module Demo
      # Echo's back post, delete and put
      # Used to demonstrate how the posts(updates), deletes and modifies actions work.
      class Echo < Sinatra::Base
        post('/_echo_') do
          content_type :json
          JSON.dump(params)
        end

        post('/_echo_snackbar_') do
          content_type :json
          JSON.dump(messages:{snackbar: [params[:snackbar_echo]]})
        end

        delete('/_echo_') do
          content_type :json
          JSON.dump(params)
        end

        put('/_echo_') do
          content_type :json
          JSON.dump(params)
        end

        # start the server if ruby file executed directly
        run! if app_file == $0
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
voom-presenters-0.2.0 lib/voom/presenters/demo/echo.rb