The code powering m.abunchtell.com https://m.abunchtell.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

31 lines
666 B

  1. # frozen_string_literal: true
  2. class Api::ProofsController < Api::BaseController
  3. before_action :set_account
  4. before_action :set_provider
  5. before_action :check_account_approval
  6. before_action :check_account_suspension
  7. def index
  8. render json: @account, serializer: @provider.serializer_class
  9. end
  10. private
  11. def set_provider
  12. @provider = ProofProvider.find(params[:provider]) || raise(ActiveRecord::RecordNotFound)
  13. end
  14. def set_account
  15. @account = Account.find_local!(params[:username])
  16. end
  17. def check_account_approval
  18. not_found if @account.user_pending?
  19. end
  20. def check_account_suspension
  21. gone if @account.suspended?
  22. end
  23. end