зеркало из
https://github.com/glebtv/telegram-bot.git
synced 2026-08-28 15:26:18 +03:00
* Update rubopcop [WIP] * Further rubocop fixes * Fix rubocop-rails cops * Fix spec * Disable rubocop suggestions * Run rubocop in github actions rather than in codeclimate
31 строка
666 B
Ruby
31 строка
666 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'active_support/concern'
|
|
require 'active_support/core_ext/hash/indifferent_access'
|
|
require 'active_support/json'
|
|
require 'action_dispatch'
|
|
|
|
module Telegram
|
|
module Bot
|
|
class Middleware
|
|
attr_reader :bot, :controller
|
|
|
|
def initialize(bot, controller)
|
|
@bot = bot
|
|
@controller = controller
|
|
end
|
|
|
|
def call(env)
|
|
request = ActionDispatch::Request.new(env)
|
|
update = request.request_parameters
|
|
controller.dispatch(bot, update, request)
|
|
[200, {}, ['']]
|
|
end
|
|
|
|
def inspect
|
|
"#<#{self.class.name}(#{controller&.name})>"
|
|
end
|
|
end
|
|
end
|
|
end
|