Class: God::Contacts::Hipchat
- Inherits:
-
God::Contact
- Object
- God::Contact
- God::Contacts::Hipchat
- Defined in:
- lib/god/contacts/hipchat.rb
Class Attribute Summary collapse
-
.format ⇒ Object
Returns the value of attribute format.
-
.from ⇒ Object
Returns the value of attribute from.
-
.room ⇒ Object
Returns the value of attribute room.
-
.ssl ⇒ Object
Returns the value of attribute ssl.
-
.token ⇒ Object
Returns the value of attribute token.
Instance Attribute Summary collapse
-
#from ⇒ Object
Returns the value of attribute from.
-
#room ⇒ Object
Returns the value of attribute room.
-
#ssl ⇒ Object
Returns the value of attribute ssl.
-
#token ⇒ Object
Returns the value of attribute token.
Attributes inherited from God::Contact
Instance Method Summary collapse
Methods inherited from God::Contact
#arg, defaults, #friendly_name, generate, normalize, valid?
Methods included from God::Configurable
#base_name, complain, #complain, #friendly_name, #prepare, #reset
Class Attribute Details
.format ⇒ Object
Returns the value of attribute format.
79 80 81 |
# File 'lib/god/contacts/hipchat.rb', line 79 def format @format end |
.from ⇒ Object
Returns the value of attribute from.
78 79 80 |
# File 'lib/god/contacts/hipchat.rb', line 78 def from @from end |
.room ⇒ Object
Returns the value of attribute room.
78 79 80 |
# File 'lib/god/contacts/hipchat.rb', line 78 def room @room end |
.ssl ⇒ Object
Returns the value of attribute ssl.
78 79 80 |
# File 'lib/god/contacts/hipchat.rb', line 78 def ssl @ssl end |
.token ⇒ Object
Returns the value of attribute token.
78 79 80 |
# File 'lib/god/contacts/hipchat.rb', line 78 def token @token end |
Instance Attribute Details
#from ⇒ Object
Returns the value of attribute from.
88 89 90 |
# File 'lib/god/contacts/hipchat.rb', line 88 def from @from end |
#room ⇒ Object
Returns the value of attribute room.
88 89 90 |
# File 'lib/god/contacts/hipchat.rb', line 88 def room @room end |
#ssl ⇒ Object
Returns the value of attribute ssl.
88 89 90 |
# File 'lib/god/contacts/hipchat.rb', line 88 def ssl @ssl end |
#token ⇒ Object
Returns the value of attribute token.
88 89 90 |
# File 'lib/god/contacts/hipchat.rb', line 88 def token @token end |
Instance Method Details
#notify(message, time, priority, category, host) ⇒ Object
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/god/contacts/hipchat.rb', line 98 def notify(, time, priority, category, host) body = Hipchat.format.call(, 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.}") applog(nil, :debug, e.backtrace.join("\n")) end |
#valid? ⇒ Boolean
90 91 92 93 94 95 96 |
# 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 |