Sha256: 1158f2d383fce5e899a41a163f985308e270aeff70402ab7d5f9f39ac4e2982e

Contents?: true

Size: 632 Bytes

Versions: 12

Compression:

Stored size: 632 Bytes

Contents

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)
        [200, {}, ['']]
      end

      def inspect
        "#<#{self.class.name}(#{controller.try!(:name)})>"
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
telegram-bot-0.15.7 lib/telegram/bot/middleware.rb
telegram-bot-0.15.6 lib/telegram/bot/middleware.rb
telegram-bot-0.15.4 lib/telegram/bot/middleware.rb
telegram-bot-0.15.3 lib/telegram/bot/middleware.rb
telegram-bot-0.15.2 lib/telegram/bot/middleware.rb
telegram-bot-0.15.1 lib/telegram/bot/middleware.rb
telegram-bot-0.15.0 lib/telegram/bot/middleware.rb
telegram-bot-0.14.4 lib/telegram/bot/middleware.rb
telegram-bot-0.14.3 lib/telegram/bot/middleware.rb
telegram-bot-0.14.2 lib/telegram/bot/middleware.rb
telegram-bot-0.14.1 lib/telegram/bot/middleware.rb
telegram-bot-0.14.0 lib/telegram/bot/middleware.rb