Class: NetworkController

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

Overview

Common parts for working with Comunit network

Instance Method Summary collapse

Instance Method Details

#amendObject

put /comunit/:table_name/:id/amend



40
41
42
43
44
45
46
# File 'app/controllers/network_controller.rb', line 40

def amend
  if @handler.amend(params[:id])
    head :no_content
  else
    head :unprocessable_entity
  end
end

#createObject

post /network/



10
11
12
13
14
15
16
17
18
# File 'app/controllers/network_controller.rb', line 10

def create
  @handler.data = params.require(:data).permit!
  @entity = @handler.create_local
  if @entity.persisted?
    render :show, status: :created
  else
    render 'shared/forms/check', status: :bad_request
  end
end

#pullObject

put /comunit/:table_name/:uuid



31
32
33
34
35
36
37
# File 'app/controllers/network_controller.rb', line 31

def pull
  if @handler.pull(params[:uuid])
    head :no_content
  else
    head :unprocessable_entity
  end
end

#updateObject

patch /network//:id



21
22
23
24
25
26
27
28
# File 'app/controllers/network_controller.rb', line 21

def update
  @handler.data = params.require(:data).permit!
  if @handler.update_local
    head :no_content
  else
    head :bad_request
  end
end