class OmniAuth::Strategies::Slack

Public Instance Methods

bot_allowed?() click to toggle source
# File lib/omniauth/strategies/slack.rb, line 103
def bot_allowed?
  return false unless options['scope']
  bot_scopes = ['bot']
  scopes = options['scope'].split(',')
  (scopes & bot_scopes).any?
end
bot_info() click to toggle source
# File lib/omniauth/strategies/slack.rb, line 91
def bot_info
  return {} unless bot_allowed?
  access_token.params['bot']
end
incoming_webhook_allowed?() click to toggle source
# File lib/omniauth/strategies/slack.rb, line 96
def incoming_webhook_allowed?
  return false unless options['scope']
  webhooks_scopes = ['incoming-webhook']
  scopes = options['scope'].split(',')
  (scopes & webhooks_scopes).any?
end
raw_info() click to toggle source
# File lib/omniauth/strategies/slack.rb, line 70
def raw_info
  @raw_info ||= access_token.get('/api/auth.test').parsed
end
team_info() click to toggle source
# File lib/omniauth/strategies/slack.rb, line 82
def team_info
  @team_info ||= access_token.get('/api/team.info').parsed
end
user_info() click to toggle source
# File lib/omniauth/strategies/slack.rb, line 74
def user_info
  url = URI.parse("/api/users.info")
  url.query = Rack::Utils.build_query(user: raw_info['user_id'])
  url = url.to_s

  @user_info ||= access_token.get(url).parsed
end
web_hook_info() click to toggle source
# File lib/omniauth/strategies/slack.rb, line 86
def web_hook_info
  return {} unless incoming_webhook_allowed?
  access_token.params['incoming_webhook']
end