Class: Outpost::Notifiers::Campfire
- Inherits:
-
Object
- Object
- Outpost::Notifiers::Campfire
- Defined in:
- lib/outpost/notifiers/campfire.rb
Overview
The Campfire notifier issues Outpost notifications to the 37signals’ Campfire web app (campfirenow.com). It issues messages about the system status in the specified subdomain and room.
This requires the ‘tinder’ gem to be installed.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Campfire
constructor
A new instance of Campfire.
-
#notify(outpost) ⇒ Object
Issues a notification to a Campfire room.
Constructor Details
#initialize(options = {}) ⇒ Campfire
Returns a new instance of Campfire.
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/outpost/notifiers/campfire.rb', line 25 def initialize(={}) @subdomain = [:subdomain] || '' @token = [:token] || '' @room = [:room] || '' @campfire_notifier = [:campfire_notifier] || Tinder::Campfire if [@subdomain, @token, @room].any?(&:empty?) raise ArgumentError, 'You need to supply :token, :subdomain and :room.' end end |
Instance Method Details
#notify(outpost) ⇒ Object
Issues a notification to a Campfire room. This is a callback, called by an Outpost instance.
41 42 43 44 45 46 47 |
# File 'lib/outpost/notifiers/campfire.rb', line 41 def notify(outpost) campfire = @campfire_notifier.new @subdomain, :token => @token room = campfire.find_room_by_name @room status = outpost.last_status.to_s room.speak "System is #{status}: #{outpost..join(',')}" end |