Class: Allmaps::AnnotationsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Allmaps::AnnotationsController
- Defined in:
- app/controllers/allmaps/annotations_controller.rb
Instance Method Summary collapse
-
#fetch ⇒ Object
GET /annotations/fetch/1.json.
-
#index ⇒ Object
GET /allmaps/annotations.json.
-
#show ⇒ Object
GET /allmaps/annotations/1.json.
-
#update ⇒ Object
PATCH/PUT /allmaps/annotations/1.json.
Instance Method Details
#fetch ⇒ Object
GET /annotations/fetch/1.json
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'app/controllers/allmaps/annotations_controller.rb', line 38 def fetch # Background Job to store the Allmaps Annotation — Perform Now Blacklight::Allmaps::StoreSidecarAnnotation.perform_now(params[:id]) set_annotation respond_to do |format| format.all { render json: @annotation } end rescue Blacklight::Exceptions::RecordNotFound render json: {error: "Record not found"}, status: :not_found end |
#index ⇒ Object
GET /allmaps/annotations.json
12 13 14 15 16 17 18 |
# File 'app/controllers/allmaps/annotations_controller.rb', line 12 def index @annotations = Blacklight::Allmaps::Sidecar.order(:id).page params[:page] respond_to do |format| format.all { render json: @annotations } end end |
#show ⇒ Object
GET /allmaps/annotations/1.json
21 22 23 24 25 |
# File 'app/controllers/allmaps/annotations_controller.rb', line 21 def show respond_to do |format| format.all { render json: @annotation } end end |
#update ⇒ Object
PATCH/PUT /allmaps/annotations/1.json
28 29 30 31 32 33 34 35 |
# File 'app/controllers/allmaps/annotations_controller.rb', line 28 def update # Background Job to store the Allmaps Annotation Blacklight::Allmaps::StoreSidecarAnnotation.perform_later(@annotation.solr_document_id) respond_to do |format| format.json { render json: @annotation, status: :ok } end end |