Module: Chem::NCBI::EInfo

Extended by:
Chem::NetUtils
Defined in:
lib/chem/utils/net.rb

Overview

EInfo

Defined Under Namespace

Classes: DbInfo

Constant Summary collapse

EInfoURI =
EUtilsURI + 'einfo.fcgi?'

Class Method Summary collapse

Methods included from Chem::NetUtils

http_get

Class Method Details

.query(params = {}) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/chem/utils/net.rb', line 40

def self.query(params = {})
  if params.empty?
    xml = REXML::Document.new(http_get(EInfoURI))
    dbs = []
    xml.elements.each("eInfoResult/DbList/DbName") do |element|
      dbs << element.text
    end
    dbs
  elsif params[:db]
    DbInfo.new(REXML::Document.new(http_get(EInfoURI + "db=" + params[:db].to_s)))
  end
end