class EzproxyProviders::TandF

Public Class Methods

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

  data = {
      "provider" => "tandf"
  }

  if ((match = /^\/doi\/(full|pdf|abs)\/([0-9.]+\/([0-9a-z.]+))$/.match(path)))
    data['doi']    = match[2]
    data['unit_id'] = match[3]

    if (/^[0-9]{8}/.match(match[3]))
      data['print_identifier'] = match[3][0, 4] + '-' + match[3][4, 4]
      data['title_id']         = data['print_identifier']
    end

    if (match[1].upcase == 'FULL')
      data['rtype'] = 'ARTICLE'
      data['mime']  = 'HTML'
    elsif (match[1].upcase == 'PDF')
      data['rtype'] = 'ARTICLE'
      data['mime']  = 'PDF'
    elsif (match[1].upcase == 'ABS')
      data['rtype'] = 'ABS'
      data['mime']  = 'HTML'
    end
  
  elsif ((match = /^\/toc\/([a-zA-Z0-9]+)\/current$/.match(path)))
    data['rtype']    = 'TOC'
    data['mime']     = 'HTML'
    data['title_id'] = match[1]
    data['unit_id']  = match[1]
  elsif ((match = /^\/loi\/([a-zA-Z0-9]+)$/.match(path)))
    data['rtype']    = 'TOC'
    data['mime']     = 'HTML'
    data['title_id'] = match[1]
    data['unit_id']  = match[1]
  end


  return data;
end