Sha256: afc4c60dd030b8f97dd478b60eb5d0a93dab8fa375608c2dc5bb4a32ba4af4a2

Contents?: true

Size: 773 Bytes

Versions: 4

Compression:

Stored size: 773 Bytes

Contents

require 'sinatra/base'

module FakeSQS
  class WebInterface < Sinatra::Base

    configure do
      use FakeSQS::CatchErrors, response: ErrorResponse
    end

    helpers do

      def action
        params.fetch("Action")
      end

    end

    get "/" do
      200
    end

    delete "/" do
      settings.api.reset
      200
    end

    put "/" do
      settings.api.expire
      200
    end

    post "/" do
      params['logger'] = logger
      if params['QueueUrl']
        queue = URI.parse(params['QueueUrl']).path.gsub(/\//, '')
        return settings.api.call(action, queue, params) unless queue.empty?
      end

      settings.api.call(action, params)
    end

    post "/:queue" do |queue|
      settings.api.call(action, queue, params)
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fake_sqs-0.3.1 lib/fake_sqs/web_interface.rb
fake_sqs-0.3.0 lib/fake_sqs/web_interface.rb
fake_sqs-0.2.0 lib/fake_sqs/web_interface.rb
fake_sqs-0.1.0 lib/fake_sqs/web_interface.rb