class Qa::LinkedData::AuthorityService

Public Class Methods

authority_config(authname) click to toggle source

Get the configuration for an authority @param [String] name of the authority @return [Hash] configuration for the specified authority

# File lib/qa/linked_data/authority_service.rb, line 35
def self.authority_config(authname)
  authority_configs[authname]
end
authority_configs() click to toggle source

Get the list of names of the loaded authorities @return [Array<String>] all loaded authority configurations

# File lib/qa/linked_data/authority_service.rb, line 28
def self.authority_configs
  Qa.config.linked_data_authority_configs
end
authority_details() click to toggle source

Get the list of names and details of the loaded authorities @return [Array<String>] names of the authority config files that are currently loaded

# File lib/qa/linked_data/authority_service.rb, line 47
def self.authority_details
  details = []
  authority_names.each { |auth_name| details << Qa::Authorities::LinkedData::Config.new(auth_name).authority_info }
  details.flatten
end
authority_names() click to toggle source

Get the list of names of the loaded authorities @return [Array<String>] names of the authority config files that are currently loaded

# File lib/qa/linked_data/authority_service.rb, line 41
def self.authority_names
  authority_configs.keys.sort
end
load_authorities() click to toggle source

Load or reload the linked data configuration files

# File lib/qa/linked_data/authority_service.rb, line 6
def self.load_authorities
  auth_cfg = {}
  # load QA configured linked data authorities
  Dir[File.join(Qa::Engine.root, 'config', 'authorities', 'linked_data', '*.json')].each do |fn|
    auth = File.basename(fn, '.json').upcase.to_sym
    json = File.read(File.expand_path(fn, __FILE__))
    cfg = JSON.parse(json).deep_symbolize_keys
    auth_cfg[auth] = cfg
  end

  # load app configured linked data authorities and overrides
  Dir[Rails.root.join('config', 'authorities', 'linked_data', '*.json')].each do |fn|
    auth = File.basename(fn, '.json').upcase.to_sym
    json = File.read(File.expand_path(fn, __FILE__))
    cfg = JSON.parse(json).deep_symbolize_keys
    auth_cfg[auth] = cfg
  end
  Qa.config.linked_data_authority_configs = auth_cfg
end