lib/gaptool-api.rb in gaptool-api-0.2.2 vs lib/gaptool-api.rb in gaptool-api-0.2.4

- old
+ new

@@ -8,23 +8,34 @@ def initialize(user, apikey, uri) @auth = { 'X-GAPTOOL-USER' => user, 'X-GAPTOOL-KEY' => apikey} GaptoolServer.base_uri uri end + def mongocollectioncount(hash) + options = {:body => hash, :headers => @auth} + JSON::parse self.class.post("/status/mongo/colcount", options) + end + def remoteredisllen(list) options = {:body => list, :headers => @auth} JSON::parse self.class.post("/status/redis/llen", options) end + def remoteredislpush(list, value) + @body = {'list' => list, 'value' => value}.to_json + options = {:body => @body, :headers => @auth} + JSON::parse self.class.post("/status/redis/lpush", options) + end + def redishash(hash) options = {:body => hash, :headers => @auth} JSON::parse self.class.post("/redishash", options) end - def getonenode(role, environment, id) + def getonenode(id) options = {:headers => @auth} - JSON::parse self.class.get("/host/#{role}/#{environment}/#{id}", options) + JSON::parse self.class.get("/instance/#{id}", options) end def getenvroles(role, environment) options = {:headers => @auth} JSON::parse self.class.get("/hosts/#{role}/#{environment}", options) @@ -102,9 +113,19 @@ def getservices() options = { :headers => @auth} # output is all service entries JSON::parse self.class.get("/services", options) + end + + def getrolenodes(role) + options = { :headers => @auth} + JSON::parse self.class.get("/hosts/#{role}", options) + end + + def getenvnodes(environment) + options = { :headers => @auth} + JSON::parse self.class.get("/hosts/ALL/#{environment}", options) end def getallnodes() options = { :headers => @auth} JSON::parse self.class.get("/hosts", options)