class God::Contacts::Hipchat

Attributes

format[RW]
from[RW]
room[RW]
ssl[RW]
token[RW]
from[RW]
room[RW]
ssl[RW]
token[RW]

Public Instance Methods

notify(message, time, priority, category, host) click to toggle source
# File lib/god/contacts/hipchat.rb, line 98
def notify(message, time, priority, category, host)
  body = Hipchat.format.call(message, time, priority, category, host)

  conn = Marshmallow::Connection.new(
    :token => arg(:token),
    :ssl   => arg(:ssl),
    :from  => arg(:from)
  )

  conn.speak(arg(:room), body)

  self.info = "notified hipchat: #{arg(:room)}"
rescue Object => e
  applog(nil, :info, "failed to notify hipchat: #{e.message}")
  applog(nil, :debug, e.backtrace.join("\n"))
end
valid?() click to toggle source
# File lib/god/contacts/hipchat.rb, line 90
def valid?
  valid = true
  valid &= complain("Attribute 'token' must be specified", self) unless arg(:token)
  valid &= complain("Attribute 'room' must be specified", self) unless arg(:room)
  valid &= complain("Attribute 'from' must be specified", self) unless arg(:from)
  valid
end