Class: God::Contacts::Campfire
- Inherits:
-
God::Contact
- Object
- God::Contact
- God::Contacts::Campfire
- Defined in:
- lib/god/contacts/campfire.rb
Class Attribute Summary collapse
-
.format ⇒ Object
Returns the value of attribute format.
-
.room ⇒ Object
Returns the value of attribute room.
-
.ssl ⇒ Object
Returns the value of attribute ssl.
-
.subdomain ⇒ Object
Returns the value of attribute subdomain.
-
.token ⇒ Object
Returns the value of attribute token.
Instance Attribute Summary collapse
-
#room ⇒ Object
Returns the value of attribute room.
-
#ssl ⇒ Object
Returns the value of attribute ssl.
-
#subdomain ⇒ Object
Returns the value of attribute subdomain.
-
#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.
83 84 85 |
# File 'lib/god/contacts/campfire.rb', line 83 def format @format end |
.room ⇒ Object
Returns the value of attribute room.
82 83 84 |
# File 'lib/god/contacts/campfire.rb', line 82 def room @room end |
.ssl ⇒ Object
Returns the value of attribute ssl.
82 83 84 |
# File 'lib/god/contacts/campfire.rb', line 82 def ssl @ssl end |
.subdomain ⇒ Object
Returns the value of attribute subdomain.
82 83 84 |
# File 'lib/god/contacts/campfire.rb', line 82 def subdomain @subdomain end |
.token ⇒ Object
Returns the value of attribute token.
82 83 84 |
# File 'lib/god/contacts/campfire.rb', line 82 def token @token end |
Instance Attribute Details
#room ⇒ Object
Returns the value of attribute room.
92 93 94 |
# File 'lib/god/contacts/campfire.rb', line 92 def room @room end |
#ssl ⇒ Object
Returns the value of attribute ssl.
92 93 94 |
# File 'lib/god/contacts/campfire.rb', line 92 def ssl @ssl end |
#subdomain ⇒ Object
Returns the value of attribute subdomain.
92 93 94 |
# File 'lib/god/contacts/campfire.rb', line 92 def subdomain @subdomain end |
#token ⇒ Object
Returns the value of attribute token.
92 93 94 |
# File 'lib/god/contacts/campfire.rb', line 92 def token @token end |
Instance Method Details
#notify(message, time, priority, category, host) ⇒ Object
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/god/contacts/campfire.rb', line 102 def notify(, time, priority, category, host) body = Campfire.format.call(, time, priority, category, host) conn = Marshmallow::Connection.new( :subdomain => arg(:subdomain), :token => arg(:token), :ssl => arg(:ssl) ) conn.speak(arg(:room), body) self.info = "notified campfire: #{arg(:subdomain)}" rescue Object => e applog(nil, :info, "failed to notify campfire: #{e.}") applog(nil, :debug, e.backtrace.join("\n")) end |
#valid? ⇒ Boolean
94 95 96 97 98 99 100 |
# File 'lib/god/contacts/campfire.rb', line 94 def valid? valid = true valid &= complain("Attribute 'subdomain' must be specified", self) unless arg(:subdomain) valid &= complain("Attribute 'token' must be specified", self) unless arg(:token) valid &= complain("Attribute 'room' must be specified", self) unless arg(:room) valid end |