Class: Janky::ChatService::Campfire
- Inherits:
-
Object
- Object
- Janky::ChatService::Campfire
- Defined in:
- lib/janky/chat_service/campfire.rb
Instance Method Summary collapse
-
#initialize(settings) ⇒ Campfire
constructor
A new instance of Campfire.
- #rooms ⇒ Object
- #speak(message, room_id, opts = {}) ⇒ Object
Constructor Details
#initialize(settings) ⇒ Campfire
Returns a new instance of Campfire.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/janky/chat_service/campfire.rb', line 4 def initialize(settings) account = settings["JANKY_CHAT_CAMPFIRE_ACCOUNT"] if account.nil? || account.empty? raise Error, "JANKY_CHAT_CAMPFIRE_ACCOUNT setting is required" end token = settings["JANKY_CHAT_CAMPFIRE_TOKEN"] if token.nil? || token.empty? raise Error, "JANKY_CHAT_CAMPFIRE_TOKEN setting is required" end Broach.settings = { "account" => account, "token" => token, "use_ssl" => true, } end |
Instance Method Details
#rooms ⇒ Object
26 27 28 29 30 |
# File 'lib/janky/chat_service/campfire.rb', line 26 def rooms @rooms ||= Broach.rooms.map do |room| Room.new(room.id, room.name) end end |
#speak(message, room_id, opts = {}) ⇒ Object
22 23 24 |
# File 'lib/janky/chat_service/campfire.rb', line 22 def speak(, room_id, opts={}) Broach.speak(ChatService.room_name(room_id), ) end |