Class: HipChatCli::Message
- Inherits:
-
Object
- Object
- HipChatCli::Message
- Defined in:
- lib/hip_chat_cli/message.rb
Instance Method Summary collapse
- #deliver(message) ⇒ Object
-
#initialize(params) ⇒ Message
constructor
A new instance of Message.
Constructor Details
#initialize(params) ⇒ Message
Returns a new instance of Message.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/hip_chat_cli/message.rb', line 5 def initialize(params) %w(token room).each do |key| raise OptionParser::MissingArgument, "#{key} is a required option" if params[key.to_sym].nil? end @room = params[:room] @notify = params[:notify] || false @format = params[:format] || 'html' @color = params[:color] || 'yellow' @username = params[:username] || 'API' @client = HipChat::Client.new(params[:token]) end |
Instance Method Details
#deliver(message) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/hip_chat_cli/message.rb', line 20 def deliver() raise OptionParser::MissingArgument, "message is required" if .nil? || == '' @client[@room].send(@username, , { :notify => @notify, :message_format => @format, :color => @color } ) end |