class Prpr::Publisher::Adapter::Slack

Public Instance Methods

publish(message) click to toggle source
# File lib/prpr/publisher/adapter/slack.rb, line 7
def publish(message)
  params = { link_names: true }

  if message.from
    params[:username] = message.from.login
    params[:icon_url] = message.from.avatar_url
  end

  if message.room
    params[:channel] = message.room
  end

  notifier.ping message.body, params
end

Private Instance Methods

notifier() click to toggle source
# File lib/prpr/publisher/adapter/slack.rb, line 24
def notifier
  @notifier ||= ::Slack::Notifier.new webhook_url
end
webhook_url() click to toggle source
# File lib/prpr/publisher/adapter/slack.rb, line 28
def webhook_url
  Prpr::Config::Env.default[:slack_webhook_url]
end