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_bots/updates_controller.rb
2018-12-07 07:43:30 +05:00

28 lines
668 B
Ruby

# frozen_string_literal: true
class TelegramBots::UpdatesController < ApplicationController
before_action :set_telegram_bot
before_action :verify_telegram_bot_secret
skip_after_action :verify_authorized
# POST /telegram_bots/:telegram_bot_id/updates
def create
logger.info params.inspect
render status: :no_content, json: {}
end
private
def set_telegram_bot
@telegram_bot = TelegramBot.find params[:telegram_bot_id]
end
def verify_telegram_bot_secret
return if params[:secret] == @telegram_bot.secret
raise NotAuthorizedError.new query: "#{action_name}?",
record: @telegram_bot
end
end