Class: Tasks::Sources::NewSourceController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Tasks::Sources::NewSourceController
- Includes:
- TaskControllerConfiguration
- Defined in:
- app/controllers/tasks/sources/new_source_controller.rb
Instance Method Summary collapse
- #citation_param ⇒ Object protected
-
#crossref_preview ⇒ Object
GET /sources/new_source/crossref_preview.json.
- #index ⇒ Object
Methods included from TaskControllerConfiguration
Instance Method Details
#citation_param ⇒ Object (protected)
26 27 28 29 30 31 32 |
# File 'app/controllers/tasks/sources/new_source_controller.rb', line 26 def citation_param begin params.require(:citation) rescue ActionController::ParameterMissing nil end end |
#crossref_preview ⇒ Object
GET /sources/new_source/crossref_preview.json
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/tasks/sources/new_source_controller.rb', line 8 def crossref_preview if citation_param.blank? render json: :invalid_request else @source = Vendor::Serrano.new_from_citation(citation: citation_param) @source ||= Source::Bibtex.new render '/sources/show' end rescue Vendor::Serrano::CrossrefBibtexParseError => e render json: { error: 'Crossref returned BibTeX that could not be parsed.', doi: e.doi, bibtex: e.bibtex }, status: :unprocessable_content end |
#index ⇒ Object
4 5 |
# File 'app/controllers/tasks/sources/new_source_controller.rb', line 4 def index end |