class EzproxyProviders::Scopus

Public Class Methods

parse(path, params) click to toggle source
# File lib/logstash/filters/ezproxy_providers/scopus.rb, line 4
def self.parse (path, params)

  data = {
    "provider" => "scopus"
  }

  if (/^\/results\/citedbyresults.ur[il]$/i.match(path))
    data['mime']   = 'HTML'
    data['rtype']  = 'REF'
    data['unit_id'] = params['cite'][0]

  elsif (match = /^\/record\/([a-z]+)\.ur[il]$/i.match(path))
    case (match[1])
    when 'display'
      data['mime']   = 'HTML'
      data['rtype']  = 'ABS'
      data['unit_id'] = params['eid'][0]
      
    when 'references'
      data['mime']   = 'HTML'
      data['rtype']  = 'REF'
      data['unit_id'] = params['currentRecordPageEID'][0]
      
    when 'detail'
      data['mime']  = 'HTML'
      data['rtype'] = 'BIO'
      if (params.key?('authorId'))
        data['unit_id'] = params['authorId'][0]
      end
      
    when 'pdfdownload'
      data['rtype']  = 'REF'
      data['mime']   = 'PDF'
      data['unit_id'] = params['eid'][0]
    end
  
  elsif (/^\/authid\/detail\.ur[il]$/i.match(path))
    data['mime']  = 'HTML'
    data['rtype'] = 'BIO'
    if (params.key?('authorId'))
      data['unit_id'] = params['authorId'][0]
    end
  
  elsif (/^\/citation\/print\.ur[il]$/i.match(path))
    data['mime']  = 'PRINT'
    data['rtype'] = 'REF'
    if (params.key?('eid'))
      data['unit_id'] = params['eid'][0]
    end
  end
  
  return data

end