Sha256: 304a23fb22667ef1a3cd6d4f2c119521a64dfca2167e314a25582121899be2df

Contents?: true

Size: 730 Bytes

Versions: 6

Compression:

Stored size: 730 Bytes

Contents

require "hipchat"

module Janky
  module ChatService
    class HipChat
      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

      def speak(message, room_id, options = {:color => "yellow"})
        @client[room_id].send(@from, message, options)
      end

      def rooms
        @rooms ||= @client.rooms.map do |room|
          Room.new(room.room_id, room.name)
        end
      end
    end
  end

  register_chat_service "hipchat", ChatService::HipChat
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
janky-0.9.14.rc1 lib/janky/chat_service/hipchat.rb
janky-0.9.13 lib/janky/chat_service/hipchat.rb
janky-0.9.12 lib/janky/chat_service/hipchat.rb
janky-0.9.11 lib/janky/chat_service/hipchat.rb
janky-0.9.10 lib/janky/chat_service/hipchat.rb
janky-0.9.9 lib/janky/chat_service/hipchat.rb