Sha256: 2942db2492f69906c33af0a7f7af4a10593bc904961c799ab91a214fbc145db1

Contents?: true

Size: 823 Bytes

Versions: 5

Compression:

Stored size: 823 Bytes

Contents

# frozen_string_literal: true

module SlackRubyBotServer
  module Events
    module Api
      module Endpoints
        module Slack
          class EventsEndpoint < Grape::API
            desc 'Handle Slack events.'
            params do
              requires :token, type: String
              requires :type, type: String
              optional :challenge, type: String
            end
            post '/event' do
              event = SlackRubyBotServer::Events::Requests::Event.new(params, request)
              type = event[:type]
              event_type = event[:event][:type] if event.key?(:event)
              key = [type, event_type].compact
              SlackRubyBotServer::Events.config.run_callbacks(:event, key, event) || body(false)
            end
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
slack-ruby-bot-server-events-0.3.2 lib/slack-ruby-bot-server-events/api/endpoints/slack/events_endpoint.rb
slack-ruby-bot-server-events-0.3.1 lib/slack-ruby-bot-server-events/api/endpoints/slack/events_endpoint.rb
slack-ruby-bot-server-events-0.3.0 lib/slack-ruby-bot-server-events/api/endpoints/slack/events_endpoint.rb
slack-ruby-bot-server-events-0.2.0 lib/slack-ruby-bot-server-events/api/endpoints/slack/events_endpoint.rb
slack-ruby-bot-server-events-0.1.0 lib/slack-ruby-bot-server-events/api/endpoints/slack/events_endpoint.rb