Class: Qa::Authorities::Mesh
- Inherits:
-
Object
- Object
- Qa::Authorities::Mesh
- Extended by:
- Deprecation
- Defined in:
- lib/qa/authorities/mesh.rb
Instance Method Summary collapse
- #full_record(id) ⇒ Object
- #get_full_record(id) ⇒ Object
-
#parse_authority_response ⇒ Object
satisfy TermsController.
- #results ⇒ Object
- #search(q, sub_authority = nil) ⇒ Object
Instance Method Details
#full_record(id) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/qa/authorities/mesh.rb', line 16 def full_record(id) @results ||= begin r = Qa::SubjectMeshTerm.where(term_id: id).limit(1).first r.nil? ? nil : {id: r.term_id, label: r.term, synonyms: r.synonyms} end end |
#get_full_record(id) ⇒ Object
23 24 25 26 |
# File 'lib/qa/authorities/mesh.rb', line 23 def get_full_record(id) Deprecation.warn(Mesh, "get_full_record is deprecated and will be removed in 0.1.0. Use full_record instead", caller) full_record(id) end |
#parse_authority_response ⇒ Object
satisfy TermsController
29 30 |
# File 'lib/qa/authorities/mesh.rb', line 29 def end |
#results ⇒ Object
5 6 7 8 9 10 |
# File 'lib/qa/authorities/mesh.rb', line 5 def results @results ||= begin r = Qa::SubjectMeshTerm.where('term_lower LIKE ?', "#{@q}%").limit(10) r.map { |t| {id: t.term_id, label: t.term} } end end |
#search(q, sub_authority = nil) ⇒ Object
12 13 14 |
# File 'lib/qa/authorities/mesh.rb', line 12 def search(q, =nil) @q = q end |