Class: ExceptionNotifier::CampfireNotifier

Inherits:
Object
  • Object
show all
Defined in:
lib/exception_notifier/campfire_notifier.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ CampfireNotifier

Returns a new instance of CampfireNotifier.



8
9
10
11
12
13
14
15
16
17
# File 'lib/exception_notifier/campfire_notifier.rb', line 8

def initialize(options)
  begin
    subdomain = options.delete(:subdomain)
    room_name = options.delete(:room_name)
    @campfire = Tinder::Campfire.new subdomain, options
    @room     = @campfire.find_room_by_name room_name
  rescue
    @campfire = @room = nil
  end
end

Instance Attribute Details

#roomObject

Returns the value of attribute room.



6
7
8
# File 'lib/exception_notifier/campfire_notifier.rb', line 6

def room
  @room
end

#subdomainObject

Returns the value of attribute subdomain.



4
5
6
# File 'lib/exception_notifier/campfire_notifier.rb', line 4

def subdomain
  @subdomain
end

#tokenObject

Returns the value of attribute token.



5
6
7
# File 'lib/exception_notifier/campfire_notifier.rb', line 5

def token
  @token
end

Instance Method Details

#call(exception, options = {}) ⇒ Object



19
20
21
# File 'lib/exception_notifier/campfire_notifier.rb', line 19

def call(exception, options={})
  @room.paste "A new exception occurred: '#{exception.message}' on '#{exception.backtrace.first}'" if active?
end