telegram-bot-rb/telegram-bot

View on GitHub
lib/telegram/bot/updates_controller/typed_update.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

module Telegram
  module Bot
    class UpdatesController
      # Include this module to type cast update to Virtus model
      # using `telegram-bot-types` gem (install this gem first).
      module TypedUpdate
        def initialize(bot = nil, update = nil, webhook_request = nil)
          update = Types::Update.new(update) if update && !update.is_a?(Types::Update)
          super
        end
      end
    end
  end
end