Module: SlackBot::Events

Defined in:
lib/slack_bot/events.rb,
lib/slack_bot/events/client.rb,
lib/slack_bot/events/version.rb,
lib/slack_bot/events/schematize.rb,
lib/slack_bot/events/configuration.rb,
lib/slack_bot/events/middleware/chain.rb,
lib/slack_bot/events/schemas/type/base.rb,
lib/slack_bot/events/schemas/type/item.rb,
lib/slack_bot/events/schemas/type/block.rb,
lib/slack_bot/events/schemas/data_payload.rb,
lib/slack_bot/events/schemas/type/element.rb,
lib/slack_bot/events/schemas/type/message.rb,
lib/slack_bot/events/schemas/authorization.rb,
lib/slack_bot/events/schemas/socket_payload.rb,
lib/slack_bot/events/middleware/event_tracer.rb,
lib/slack_bot/events/schemas/type/bot_profile.rb,
lib/slack_bot/events/middleware/message_handler.rb,
lib/slack_bot/events/schemas/type/reaction_modified.rb

Defined Under Namespace

Modules: Middleware, Schemas, Schematize Classes: Client, Configuration, Error

Constant Summary collapse

VERSION =
"0.4.4"

Class Method Summary collapse

Class Method Details

.close_middlewareObject



53
54
55
# File 'lib/slack_bot/events.rb', line 53

def self.close_middleware
  config.close_middleware
end

.configObject



20
21
22
# File 'lib/slack_bot/events.rb', line 20

def self.config
  configuration
end

.configurationObject



16
17
18
# File 'lib/slack_bot/events.rb', line 16

def self.configuration
  @configuration ||= SlackBot::Events::Configuration.new
end

.configuration=(object) ⇒ Object

Raises:



24
25
26
27
28
29
30
31
# File 'lib/slack_bot/events.rb', line 24

def self.configuration=(object)
  if SlackBot::Events::Configuration === obj
    @configuration = object
    return @configuration
  end

  raise Error, "Expected configuration to be a SlackBot::Events::Configuration"
end

.configure {|configuration| ... } ⇒ Object

Yields:



12
13
14
# File 'lib/slack_bot/events.rb', line 12

def self.configure
  yield configuration if block_given?
end

.loggerObject



41
42
43
# File 'lib/slack_bot/events.rb', line 41

def self.logger
  config.logger
end

.message_middlewareObject



45
46
47
# File 'lib/slack_bot/events.rb', line 45

def self.message_middleware
  config.message_middleware
end

.open_middlewareObject



49
50
51
# File 'lib/slack_bot/events.rb', line 49

def self.open_middleware
  config.open_middleware
end

.register_listener(name:, handler:, on_success: nil, on_failure: nil) ⇒ Object



33
34
35
# File 'lib/slack_bot/events.rb', line 33

def self.register_listener(name:, handler:, on_success: nil, on_failure: nil)
  config.register_listener(name: name, handler: handler, on_success: on_success, on_failure: on_failure)
end

.remove_listener(name:) ⇒ Object



37
38
39
# File 'lib/slack_bot/events.rb', line 37

def self.remove_listener(name:)
  config.remove_listener(name: name)
end