Sha256: c0e0ac05493d9e3b4d2cb5804afd3213febd41e265086d30cc1c4472f839b3af

Contents?: true

Size: 895 Bytes

Versions: 2

Compression:

Stored size: 895 Bytes

Contents

require 'eye'
require 'eye/notify/hipchat/version'
require 'hipchat'

module Eye
  class Notify
    class Hipchat < Eye::Notify::Custom

      # Eye.config do
      #   hipchat api_token: 'asdf', name: 'Eye', notify: true, color: 'red'
      #   contact :ops, :hipchat, 'ops-room'
      # end

      param :api_token, String, true  # Required
      param :name, String, false, 'Eye'  # Not required, defaults to 'Eye'
      param :notify, [TrueClass, FalseClass], false, true  # Not required, defaults to true
      param :color, String, false, 'yellow', ['yellow', 'green', 'red', 'purple', 'gray', 'random']

      def execute
        debug "send hipchat - #{[contact, message_body]}"
        room_name = contact

        client = HipChat::Client.new(api_token, :api_version => 'v2')
        client[room_name].send(name, message_body, notify: notify, color: color)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
eye-notify-hipchat-0.0.2 lib/eye/notify/hipchat.rb
eye-notify-hipchat-0.0.1 lib/eye/notify/hipchat.rb