apidae 0.7.3 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/MIT-LICENSE +20 -20
- data/README.rdoc +2 -2
- data/Rakefile +38 -38
- data/app/assets/images/apidae/logo-apidae-grey.svg +84 -84
- data/app/assets/javascripts/apidae/application.js +13 -13
- data/app/assets/stylesheets/apidae/application.css +15 -15
- data/app/controllers/apidae/api_controller.rb +25 -25
- data/app/controllers/apidae/application_controller.rb +6 -6
- data/app/controllers/apidae/dashboard_controller.rb +13 -13
- data/app/controllers/apidae/import_controller.rb +68 -68
- data/app/controllers/apidae/objects_controller.rb +59 -59
- data/app/controllers/apidae/projects_controller.rb +35 -35
- data/app/controllers/apidae/references_controller.rb +9 -9
- data/app/controllers/apidae/selections_controller.rb +53 -53
- data/app/helpers/apidae/api_helper.rb +4 -4
- data/app/helpers/apidae/application_helper.rb +4 -4
- data/app/helpers/apidae/dashboard_helper.rb +4 -4
- data/app/helpers/apidae/import_helper.rb +4 -4
- data/app/helpers/apidae/objects_helper.rb +4 -4
- data/app/helpers/apidae/references_helper.rb +4 -4
- data/app/helpers/apidae/selections_helper.rb +4 -4
- data/app/models/apidae/application_record.rb +5 -5
- data/app/models/apidae/export.rb +13 -13
- data/app/models/apidae/file_import.rb +161 -161
- data/app/models/apidae/obj.rb +351 -351
- data/app/models/apidae/project.rb +4 -4
- data/app/models/apidae/reference.rb +45 -45
- data/app/models/apidae/selection.rb +160 -160
- data/app/models/apidae/selection_object.rb +6 -6
- data/app/models/apidae/town.rb +28 -27
- data/app/views/apidae/dashboard/index.html.erb +41 -41
- data/app/views/apidae/import/callback.html.erb +2 -2
- data/app/views/apidae/objects/_form.html.erb +73 -73
- data/app/views/apidae/objects/edit.html.erb +6 -6
- data/app/views/apidae/objects/index.html.erb +34 -34
- data/app/views/apidae/objects/index.json.jbuilder +6 -6
- data/app/views/apidae/objects/new.html.erb +5 -5
- data/app/views/apidae/objects/show.html.erb +74 -74
- data/app/views/apidae/projects/edit.html.erb +32 -32
- data/app/views/apidae/projects/index.html.erb +34 -34
- data/app/views/apidae/references/index.html.erb +34 -34
- data/app/views/apidae/selections/_form.html.erb +29 -29
- data/app/views/apidae/selections/edit.html.erb +6 -6
- data/app/views/apidae/selections/index.html.erb +34 -34
- data/app/views/apidae/selections/new.html.erb +5 -5
- data/app/views/apidae/selections/show.html.erb +19 -19
- data/app/views/layouts/apidae/application.html.erb +14 -14
- data/config/locales/apidae.fr.yml +6 -6
- data/config/routes.rb +14 -14
- data/db/migrate/20170512212941_create_apidae_selections.rb +11 -11
- data/db/migrate/20170512214641_create_apidae_objects.rb +22 -22
- data/db/migrate/20170512221525_create_apidae_objects_apidae_selections.rb +8 -8
- data/db/migrate/20170513114002_create_apidae_towns.rb +15 -15
- data/db/migrate/20170513114409_add_town_insee_code_to_objects.rb +5 -5
- data/db/migrate/20170513115401_add_pictures_data_to_objects.rb +5 -5
- data/db/migrate/20170513121215_create_apidae_attached_files.rb +13 -13
- data/db/migrate/20170513205932_rename_objects_selections_table.rb +5 -5
- data/db/migrate/20170720161134_add_entity_data_to_objects.rb +5 -5
- data/db/migrate/20170730102424_create_apidae_file_imports.rb +13 -13
- data/db/migrate/20171025075304_create_apidae_exports.rb +15 -15
- data/db/migrate/20180217222410_create_apidae_selection_objects.rb +10 -10
- data/db/migrate/20180218172704_change_text_columns_to_json.rb +10 -10
- data/db/migrate/20180218231319_add_service_data_to_apidae_objects.rb +5 -5
- data/db/migrate/20180222104915_add_rates_data_to_apidae_objects.rb +6 -6
- data/db/migrate/20180222105302_rename_openings_to_openings_data.rb +5 -5
- data/db/migrate/20180307164936_add_attachments_data_to_apidae_objects.rb +5 -5
- data/db/migrate/20180307170349_create_apidae_references.rb +12 -12
- data/db/migrate/20180314093512_add_tags_data_to_apidae_objects.rb +5 -5
- data/db/migrate/20180314132631_add_meta_data_to_apidae_objects.rb +5 -5
- data/db/migrate/20180319143954_remove_apidae_id_unicity.rb +6 -6
- data/db/migrate/20180417164604_add_location_data_to_apidae_objects.rb +5 -5
- data/db/migrate/20180417165744_remove_address_from_apidae_objects.rb +5 -5
- data/db/migrate/20180417171344_remove_lat_lng_from_apidae_objects.rb +6 -6
- data/db/migrate/20180418141248_add_description_data_to_apidae_objects.rb +5 -5
- data/db/migrate/20180418141305_remove_desc_columns_from_apidae_objects.rb +6 -6
- data/db/migrate/20180424141656_add_meta_data_to_apidae_references.rb +5 -5
- data/db/migrate/20180519170210_remove_insee_code_unicity.rb +7 -7
- data/db/migrate/20180521211735_destroy_attached_files.rb +5 -5
- data/db/migrate/20180625050400_rename_objects_to_obj.rb +5 -5
- data/db/migrate/20181024072424_add_project_id_to_selections.rb +5 -5
- data/db/migrate/20181024072843_create_apidae_projects.rb +10 -10
- data/db/migrate/20190328122424_add_description_to_apidae_towns.rb +5 -0
- data/lib/apidae.rb +4 -4
- data/lib/apidae/engine.rb +10 -10
- data/lib/apidae/version.rb +3 -3
- data/lib/tasks/apidae_tasks.rake +4 -4
- data/test/apidae_test.rb +7 -7
- data/test/controllers/apidae/api_controller_test.rb +23 -23
- data/test/controllers/apidae/dashboard_controller_test.rb +15 -15
- data/test/controllers/apidae/import_controller_test.rb +15 -15
- data/test/controllers/apidae/objects_controller_test.rb +52 -52
- data/test/controllers/apidae/references_controller_test.rb +13 -13
- data/test/controllers/apidae/selections_controller_test.rb +52 -52
- data/test/data/selections.json +14 -14
- data/test/data/structure.json +64 -64
- data/test/data/update_selections.json +18 -18
- data/test/dummy/README.rdoc +28 -28
- data/test/dummy/Rakefile +6 -6
- data/test/dummy/app/assets/javascripts/application.js +13 -13
- data/test/dummy/app/assets/stylesheets/application.css +15 -15
- data/test/dummy/app/controllers/application_controller.rb +5 -5
- data/test/dummy/app/helpers/application_helper.rb +2 -2
- data/test/dummy/app/views/layouts/application.html.erb +14 -14
- data/test/dummy/bin/bundle +3 -3
- data/test/dummy/bin/rails +4 -4
- data/test/dummy/bin/rake +4 -4
- data/test/dummy/bin/setup +29 -29
- data/test/dummy/config.ru +4 -4
- data/test/dummy/config/application.rb +24 -24
- data/test/dummy/config/boot.rb +5 -5
- data/test/dummy/config/database.yml +20 -20
- data/test/dummy/config/environment.rb +5 -5
- data/test/dummy/config/environments/development.rb +41 -41
- data/test/dummy/config/environments/production.rb +79 -79
- data/test/dummy/config/environments/test.rb +42 -42
- data/test/dummy/config/initializers/apidae.rb +18 -18
- data/test/dummy/config/initializers/assets.rb +11 -11
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -7
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -3
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -4
- data/test/dummy/config/initializers/inflections.rb +16 -16
- data/test/dummy/config/initializers/mime_types.rb +4 -4
- data/test/dummy/config/initializers/session_store.rb +3 -3
- data/test/dummy/config/initializers/to_time_preserves_timezone.rb +10 -10
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -14
- data/test/dummy/config/locales/en.yml +23 -23
- data/test/dummy/config/routes.rb +4 -4
- data/test/dummy/config/secrets.yml +22 -22
- data/test/dummy/db/schema.rb +104 -104
- data/test/dummy/public/404.html +67 -67
- data/test/dummy/public/422.html +67 -67
- data/test/dummy/public/500.html +66 -66
- data/test/fixtures/apidae/exports.yml +15 -15
- data/test/fixtures/apidae/objects.yml +33 -33
- data/test/fixtures/apidae/references.yml +11 -11
- data/test/fixtures/apidae/selection_objects.yml +9 -9
- data/test/fixtures/apidae/selections.yml +11 -11
- data/test/fixtures/apidae/towns.yml +15 -15
- data/test/integration/navigation_test.rb +8 -8
- data/test/models/apidae/export_test.rb +9 -9
- data/test/models/apidae/file_import_test.rb +88 -88
- data/test/models/apidae/object_test.rb +9 -9
- data/test/models/apidae/reference_test.rb +9 -9
- data/test/models/apidae/selection_object_test.rb +9 -9
- data/test/models/apidae/selection_test.rb +9 -9
- data/test/models/apidae/town_test.rb +9 -9
- data/test/test_helper.rb +22 -22
- metadata +49 -50
- data/test/dummy/log/test.log +0 -2109
@@ -1,68 +1,68 @@
|
|
1
|
-
require_dependency "apidae/application_controller"
|
2
|
-
require 'uri'
|
3
|
-
require 'net/http'
|
4
|
-
|
5
|
-
module Apidae
|
6
|
-
class ImportController < ApplicationController
|
7
|
-
skip_before_action :verify_authenticity_token
|
8
|
-
skip_before_action Rails.application.config.apidae_auth
|
9
|
-
|
10
|
-
# Callback endpoint for Apidae exports
|
11
|
-
#
|
12
|
-
# projetId : un entier. C’est l’identifiant du projet concerné.
|
13
|
-
# statut : une chaine de caractères, ‘SUCCESS’ ou ‘ERROR’. C’est l’issue de l’export.
|
14
|
-
# ponctuel : un booléen. Indique si l’export est ponctuel (true) ou périodique (false).
|
15
|
-
# reinitialisation : un booléen. Indique si l’export est une réinitialisation (true) ou différentiel (false).
|
16
|
-
# urlRecuperation : une chaine de caractères. L’URL de récupération du fichier d’export.
|
17
|
-
# urlConfirmation : une chaine de caractères. L’URL de confirmation.
|
18
|
-
def callback
|
19
|
-
export = Export.new(project_id: params[:projetId], remote_status: params[:statut], oneshot: params[:ponctuel] == 'true',
|
20
|
-
reset: params[:reinitialisation] == 'true', file_url: params[:urlRecuperation],
|
21
|
-
confirm_url: params[:urlConfirmation], status: Export::PENDING)
|
22
|
-
if export.save
|
23
|
-
if Rails.application.config.respond_to?(:apidae_propagate_callback)
|
24
|
-
uri = URI(Rails.application.config.apidae_propagate_callback)
|
25
|
-
req = Net::HTTP::Post.new(uri)
|
26
|
-
Net::HTTP.start(uri.hostname, uri.port, use_ssl: (uri.scheme == "https")) do |http|
|
27
|
-
http.request(req, params.to_unsafe_h.to_query)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
head :ok
|
31
|
-
else
|
32
|
-
head :internal_server_error
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def run
|
37
|
-
success = true
|
38
|
-
Export.pending.each do |e|
|
39
|
-
begin
|
40
|
-
open(e.file_url) do |f|
|
41
|
-
begin
|
42
|
-
FileImport.import(f, e.project_id)
|
43
|
-
uri = URI(e.confirm_url)
|
44
|
-
req = Net::HTTP::Post.new(uri)
|
45
|
-
Net::HTTP.start(uri.hostname, uri.port) do |http|
|
46
|
-
http.request(req)
|
47
|
-
end
|
48
|
-
e.update(status: Export::COMPLETE)
|
49
|
-
if Rails.application.config.apidae_import_callback
|
50
|
-
Rails.application.config.apidae_import_callback.call(e)
|
51
|
-
end
|
52
|
-
rescue Exception => ex
|
53
|
-
logger.error("Failed to import export file : #{e.file_url}")
|
54
|
-
logger.error("Error is : #{ex} \n#{ex.backtrace.join("\n") unless ex.backtrace.blank?}")
|
55
|
-
success = false
|
56
|
-
end
|
57
|
-
end
|
58
|
-
rescue OpenURI::HTTPError => err
|
59
|
-
logger.error("Failed to download export file : #{e.file_url}")
|
60
|
-
logger.error("Error is : #{err}")
|
61
|
-
success = false
|
62
|
-
e.update(status: Export::CANCELLED)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
success ? head(:ok) : head(:internal_server_error)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
1
|
+
require_dependency "apidae/application_controller"
|
2
|
+
require 'uri'
|
3
|
+
require 'net/http'
|
4
|
+
|
5
|
+
module Apidae
|
6
|
+
class ImportController < ApplicationController
|
7
|
+
skip_before_action :verify_authenticity_token
|
8
|
+
skip_before_action Rails.application.config.apidae_auth
|
9
|
+
|
10
|
+
# Callback endpoint for Apidae exports
|
11
|
+
#
|
12
|
+
# projetId : un entier. C’est l’identifiant du projet concerné.
|
13
|
+
# statut : une chaine de caractères, ‘SUCCESS’ ou ‘ERROR’. C’est l’issue de l’export.
|
14
|
+
# ponctuel : un booléen. Indique si l’export est ponctuel (true) ou périodique (false).
|
15
|
+
# reinitialisation : un booléen. Indique si l’export est une réinitialisation (true) ou différentiel (false).
|
16
|
+
# urlRecuperation : une chaine de caractères. L’URL de récupération du fichier d’export.
|
17
|
+
# urlConfirmation : une chaine de caractères. L’URL de confirmation.
|
18
|
+
def callback
|
19
|
+
export = Export.new(project_id: params[:projetId], remote_status: params[:statut], oneshot: params[:ponctuel] == 'true',
|
20
|
+
reset: params[:reinitialisation] == 'true', file_url: params[:urlRecuperation],
|
21
|
+
confirm_url: params[:urlConfirmation], status: Export::PENDING)
|
22
|
+
if export.save
|
23
|
+
if Rails.application.config.respond_to?(:apidae_propagate_callback)
|
24
|
+
uri = URI(Rails.application.config.apidae_propagate_callback)
|
25
|
+
req = Net::HTTP::Post.new(uri)
|
26
|
+
Net::HTTP.start(uri.hostname, uri.port, use_ssl: (uri.scheme == "https")) do |http|
|
27
|
+
http.request(req, params.to_unsafe_h.to_query)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
head :ok
|
31
|
+
else
|
32
|
+
head :internal_server_error
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def run
|
37
|
+
success = true
|
38
|
+
Export.pending.each do |e|
|
39
|
+
begin
|
40
|
+
open(e.file_url) do |f|
|
41
|
+
begin
|
42
|
+
FileImport.import(f, e.project_id)
|
43
|
+
uri = URI(e.confirm_url)
|
44
|
+
req = Net::HTTP::Post.new(uri)
|
45
|
+
Net::HTTP.start(uri.hostname, uri.port) do |http|
|
46
|
+
http.request(req)
|
47
|
+
end
|
48
|
+
e.update(status: Export::COMPLETE)
|
49
|
+
if Rails.application.config.apidae_import_callback
|
50
|
+
Rails.application.config.apidae_import_callback.call(e)
|
51
|
+
end
|
52
|
+
rescue Exception => ex
|
53
|
+
logger.error("Failed to import export file : #{e.file_url}")
|
54
|
+
logger.error("Error is : #{ex} \n#{ex.backtrace.join("\n") unless ex.backtrace.blank?}")
|
55
|
+
success = false
|
56
|
+
end
|
57
|
+
end
|
58
|
+
rescue OpenURI::HTTPError => err
|
59
|
+
logger.error("Failed to download export file : #{e.file_url}")
|
60
|
+
logger.error("Error is : #{err}")
|
61
|
+
success = false
|
62
|
+
e.update(status: Export::CANCELLED)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
success ? head(:ok) : head(:internal_server_error)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -1,59 +1,59 @@
|
|
1
|
-
require_dependency "apidae/application_controller"
|
2
|
-
|
3
|
-
module Apidae
|
4
|
-
class ObjectsController < ApplicationController
|
5
|
-
before_action :set_object, only: [:show, :edit, :update, :destroy]
|
6
|
-
skip_before_action Rails.application.config.apidae_auth, only: [:index, :show]
|
7
|
-
|
8
|
-
def index
|
9
|
-
if params[:selection_id]
|
10
|
-
@selection = Selection.find(params[:selection_id])
|
11
|
-
@objects = @selection.objects.select(:id, :apidae_id, :title, :apidae_type, :updated_at)
|
12
|
-
else
|
13
|
-
@objects = Obj.all.select(:id, :apidae_id, :title, :apidae_type, :updated_at)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def show
|
18
|
-
end
|
19
|
-
|
20
|
-
def new
|
21
|
-
@object = Obj.new
|
22
|
-
end
|
23
|
-
|
24
|
-
def edit
|
25
|
-
end
|
26
|
-
|
27
|
-
def create
|
28
|
-
@object = Obj.new(object_params)
|
29
|
-
|
30
|
-
if @object.save
|
31
|
-
redirect_to @object, notice: 'Object was successfully created.'
|
32
|
-
else
|
33
|
-
render :new
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def update
|
38
|
-
if @object.update(object_params)
|
39
|
-
redirect_to @object, notice: 'Object was successfully updated.'
|
40
|
-
else
|
41
|
-
render :edit
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def destroy
|
46
|
-
@object.destroy
|
47
|
-
redirect_to objects_url, notice: 'Object was successfully destroyed.'
|
48
|
-
end
|
49
|
-
|
50
|
-
private
|
51
|
-
def set_object
|
52
|
-
@object = Obj.find(params[:id])
|
53
|
-
end
|
54
|
-
|
55
|
-
def object_params
|
56
|
-
params.require(:object).permit!
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
1
|
+
require_dependency "apidae/application_controller"
|
2
|
+
|
3
|
+
module Apidae
|
4
|
+
class ObjectsController < ApplicationController
|
5
|
+
before_action :set_object, only: [:show, :edit, :update, :destroy]
|
6
|
+
skip_before_action Rails.application.config.apidae_auth, only: [:index, :show]
|
7
|
+
|
8
|
+
def index
|
9
|
+
if params[:selection_id]
|
10
|
+
@selection = Selection.find(params[:selection_id])
|
11
|
+
@objects = @selection.objects.select(:id, :apidae_id, :title, :apidae_type, :updated_at)
|
12
|
+
else
|
13
|
+
@objects = Obj.all.select(:id, :apidae_id, :title, :apidae_type, :updated_at)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def show
|
18
|
+
end
|
19
|
+
|
20
|
+
def new
|
21
|
+
@object = Obj.new
|
22
|
+
end
|
23
|
+
|
24
|
+
def edit
|
25
|
+
end
|
26
|
+
|
27
|
+
def create
|
28
|
+
@object = Obj.new(object_params)
|
29
|
+
|
30
|
+
if @object.save
|
31
|
+
redirect_to @object, notice: 'Object was successfully created.'
|
32
|
+
else
|
33
|
+
render :new
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def update
|
38
|
+
if @object.update(object_params)
|
39
|
+
redirect_to @object, notice: 'Object was successfully updated.'
|
40
|
+
else
|
41
|
+
render :edit
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def destroy
|
46
|
+
@object.destroy
|
47
|
+
redirect_to objects_url, notice: 'Object was successfully destroyed.'
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
def set_object
|
52
|
+
@object = Obj.find(params[:id])
|
53
|
+
end
|
54
|
+
|
55
|
+
def object_params
|
56
|
+
params.require(:object).permit!
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -1,35 +1,35 @@
|
|
1
|
-
require_dependency "apidae/application_controller"
|
2
|
-
|
3
|
-
module Apidae
|
4
|
-
class ProjectsController < ApplicationController
|
5
|
-
before_action :set_project, only: [:edit, :update]
|
6
|
-
|
7
|
-
def index
|
8
|
-
@projects = Project.all
|
9
|
-
end
|
10
|
-
|
11
|
-
def edit
|
12
|
-
session[:referrer] = request.referrer
|
13
|
-
end
|
14
|
-
|
15
|
-
def update
|
16
|
-
if @project.update(project_params)
|
17
|
-
referrer = session.delete(:referrer)
|
18
|
-
redirect_to referrer, notice: 'Le projet a bien été mis à jour'
|
19
|
-
else
|
20
|
-
flash.now[:alert] = "Une erreur s'est produite lors la mise à jour du projet"
|
21
|
-
render :edit
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
private
|
26
|
-
|
27
|
-
def set_project
|
28
|
-
@project = Project.find(params[:id])
|
29
|
-
end
|
30
|
-
|
31
|
-
def project_params
|
32
|
-
params.require(:project).permit(:name, :api_key)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
1
|
+
require_dependency "apidae/application_controller"
|
2
|
+
|
3
|
+
module Apidae
|
4
|
+
class ProjectsController < ApplicationController
|
5
|
+
before_action :set_project, only: [:edit, :update]
|
6
|
+
|
7
|
+
def index
|
8
|
+
@projects = Project.all
|
9
|
+
end
|
10
|
+
|
11
|
+
def edit
|
12
|
+
session[:referrer] = request.referrer
|
13
|
+
end
|
14
|
+
|
15
|
+
def update
|
16
|
+
if @project.update(project_params)
|
17
|
+
referrer = session.delete(:referrer)
|
18
|
+
redirect_to referrer, notice: 'Le projet a bien été mis à jour'
|
19
|
+
else
|
20
|
+
flash.now[:alert] = "Une erreur s'est produite lors la mise à jour du projet"
|
21
|
+
render :edit
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def set_project
|
28
|
+
@project = Project.find(params[:id])
|
29
|
+
end
|
30
|
+
|
31
|
+
def project_params
|
32
|
+
params.require(:project).permit(:name, :api_key)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
require_dependency "apidae/application_controller"
|
2
|
-
|
3
|
-
module Apidae
|
4
|
-
class ReferencesController < ApplicationController
|
5
|
-
def index
|
6
|
-
@references = Reference.all
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
1
|
+
require_dependency "apidae/application_controller"
|
2
|
+
|
3
|
+
module Apidae
|
4
|
+
class ReferencesController < ApplicationController
|
5
|
+
def index
|
6
|
+
@references = Reference.all
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
@@ -1,53 +1,53 @@
|
|
1
|
-
require_dependency "apidae/application_controller"
|
2
|
-
|
3
|
-
module Apidae
|
4
|
-
class SelectionsController < ApplicationController
|
5
|
-
before_action :set_selection, only: [:show, :edit, :update, :destroy]
|
6
|
-
|
7
|
-
def index
|
8
|
-
@selections = Selection.all
|
9
|
-
end
|
10
|
-
|
11
|
-
def show
|
12
|
-
end
|
13
|
-
|
14
|
-
def new
|
15
|
-
@selection = Selection.new
|
16
|
-
end
|
17
|
-
|
18
|
-
def edit
|
19
|
-
end
|
20
|
-
|
21
|
-
def create
|
22
|
-
@selection = Selection.new(selection_params)
|
23
|
-
|
24
|
-
if @selection.save
|
25
|
-
redirect_to @selection, notice: 'Selection was successfully created.'
|
26
|
-
else
|
27
|
-
render :new
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def update
|
32
|
-
if @selection.update(selection_params)
|
33
|
-
redirect_to @selection, notice: 'Selection was successfully updated.'
|
34
|
-
else
|
35
|
-
render :edit
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def destroy
|
40
|
-
@selection.destroy
|
41
|
-
redirect_to selections_url, notice: 'Selection was successfully destroyed.'
|
42
|
-
end
|
43
|
-
|
44
|
-
private
|
45
|
-
def set_selection
|
46
|
-
@selection = Selection.find(params[:id])
|
47
|
-
end
|
48
|
-
|
49
|
-
def selection_params
|
50
|
-
params.require(:selection).permit(:label, :reference, :apidae_id)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
1
|
+
require_dependency "apidae/application_controller"
|
2
|
+
|
3
|
+
module Apidae
|
4
|
+
class SelectionsController < ApplicationController
|
5
|
+
before_action :set_selection, only: [:show, :edit, :update, :destroy]
|
6
|
+
|
7
|
+
def index
|
8
|
+
@selections = Selection.all
|
9
|
+
end
|
10
|
+
|
11
|
+
def show
|
12
|
+
end
|
13
|
+
|
14
|
+
def new
|
15
|
+
@selection = Selection.new
|
16
|
+
end
|
17
|
+
|
18
|
+
def edit
|
19
|
+
end
|
20
|
+
|
21
|
+
def create
|
22
|
+
@selection = Selection.new(selection_params)
|
23
|
+
|
24
|
+
if @selection.save
|
25
|
+
redirect_to @selection, notice: 'Selection was successfully created.'
|
26
|
+
else
|
27
|
+
render :new
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def update
|
32
|
+
if @selection.update(selection_params)
|
33
|
+
redirect_to @selection, notice: 'Selection was successfully updated.'
|
34
|
+
else
|
35
|
+
render :edit
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def destroy
|
40
|
+
@selection.destroy
|
41
|
+
redirect_to selections_url, notice: 'Selection was successfully destroyed.'
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
def set_selection
|
46
|
+
@selection = Selection.find(params[:id])
|
47
|
+
end
|
48
|
+
|
49
|
+
def selection_params
|
50
|
+
params.require(:selection).permit(:label, :reference, :apidae_id)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|