class Phabricator::User

Attributes

name[RW]
phid[R]

Public Class Methods

find_by_name(name) click to toggle source
# File lib/phabricator/user.rb, line 20
def self.find_by_name(name)
  # Re-populate if we couldn't find it in the cache (this applies to
  # if the cache is empty as well).
  populate_all unless @@cached_users[name]

  @@cached_users[name]
end
new(attributes) click to toggle source
# File lib/phabricator/user.rb, line 28
def initialize(attributes)
  @phid = attributes['phid']
  @name = attributes['userName']
end
populate_all() click to toggle source
# File lib/phabricator/user.rb, line 10
def self.populate_all
  response = JSON.parse(client.request(:post, 'user.query'))

  response['result'].each do |data|
    user = User.new(data)
    @@cached_users[user.name] = user
  end

end

Private Class Methods

client() click to toggle source
# File lib/phabricator/user.rb, line 35
def self.client
  @client ||= Phabricator::ConduitClient.instance
end