Class: God::Contacts::Campfire

Inherits:
God::Contact show all
Defined in:
lib/god/contacts/campfire.rb

Class Attribute Summary collapse

Attributes inherited from God::Contact

#group, #info, #name

Instance Method Summary collapse

Methods inherited from God::Contact

#friendly_name, generate, normalize, valid?

Methods included from God::Configurable

#base_name, #complain, complain, #friendly_name, #prepare, #reset, #valid?

Constructor Details

#initializeCampfire

Returns a new instance of Campfire.



51
52
53
# File 'lib/god/contacts/campfire.rb', line 51

def initialize
  @room = nil
end

Class Attribute Details

.formatObject

Returns the value of attribute format.



36
37
38
# File 'lib/god/contacts/campfire.rb', line 36

def format
  @format
end

.server_settingsObject

Returns the value of attribute server_settings.



36
37
38
# File 'lib/god/contacts/campfire.rb', line 36

def server_settings
  @server_settings
end

Instance Method Details

#notify(message, time, priority, category, host) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/god/contacts/campfire.rb', line 55

def notify(message, time, priority, category, host)
  begin
    body = Campfire.format.call(message,host)

    room.speak body

    self.info = "notified campfire: #{Campfire.server_settings[:subdomain]}"
  rescue => e
    applog(nil, :info, "failed to notify campfire: #{e.message}")
    applog(nil, :debug, e.backtrace.join("\n"))
  end
end