Class: Doi::Search

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

Class Method Summary collapse

Class Method Details

.by_number(number) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/doi.rb', line 6

def self.by_number number
    uri=URI("http://dx.doi.org/#{number}" )
    res = Net::HTTP.get(uri)
    body = res
    match =/"(.*)"/.match(body)
    match = match[1..-1]
    if "-//W3C//DTD HTML 4.01 Transitional//EN" == match[0]
        return nil
    else
    return  match[0]
    end
    
end