Module: ODDB::Swissreg

Defined in:
ext/swissreg/src/writer.rb,
ext/swissreg/src/session.rb,
ext/swissreg/src/swissreg.rb,
ext/swissreg/test/test_writer.rb,
ext/swissreg/test/test_session.rb

Defined Under Namespace

Classes: DetailWriter, Session, TestSession, TestWriter

Class Method Summary (collapse)

Class Method Details

+ (Object) detail(path)



27
28
29
30
# File 'ext/swissreg/src/swissreg.rb', line 27

def Swissreg.detail(path)
  session = Session.new
  session.get_detail(path)
end

+ (Object) search(substance)



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'ext/swissreg/src/swissreg.rb', line 8

def Swissreg.search(substance)
  session = Session.new
  session.get_result_list(substance).collect { |url|
    res = {}
    retries = 2
    begin
      sleep(1)
      res = session.get_detail(url)
    rescue 
      if(retries > 0)
        retries -= 1
        retry
      else
        raise
      end
    end
    res
  }
end