class TrackerHub::Request::Notification::HipChat
Service to send notifications to when an error occured during the log process
Constants
- API_VERSION
HipChat
API version to call by default
Attributes
@return [HipChat::Client] the hipchat client @api private
@return [Hash] hipchat send method options @api private
@return [String] room's name to send the message to @api private
@return [String] user's name sending the message @api private
Public Class Methods
Instantiate a HipChat
notifier. For more options, please checkout
https://www.hipchat.com/docs/apiv2/method/send_room_notification
@param [String] token API key to talk with hipchat services @param [String] room Room's name to send the message @param [String] username User's name sending the message @option options [String] :api_version Version of the hipchat API @return [TrackerHub::Request::Notification::HipChat]
@example
> TrackerHub::Request::Notification::HipChat.new(token, 'room', 'username')
@api private
# File lib/tracker_hub/request/notification/hip_chat.rb, line 56 def initialize(token, room, username, options = {}) api_version = options.delete(:api_version) || API_VERSION self.room = room self.username = username self.options = options self.client = ::HipChat::Client.new(token, api_version: api_version) end
Public Instance Methods
Send a notification message
@param [String] msg Message to send @param [Hash] args See more options at
https://www.hipchat.com/docs/apiv2/method/send_room_notification
@return [Boolean]
@example
> notifier = TrackerHub::Request::Notification::HipChat.new(token, 'room', 'username') > notifier.send_message('my message')
@api public
# File lib/tracker_hub/request/notification/hip_chat.rb, line 21 def send_message(msg, args = {}) client[room].send(username, msg, options.merge(args)) end