Sha256: 444026f34887e0562a8c9189f3bdf23a8d6b6c0c9c5eb680ca0e856e8b5fb081
Contents?: true
Size: 1.67 KB
Versions: 10
Compression:
Stored size: 1.67 KB
Contents
# frozen_string_literal: true # Controller for Check Status header menu item module QaServer class FetchController < ApplicationController layout 'qa_server' class_attribute :presenter_class, :lister_class self.presenter_class = QaServer::FetchPresenter self.lister_class = QaServer::AuthorityListerService # Sets up presenter with data to display in the UI def index flash[:error] = "Authority is required." if uri? && !authority_name? @presenter = presenter_class.new(authorities_list: authorities_list, authority: authority_name, uri: uri, format: format, term_results: term_results) end private def authorities_list @authorities_list ||= lister_class.authorities_list end # @return [Qa::Authorities::LinkedData::GenericAuthority] the instance of the QA authority def authority return unless authority_name? @authority ||= QaServer::AuthorityLoaderService.load(authority_name: authority_name) end def uri? uri.present? end def uri @uri ||= params.key?(:uri) ? params[:uri] : nil end def authority_name? authority_name.present? end def authority_name @authority_name ||= params.key?(:authority) ? params[:authority].downcase : nil end def format @format ||= params.key?(:results_format) ? params[:results_format] : 'json' end def term_results return unless authority_name? && uri? @term_results = authority.find(uri, format: format) end end end
Version data entries
10 entries across 10 versions & 1 rubygems