Class: QaServer::AuthorityLoaderService

Inherits:
Object
  • Object
show all
Defined in:
app/services/qa_server/authority_loader_service.rb

Class Method Summary collapse

Class Method Details

.load(authority_name:, status_log:) ⇒ Qa::Authorities::LinkedData::GenericAuthority

Load a QA authority

Parameters:

  • authority_name (String)

    name of the authority to load (e.g. “agrovoc_direct”)

  • status_log (ScenarioLogger)

    logger to hold failure information if the authority cannot be loaded

Returns:

  • (Qa::Authorities::LinkedData::GenericAuthority)

    the instance of the authority that can receive QA requests OR nil if fails to load



9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/services/qa_server/authority_loader_service.rb', line 9

def self.load(authority_name:, status_log:)
  begin
    authority = load_authority(authority_name, status_log)
    return nil if authority.blank?
  rescue Exception => e
    status_log.add(authority_name: authority_name,
                   status: QaServer::ScenarioValidator::FAIL,
                   error_message: "Unable to load authority '#{authority_name}'; cause: #{e.message}")
    return nil
  end
  authority
end