class Talentio::Notifier::Slack
Public Instance Methods
mention_id_from_evaluations(evaluations)
click to toggle source
# File lib/talentio/notifier/slack.rb, line 20 def mention_id_from_evaluations(evaluations) members.map do |sm| evaluations.select {|e| !e['finished']}.map do |m| { id: "@#{sm['id']}", name: sm['name'] } if sm['real_name'] =~ /#{m["employee"]['lastName']}/ && sm['real_name'] =~ /#{m["employee"]['firstName']}/ end end.flatten.compact end
nofity()
click to toggle source
# File lib/talentio/notifier/slack.rb, line 15 def nofity return unless notify? end
notify?()
click to toggle source
# File lib/talentio/notifier/slack.rb, line 11 def notify? ENV['SLACK_APIKEY'] end
Private Instance Methods
client()
click to toggle source
# File lib/talentio/notifier/slack.rb, line 44 def client unless @client ::Slack.configure do |conf| conf.token = ENV['SLACK_APIKEY'] end @client = ::Slack::Web::Client.new if ENV['TALENTIO_TEST'] @client.define_singleton_method(:chat_postMessage) do |m| puts m end end end @client end
members()
click to toggle source
# File lib/talentio/notifier/slack.rb, line 29 def members unless @members members = [] next_cursor = nil loop do slack_users = client.users_list({limit: 1000, cursor: next_cursor}) members << slack_users['members'] next_cursor = slack_users['response_metadata']['next_cursor'] break if next_cursor.empty? end @members = members.flatten end @members end