1
0
Fork 0
This repository has been archived on 2023-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
lpr-partynest/app/controllers/telegram_bot_updates_controller.rb

29 lines
647 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class TelegramBotUpdatesController < ApplicationController
2018-11-29 08:34:40 -05:00
before_action :set_telegram_bot
before_action :verify_telegram_bot_secret
2018-11-29 19:17:26 -05:00
skip_after_action :verify_authorized
# POST /telegram_bot_updates
def create
logger.info params.inspect
render status: :no_content, json: {}
end
2018-11-29 08:34:40 -05:00
private
def set_telegram_bot
@telegram_bot = TelegramBot.find params[:telegram_bot_id]
end
def verify_telegram_bot_secret
2018-11-29 19:02:04 -05:00
return if params[:secret] == @telegram_bot.secret
raise NotAuthorizedError.new query: "#{action_name}?",
record: @telegram_bot
2018-11-29 08:34:40 -05:00
end
end