summaryrefslogtreecommitdiff
path: root/extra/rest_client.rb
diff options
context:
space:
mode:
Diffstat (limited to 'extra/rest_client.rb')
-rw-r--r--extra/rest_client.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/extra/rest_client.rb b/extra/rest_client.rb
new file mode 100644
index 0000000..2c58d04
--- /dev/null
+++ b/extra/rest_client.rb
@@ -0,0 +1,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 node, opt={}
+ data = JSON.dump :node => node, :user => opt[:user], :msg => opt[:msg], :from => opt[:from]
+ @web.put '/nodes/next/' + node.to_s, data
+ end
+
+ end
+end