Class: Trac::Query

Inherits:
Object
  • Object
show all
Defined in:
lib/trac4r/query.rb

Instance Method Summary collapse

Constructor Details

#initialize(url, user, pass) ⇒ Query

Returns a new instance of Query.



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/trac4r/query.rb', line 29

def initialize url,user,pass
  if user && pass
    url = url.sub 'xmlrpc','login/xmlrpc'
  end
  uri = URI.parse(url)
  use_ssl = (uri.scheme == 'https') ? true : false
  @host = uri.host
  @path = uri.path
  @port = uri.port
  @connection = XMLRPC::Client.new(@host,
                                   @path,
                                   @port,
                                   nil,
                                   nil,
                                   user,
                                   pass,
                                   use_ssl,
                                   nil)
end

Instance Method Details

#query(command, *args) ⇒ Object



49
50
51
52
53
54
55
# File 'lib/trac4r/query.rb', line 49

def query command, *args
  begin
    return @connection.call(command,*args)
  rescue => e
    raise TracException.new(e.message,@host,@port,@path,command,args,e)
  end
end