Class: Rubyzilla::Bugzilla

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(server) ⇒ Bugzilla

Returns a new instance of Bugzilla.



9
10
11
12
# File 'lib/rubyzilla.rb', line 9

def initialize server
  @@server = XMLRPC::Client.new2(server)
  @@logged_in = false
end

Class Method Details

.logged_in?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/rubyzilla.rb', line 18

def self.logged_in?
  @@logged_in
end

.serverObject



14
15
16
# File 'lib/rubyzilla.rb', line 14

def self.server
  @@server
end

Instance Method Details

#bug(id = nil) ⇒ Object



40
41
42
# File 'lib/rubyzilla.rb', line 40

def bug id=nil
  return Bug.new(id)
end

#login(login, password) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/rubyzilla.rb', line 22

def  , password
  result = @@server.call("User.login", {
    :login => .chomp, :password => password.chomp, 
    :remember => 1
  })
    
  @id = result['id']
  
  # Workaround for Bugzilla's broken cookies.
  if @@server.cookie =~ /Bugzilla_logincookie=([^;]+)/
    @@server.cookie = 
      "Bugzilla_login=#{@id}; Bugzilla_logincookie=#{$1}"
    @@logged_in = true
  end
  
  return @@logged_in
end

#product(id = nil) ⇒ Object



44
45
46
# File 'lib/rubyzilla.rb', line 44

def product id=nil
  return Product.new(id)
end