The code powering m.abunchtell.com https://m.abunchtell.com
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 

29 líneas
723 B

  1. class Api::SubscriptionsController < ApiController
  2. before_action :set_account
  3. def show
  4. if @account.subscription(api_subscription_url(@account.id)).valid?(params['hub.topic'], params['hub.verify_token'])
  5. render text: params['hub.challenge'], status: 200
  6. else
  7. render nothing: true, status: 404
  8. end
  9. end
  10. def update
  11. body = request.body.read
  12. if @account.subscription(api_subscription_url(@account.id)).verify(body, request.headers['HTTP_X_HUB_SIGNATURE'])
  13. ProcessFeedService.new.(body, @account)
  14. render nothing: true, status: 201
  15. else
  16. render nothing: true, status: 202
  17. end
  18. end
  19. private
  20. def set_account
  21. @account = Account.find(params[:id])
  22. end
  23. end