Class: RollbarApi::Project

Inherits:
Object
  • Object
show all
Defined in:
lib/rollbar-api/project.rb

Constant Summary collapse

@@projects =
{}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, access_token) ⇒ Project

Returns a new instance of Project.



24
25
26
27
# File 'lib/rollbar-api/project.rb', line 24

def initialize(name, access_token)
  @name = name
  @access_token = access_token
end

Instance Attribute Details

#access_tokenObject (readonly)

Returns the value of attribute access_token.



23
24
25
# File 'lib/rollbar-api/project.rb', line 23

def access_token
  @access_token
end

#nameObject (readonly)

Returns the value of attribute name.



23
24
25
# File 'lib/rollbar-api/project.rb', line 23

def name
  @name
end

Class Method Details

.allObject



15
16
17
# File 'lib/rollbar-api/project.rb', line 15

def self.all
  @@projects.map { |project_name, _| find(project_name) }
end

.configure(project_name, project_access_token) ⇒ Object



5
6
7
8
# File 'lib/rollbar-api/project.rb', line 5

def self.configure(project_name, project_access_token)
  @@projects[project_name] = project_access_token
  find(project_name)
end

.delete_allObject



19
20
21
# File 'lib/rollbar-api/project.rb', line 19

def self.delete_all
  @@projects = {}
end

.find(project_name) ⇒ Object



10
11
12
13
# File 'lib/rollbar-api/project.rb', line 10

def self.find(project_name)
  project_access_token = @@projects[project_name]
  new(project_name, project_access_token) if project_access_token.present?
end