1
0
Fork 0

Add flush endpoint

This commit is contained in:
Gregory Eremin 2014-09-27 00:51:41 +04:00
parent 0c22f3b09f
commit df920af3e8
1 changed files with 11 additions and 0 deletions

View File

@ -7,6 +7,7 @@ module Burlesque
PUB_ENDPOINT = '/publish'
SUB_ENDPOINT = '/subscribe'
FLUSH_ENDPOINT = '/flush'
STATUS_ENDPOINT = '/status'
DEBUG_ENDPOINT = '/debug'
OK = 'OK'
@ -33,6 +34,16 @@ module Burlesque
end
end
def flush *queues
req = Net::HTTP::Get.new("#{FLUSH_ENDPOINT}?queues=#{queues.join(?,)}")
begin
res = http.request(req)
JSON.parse(res.body) if res.is_a? Net::HTTPOK
rescue Net::ReadTimeout
end
end
def status
req = Net::HTTP::Get.new(STATUS_ENDPOINT)
res = http.request(req)