class Phabricator::Project

Attributes

id[R]
name[RW]
phid[R]

Public Class Methods

find_by_name(name) click to toggle source
# File lib/phabricator/project.rb, line 19
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_projects[name]

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

  response['result'].each do |phid, data|
    project = Project.new(data)
    @@cached_projects[project.name] = project
  end
end

Private Class Methods

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