blob: 88daeaeed79bc3e3258e29a1f674d17f0514043c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
module Oxidized
class RestClient
require 'net/http'
require 'json'
HOST = 'localhost'
PORT = 8888
class << self
def next node, opt={}, host=HOST, port=PORT
web = new host, port
web.next node, opt
end
end
def initialize host=HOST, port=PORT
@web = Net::HTTP.new host, port
end
def next opt
data = JSON.dump opt
@web.put '/nodes/next/' + opt[:name].to_s, data
end
end
end
|