Class: Api::InstitutionsController

Inherits:
ApiController
  • Object
show all
Defined in:
app/controllers/api/institutions_controller.rb

Overview

temporarily filled out but not used yet (just AggregatedController used) will have to figure out how to pass the json parameters to this controller

Instance Method Summary (collapse)

Instance Method Details

- (Object) create

creates a new institution parameters from JSON: institution shouldn't have an error if it doesn't exist not sure if we should render as json



27
28
29
30
31
32
33
34
35
36
37
38
# File 'app/controllers/api/institutions_controller.rb', line 27

def create
  Rails.logger.info(params)
  if params.has_key?(:institution)
    unless Institution.exists?(name: params[:institution])
      @institution = Institution.new_institution(params[:institution])
      if @institution != nil && @institution.save
        render json: @institution.as_json, status: :created
        return
      end
    end
  end
end

- (Object) destroy



44
45
46
# File 'app/controllers/api/institutions_controller.rb', line 44

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

- (Object) edit



19
20
21
# File 'app/controllers/api/institutions_controller.rb', line 19

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

- (Object) index



7
8
9
# File 'app/controllers/api/institutions_controller.rb', line 7

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

- (Object) new



15
16
17
# File 'app/controllers/api/institutions_controller.rb', line 15

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

- (Object) show



11
12
13
# File 'app/controllers/api/institutions_controller.rb', line 11

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

- (Object) update



40
41
42
# File 'app/controllers/api/institutions_controller.rb', line 40

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