8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/cuboid/rest/server/routes/dispatcher.rb', line 8
def self.registered( app )
app.get '/dispatcher/url' do
ensure_dispatcher!
json Options.dispatcher.url
end
app.put '/dispatcher/url' do
url = ::JSON.load( request.body.read ) || {}
handle_error do
connect_to_dispatcher( url ).alive?
@dispatcher = nil
Options.dispatcher.url = url
json nil
end
end
app.delete '/dispatcher/url' do
ensure_dispatcher!
json @dispatcher = Options.dispatcher.url = nil
end
end
|