Class: God::Contacts::Campfire
- Inherits:
-
God::Contact
- Object
- God::Contact
- God::Contacts::Campfire
- Defined in:
- lib/god/contacts/campfire.rb
Class Attribute Summary (collapse)
-
+ (Object) format
Returns the value of attribute format.
-
+ (Object) room
Returns the value of attribute room.
-
+ (Object) ssl
Returns the value of attribute ssl.
-
+ (Object) subdomain
Returns the value of attribute subdomain.
-
+ (Object) token
Returns the value of attribute token.
Instance Attribute Summary (collapse)
-
- (Object) room
Returns the value of attribute room.
-
- (Object) ssl
Returns the value of attribute ssl.
-
- (Object) subdomain
Returns the value of attribute subdomain.
-
- (Object) token
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
+ (Object) format
Returns the value of attribute format
83 84 85 |
# File 'lib/god/contacts/campfire.rb', line 83 def format @format end |
+ (Object) room
Returns the value of attribute room
82 83 84 |
# File 'lib/god/contacts/campfire.rb', line 82 def room @room end |
+ (Object) ssl
Returns the value of attribute ssl
82 83 84 |
# File 'lib/god/contacts/campfire.rb', line 82 def ssl @ssl end |
+ (Object) subdomain
Returns the value of attribute subdomain
82 83 84 |
# File 'lib/god/contacts/campfire.rb', line 82 def subdomain @subdomain end |
+ (Object) token
Returns the value of attribute token
82 83 84 |
# File 'lib/god/contacts/campfire.rb', line 82 def token @token end |
Instance Attribute Details
- (Object) room
Returns the value of attribute room
92 93 94 |
# File 'lib/god/contacts/campfire.rb', line 92 def room @room end |
- (Object) ssl
Returns the value of attribute ssl
92 93 94 |
# File 'lib/god/contacts/campfire.rb', line 92 def ssl @ssl end |
- (Object) subdomain
Returns the value of attribute subdomain
92 93 94 |
# File 'lib/god/contacts/campfire.rb', line 92 def subdomain @subdomain end |
- (Object) token
Returns the value of attribute token
92 93 94 |
# File 'lib/god/contacts/campfire.rb', line 92 def token @token end |
Instance Method Details
- (Object) notify(message, time, priority, category, host)
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 |
- (Boolean) valid?
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 |