Class: Janky::ChatService::HipChat
- Inherits:
-
Object
- Object
- Janky::ChatService::HipChat
- Defined in:
- lib/janky/chat_service/hipchat.rb
Instance Method Summary collapse
-
#initialize(settings) ⇒ HipChat
constructor
A new instance of HipChat.
- #rooms ⇒ Object
- #speak(message, room_id, options = {}) ⇒ Object
Constructor Details
#initialize(settings) ⇒ HipChat
Returns a new instance of HipChat.
6 7 8 9 10 11 12 13 14 |
# File 'lib/janky/chat_service/hipchat.rb', line 6 def initialize(settings) token = settings["JANKY_CHAT_HIPCHAT_TOKEN"] if token.nil? || token.empty? raise Error, "JANKY_CHAT_HIPCHAT_TOKEN setting is required" end @client = ::HipChat::Client.new(token) @from = settings["JANKY_CHAT_HIPCHAT_FROM"] || "CI" end |
Instance Method Details
#rooms ⇒ Object
25 26 27 28 29 |
# File 'lib/janky/chat_service/hipchat.rb', line 25 def rooms @rooms ||= @client.rooms.map do |room| Room.new(room.room_id, room.name) end end |
#speak(message, room_id, options = {}) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/janky/chat_service/hipchat.rb', line 16 def speak(, room_id, = {}) default = { :color => "yellow", :message_format => "text" } = default.merge() @client[room_id].send(@from, , ) end |