Class: KnifeSantoku::Notification::CampfireNotifier

Inherits:
Object
  • Object
show all
Defined in:
lib/knife_santoku/notification/campfire_notifier.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ CampfireNotifier

Returns a new instance of CampfireNotifier.



7
8
9
10
11
12
13
14
# File 'lib/knife_santoku/notification/campfire_notifier.rb', line 7

def initialize(config)
  
  @subdomain = config["campfire"]["subdomain"]
  @token = config["campfire"]["token"]
  @room  = config["campfire"]["room"]
  @notify = 0 if config["campfire"]["notify"] == false
  @notify = 1 if config["campfire"]["notify"] == true
end

Instance Method Details

#notify(msg) ⇒ Object



16
17
18
19
20
# File 'lib/knife_santoku/notification/campfire_notifier.rb', line 16

def notify(msg)
  campfire = Tinder::Campfire.new "#{@subdomain}" , :token => "#{@token}" 
  room = campfire.find_room_by_name(@room)
  room.speak(msg) if @notify
end