Class: Api::VerificationController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/api/verification_controller.rb

Overview

This controller needs administrator token to access. it is repsonsible for calling Notifier or Deleter to appropriately deal with the information verification story.

Author:

Instance Method Summary (collapse)

Instance Method Details

- (Object) create



25
26
27
# File 'app/controllers/api/verification_controller.rb', line 25

def create
  render json: {warning: 'not implemented'}, status: 200
end

- (Object) destroy

this is the endpoint for rejecting new entries into the database



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'app/controllers/api/verification_controller.rb', line 58

def destroy
  if params.has_key?(:user)
    @res = Deleter.delete_user(params[:user])
    render :json => @res.to_json
    return
  elsif params.has_key?(:admin)
    @res = Deleter.delete_admin(params[:admin])
    render :json => @res.to_json
    return
  elsif params.has_key?(:mentorship)
    @res = Deleter.delete_mentorship(params[:mentorship])
    render :json => @res.to_json
    return
  elsif params.has_key?(:supervision)
    @res = Deleter.delete_supervision(params[:supervision])
    render :json => @res.to_json
    return
  elsif params.has_key?(:person)
    @res = Deleter.delete_person(params[:person])
    render :json => @res.to_json
    return
  else
    render json: { errors: ['missing parameter'] }, status: :bad_request
  end
end

- (Object) edit



21
22
23
# File 'app/controllers/api/verification_controller.rb', line 21

def edit
  render json: {warning: 'not implemented'}, status: 200
end

- (Object) index



9
10
11
# File 'app/controllers/api/verification_controller.rb', line 9

def index
  render json: {warning: 'not implemented'}, status: 200
end

- (Object) new



17
18
19
# File 'app/controllers/api/verification_controller.rb', line 17

def new
  render json: {warning: 'not implemented'}, status: 200
end

- (Object) show



13
14
15
# File 'app/controllers/api/verification_controller.rb', line 13

def show
  render json: {warning: 'not implemented'}, status: 200
end

- (Object) update

this is the endpoint for all types of information verification (approval) TODO:should check for multiple parameters



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'app/controllers/api/verification_controller.rb', line 31

def update
  if params.has_key?(:user)
    @res = Verifier.verify_user(params[:user])
    render :json => @res.to_json
    return
  elsif params.has_key?(:admin)
    @res = Verifier.verify_admin(params[:admin])
    render :json => @res.to_json
    return
  elsif params.has_key?(:mentorship)
    @res = Verifier.verify_mentorship(params[:mentorship])
    render :json => @res.to_json
    return
  elsif params.has_key?(:supervision)
    @res = Verifier.verify_supervision(params[:supervision])
    render :json => @res.to_json
    return
  elsif params.has_key?(:person)
    @res = Verifier.verify_person(params[:person])
    render :json => @res.to_json
    return
  else
    render json: { errors: ['missing parameter'] }, status: :bad_request
  end
end