Sha256: e2b86c01adce37c9417e04e7bf379fcd094170ab9f61e40506f3229391de0f56

Contents?: true

Size: 932 Bytes

Versions: 1

Compression:

Stored size: 932 Bytes

Contents

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

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

      # require 'eye/notify/hipchat'
      # 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

1 entries across 1 versions & 1 rubygems

Version Path
eye-notify-hipchat-0.0.3 lib/eye/notify/hipchat.rb