Sha256: 3fca9705226706257da79ccb49ada7b8c17f9c930230ce4fad837e253f2d628b

Contents?: true

Size: 696 Bytes

Versions: 2

Compression:

Stored size: 696 Bytes

Contents

class ExceptionNotifier
  class CampfireNotifier
    require 'tinder'

    attr_accessor :subdomain
    attr_accessor :token
    attr_accessor :room

    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

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

    private

    def active?
      !@room.nil?
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
exception_notification-3.0.0 lib/exception_notifier/campfire_notifier.rb
exception_notification-3.0.0.rc1 lib/exception_notifier/campfire_notifier.rb