Class: PdfExtract::Resolve::FreeCite

Inherits:
Object
  • Object
show all
Defined in:
lib/references/resolve.rb

Class Method Summary collapse

Class Method Details

.find(ref) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/references/resolve.rb', line 33

def self.find ref
  Net::HTTP.start "freecite.library.brown.edu" do |http|
    r = http.post "/citations/create", "citation=#{ref}",
                  "Accept" => "text/xml"
    doc = Nokogiri::XML r.body

    {
      :title => doc.at_xpath("//title").content,
      :journal => doc.at_xpath("//journal").content,
      :pages => doc.at_xpath("//pages").content,
      :year => doc.at_xpath("//year").content
    }
  end
end