Sha256: 9ec94d657cff564c804eef5aca670e80573a7373c0d5d7e82d01f55b27ae39e6

Contents?: true

Size: 681 Bytes

Versions: 2

Compression:

Stored size: 681 Bytes

Contents

require 'openfire_admin/http_client'
require 'openfire_admin/response_exception'

module OpenfireAdmin
  # pure admin console client
  class AdminClient
    def initialize(loginurl)
      @http = HttpClient.new(URI.parse(loginurl))
    end
    def post(path, form_data, &proc); @http.post(path, form_data, &proc); end
    def get(path, &proc); @http.get(path, &proc); end

    # login
    def login(username, pass)
      post( "/login.jsp" , {
          "login"=> "true",
          "password"=>pass,
          "url"=>"/index.jsp",
          "username"=>username}) do |res|
        raise ResponceException.new("can't login",res) unless res.code == "302"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
openfire_admin-0.0.3 lib/openfire_admin/admin_client.rb
openfire_admin-0.0.2 lib/openfire_admin/admin_client.rb