Class: Qa::Authorities::LinkedData::FindTerm
- Inherits:
-
Object
- Object
- Qa::Authorities::LinkedData::FindTerm
- Defined in:
- lib/qa/authorities/linked_data/find_term.rb
Instance Attribute Summary collapse
-
#term_config ⇒ Object
readonly
Returns the value of attribute term_config.
Instance Method Summary collapse
-
#find(id, request_header: {}, language: nil, replacements: {}, subauth: nil, format: 'json', performance_data: false) ⇒ Hash, String
Find a single term in a linked data authority.
-
#initialize(term_config) ⇒ FindTerm
constructor
A new instance of FindTerm.
Constructor Details
#initialize(term_config) ⇒ FindTerm
Returns a new instance of FindTerm.
14 15 16 |
# File 'lib/qa/authorities/linked_data/find_term.rb', line 14 def initialize(term_config) @term_config = term_config end |
Instance Attribute Details
#term_config ⇒ Object (readonly)
Returns the value of attribute term_config.
18 19 20 |
# File 'lib/qa/authorities/linked_data/find_term.rb', line 18 def term_config @term_config end |
Instance Method Details
#find(id, request_header: {}, language: nil, replacements: {}, subauth: nil, format: 'json', performance_data: false) ⇒ Hash, String
Note:
All parameters after request_header are deprecated and will be removed in the next major release.
Find a single term in a linked data authority
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/qa/authorities/linked_data/find_term.rb', line 46 def find(id, request_header: {}, language: nil, replacements: {}, subauth: nil, format: 'json', performance_data: false) # rubocop:disable Metrics/ParameterLists request_header = build_request_header(language: language, replacements: replacements, subauth: subauth, format: format, performance_data: performance_data) if request_header.empty? unpack_request_header(request_header) raise Qa::InvalidLinkedDataAuthority, "Unable to initialize linked data term sub-authority #{}" unless .nil? || () @id = id url = .build_url(action_config: term_config, action: :term, action_request: normalize_id, request_header: request_header) Rails.logger.info "QA Linked Data term url: #{url}" load_graph(url: url) normalize_results end |