Sha256: 5c0bbc99c412886c476d59b7ec577b0f398286d5123023cea49723aa9947a729
Contents?: true
Size: 1.03 KB
Versions: 2
Compression:
Stored size: 1.03 KB
Contents
require 'openfire_admin/html_parser' require 'openfire_admin/admin_client' module OpenfireAdmin # extend for system cache class AdminClient def system_cache get("/system-cache.jsp") do |res| HtmlParser.new(res.body).search('//input[@type="checkbox"][@name="cacheID"]'){|i| { :cacheID => i[:value], :name => i.at("ancestor::tr[1]//table[1]//td[2]").text.strip } } end end def system_cache_clear(cacheID) post("/system-cache.jsp","cacheID"=>cacheID, "clear"=>"Clear") do |res| ! HtmlParser.new(res.body).at("//div[@class='jive-success']").nil? end end end # cache control. this instance can clear cache. class SystemCache attr_reader :cacheID, :name def initialize(client, cacheID, name) @client = client @cacheID = cacheID @name = name end def to_s "#<#{self.class} (#{@cacheID})#{name.inspect}>" end # clear cache def clear @client.system_cache_clear( @cacheID ) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
openfire_admin-0.0.4 | lib/openfire_admin/system_cache.rb |
openfire_admin-0.0.3 | lib/openfire_admin/system_cache.rb |