class EzproxyProviders::DawsonEra

Public Class Methods

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

  data = {
      "provider" => "dawsonera"
  }

  if (match = /^(\/abstract\/([0-9]+))$/.match(path))
    data['rtype']             = 'ABS'
    data['mime']              = 'MISC'
    data['online_identifier'] = match[2]
    data['unit_id']           = match[1]

  elsif (match = /^(\/readonline\/([0-9]+))$/.match(path))
    data['rtype']             = 'BOOK'
    data['mime']              = 'MISC'
    data['online_identifier'] = match[2]
    data['unit_id']            = match[1]

  elsif ((match = /^(\/download\/drm\/[0-9]+\/([0-9]+))$/.match(path)))
    data['rtype']             = 'BOOK'
    data['mime']              = 'PDF'
    data['online_identifier'] = match[2]
    data['unit_id']            = match[1]
  end

  return data;
end