Class: Qa::LinkedData::AuthorityService
- Inherits:
-
Object
- Object
- Qa::LinkedData::AuthorityService
- Defined in:
- lib/qa/linked_data/authority_service.rb
Class Method Summary collapse
-
.authority_config(authname) ⇒ Hash
Get the configuration for an authority.
-
.authority_configs ⇒ Array<String>
Get the list of names of the loaded authorities.
-
.authority_details ⇒ Array<String>
Get the list of names and details of the loaded authorities.
-
.authority_names ⇒ Array<String>
Get the list of names of the loaded authorities.
-
.load_authorities ⇒ Object
Load or reload the linked data configuration files.
Class Method Details
.authority_config(authname) ⇒ Hash
Get the configuration for an authority
35 36 37 |
# File 'lib/qa/linked_data/authority_service.rb', line 35 def self.(authname) [authname] end |
.authority_configs ⇒ Array<String>
Get the list of names of the loaded authorities
28 29 30 |
# File 'lib/qa/linked_data/authority_service.rb', line 28 def self. Qa.config. end |
.authority_details ⇒ Array<String>
Get the list of names and details of the loaded authorities
47 48 49 50 51 |
# File 'lib/qa/linked_data/authority_service.rb', line 47 def self. details = [] .each { |auth_name| details << Qa::Authorities::LinkedData::Config.new(auth_name). } details.flatten end |
.authority_names ⇒ Array<String>
Get the list of names of the loaded authorities
41 42 43 |
# File 'lib/qa/linked_data/authority_service.rb', line 41 def self. .keys.sort end |
.load_authorities ⇒ Object
Load or reload the linked data configuration files
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/qa/linked_data/authority_service.rb', line 6 def self. 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.(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.(fn, __FILE__)) cfg = JSON.parse(json).deep_symbolize_keys auth_cfg[auth] = cfg end Qa.config. = auth_cfg end |