Bugzilla::User

Bugzilla::User

Bugzilla::User class is to access the Bugzilla::WebService::User API that allows you to create User Accounts and log in/out using an existing account.

Public Instance Methods

session(user, password) click to toggle source

Bugzilla::User#session(user, password)

Keeps the bugzilla session during doing something in the block.

# File lib/bugzilla/user.rb, line 45
def session(user, password)
  fname = File.join(ENV['HOME'], '.ruby-bugzilla-cookie.yml')
  if File.exist?(fname) && File.lstat(fname).mode & 0600 == 0600 then
    conf = YAML.load(File.open(fname).read)
    host = @iface.instance_variable_get(:@xmlrpc).instance_variable_get(:@host)
    cookie = conf[host]
    unless cookie.nil? then
      @iface.cookie = cookie
      print "Using cookie\n"
      yield
      conf[host] = @iface.cookie
      File.open(fname, 'w') {|f| f.chmod(0600); f.write(conf.to_yaml)}
      return
    end
  end
  if user.nil? || password.nil? then
    yield
  else
    login({'login'=>user, 'password'=>password, 'remember'=>true})
    yield
    logout
  end
  
end

Protected Instance Methods

__create(cmd, *args) click to toggle source
# File lib/bugzilla/user.rb, line 106
def __create(cmd, *args)
  # FIXME
end
__get(cmd, *args) click to toggle source
# File lib/bugzilla/user.rb, line 114
def __get(cmd, *args)
  requires_version(cmd, 3.4)
  # FIXME
end
__offer_account_by_email(cmd, *args) click to toggle source
# File lib/bugzilla/user.rb, line 102
def __offer_account_by_email(cmd, *args)
  # FIXME
end
__update(cmd, *args) click to toggle source
# File lib/bugzilla/user.rb, line 110
def __update(cmd, *args)
  # FIXME
end
_login(cmd, *args) click to toggle source

Bugzilla::User#login(params)

Raw Bugzilla API to log into Bugzilla.

See www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/User.html

Bugzilla::User#logout

Raw Bugzilla API to log out the user.

See www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/User.html

# File lib/bugzilla/user.rb, line 92
def _login(cmd, *args)
  raise ArgumentError, "Invalid parameters" unless args[0].kind_of?(Hash)

  @iface.call(cmd,args[0])
end
_logout(cmd, *args) click to toggle source
# File lib/bugzilla/user.rb, line 98
def _logout(cmd, *args)
  @iface.call(cmd)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.