Class: Q3

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/q3.rb

Constant Summary collapse

DEFAULTS =
{
	'VisibilityTimeout'             => 30,
	'MaximumMessageSize'            => 262144,
	'MessageRetentionPeriod'        => 345600,
	'DelaySeconds'                  => 0,
	'ReceiveMessageWaitTimeSeconds' => 0,
}
CREATE_QUEUE =
%w(
	VisibilityTimeout MessageRetentionPeriod MaximumMessageSize DelaySeconds ReceiveMessageWaitTimeSeconds
)
SET_QUEUE_ATTRIBUTES =
%w(
	DelaySeconds MaximumMessageSize MessageRetentionPeriod Policy ReceiveMessageWaitTimeSeconds
	VisibilityTimeout RedrivePolicy
)

Class Method Summary collapse

Class Method Details

.action(action, path = '/', &block) ⇒ Object



35
36
37
38
# File 'lib/q3.rb', line 35

def self.action(action, path='/', &block)
	@paths ||= Hash.new {|h, k| h[k] = [] }
	@paths[path] << {action: action, block: block}
end

.dispatch!Object



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/q3.rb', line 23

def self.dispatch!
	@paths.each do |path, opts|
		[:get, :post].each do |x|
			send(x, path) do
				if opt = opts.find {|opt| opt[:action] == params['Action'] }
					instance_eval(&opt[:block])
				end
			end
		end
	end
end