lib/collectionspace/mapper/term_searchable.rb
# returns specified data type (:csid or :refname) for searched term
# @param val [String] termDisplayName value to search for
# @param return_type [Symbol<:csid, :refname>] 
returns specified data type (:csid or :refname) for searched term
returns specified data type ( : csid or : refname ) for searched term
def searched_term(val, return_type, termtype = type, termsubtype = subtype)
        response = searcher.call(
          value: val,
          type: termtype,
          subtype: termsubtype
        )
        return nil unless response
        rec = rec_from_response('term', val, response)
        return nil unless rec
        values = {refname: rec['refName'], csid: rec['csid']}
        @cache.put(termtype, termsubtype, val, values[:refname])
        @csid_cache.put(termtype, termsubtype, val, values[:csid])
        values[return_type]
      end
def searched_term ( val , return_type , termtype = type , termsubtype = subtype ) response = searcher . call ( value : val , type : termtype , subtype : termsubtype ) return nil unless response rec = rec_from_response ( 'term' , val , response ) return nil unless rec values = { refname : rec [ 'refName' ] , csid : rec [ 'csid' ] } @cache . put ( termtype , termsubtype , val , values [ :refname ] ) @csid_cache . put ( termtype , termsubtype , val , values [ :csid ] ) values [ return_type ] end
returns specified data type (:csid or :refname) for searched term
returns specified data type ( : csid or : refname ) for searched term
val
termDisplayName value to search for
termDisplayName value to search for
return_type
termtype
type
termsubtype
subtype
None