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.



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

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.



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

def access_token
  @access_token
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

Class Method Details

.allObject



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

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

.configure(project_name, project_access_token) ⇒ Object



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

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

.delete_allObject



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

def self.delete_all
  @@projects = {}
end

.find(project_name) ⇒ Object



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

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