class Slackify::Handlers::Base

Base handler class that any user defined handlers must inherit from

Attributes

allowed_slash_methods[R]

Public Class Methods

allow_slash_method(element) click to toggle source

Enables a method to be called for a slash command.

More context: Slash commands have extra validations. To call a slash command, it needs to call a method on a supported handler and that handler needs to explicitly specify which methods are for slash command.

# File lib/slackify/handlers/base.rb, line 24
def allow_slash_method(element)
  if defined?(@allowed_slash_methods) && @allowed_slash_methods
    @allowed_slash_methods.push(*element)
  else
    @allowed_slash_methods = Array(element)
  end
end
inherited(subclass) click to toggle source

Any class inheriting from Slackify::Handler::Base will be added to the list of supported handlers

# File lib/slackify/handlers/base.rb, line 34
def inherited(subclass)
  @@supported_handlers.push(subclass.to_s)
end
slack_client() click to toggle source

Get the slack client that you can use to perform slack api calls @see github.com/slack-ruby/slack-ruby-client

# File lib/slackify/handlers/base.rb, line 14
def slack_client
  Slackify.configuration.slack_client
end
supported_handlers() click to toggle source

Show a list of the handlers supported by the app. Since we do metaprogramming, we want to ensure we can only call defined handlers

# File lib/slackify/handlers/base.rb, line 40
def supported_handlers
  @@supported_handlers
end