lib/sm/post_slack_message.rb in sm-0.2.0 vs lib/sm/post_slack_message.rb in sm-0.2.1
- old
+ new
@@ -1,15 +1,18 @@
+require 'json'
require 'rest-client'
-class PostSlackMessage
- def self.to(channel, msg, as_user, icon_emoji, api_url)
- RestClient.post(
- api_url,
- payload: {
- username: as_user,
- channel: channel,
- text: msg,
- icon_emoji: icon_emoji
- }.to_json
- )
+module Sm
+ class PostSlackMessage
+ def self.to(channel, msg, as_user, icon_emoji, api_url)
+ RestClient.post(
+ api_url,
+ payload: {
+ username: as_user,
+ channel: channel,
+ text: msg,
+ icon_emoji: icon_emoji
+ }.to_json
+ )
+ end
end
end