Module: LexisNexis

Defined in:
lib/logstash/filters/lexisnexis.rb

Class Method Summary collapse

Class Method Details

.parse(input) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/logstash/filters/lexisnexis.rb', line 4

def LexisNexis.parse (input)
  uri = URI(URI.unescape(input))

  path = uri.path

  data = {
    "provider" => "lexisnexis"
  }

  if (/\/droit\/results\/docview\/docview/.match(path))
    if (uri.query)
      params = CGI::parse(uri.query)

      if (params["risb"])
        data["title_id"] = params["risb"][0]
        data["unit_id"] = params["risb"][0]
      end

      if (params["format"])
        case params["format"][0]
          when 'GNBFULL'
            data["rtype"] = 'ARTICLE'
            data["mime"] = 'HTML'
          when 'AUTRECAS' 
            data["rtype"] = 'ARTICLE'
            data["mime"] = 'HTML'
        end
      end
    end
  end
  
  return data
end