Class: SRU::ExplainResponse

Inherits:
Response show all
Defined in:
lib/sru/explain.rb

Instance Attribute Summary

Attributes inherited from Response

#doc, #namespaces, #parser

Instance Method Summary collapse

Methods inherited from Response

#initialize

Methods included from XPath

#get_attribute, #xpath, #xpath_all, #xpath_first

Constructor Details

This class inherits a constructor from SRU::Response

Instance Method Details

#databaseObject



19
20
21
# File 'lib/sru/explain.rb', line 19

def database
  return xpath(@doc, './/ns0:serverInfo/ns0:database', @namespaces)
end

#hostObject



9
10
11
# File 'lib/sru/explain.rb', line 9

def host
  return xpath(@doc,'.//ns0:serverInfo/ns0:host', @namespaces )
end

#number_of_recordsObject



23
24
25
# File 'lib/sru/explain.rb', line 23

def number_of_records
  return xpath(@doc, './/ns0:configInfo/ns0:numberOfRecords', @namespaces)
end

#portObject



13
14
15
16
17
# File 'lib/sru/explain.rb', line 13

def port
  port = xpath(@doc, './/ns0:serverInfo/ns0:port', @namespaces)
  return nil if not port
  return Integer(port)
end

#to_sObject



5
6
7
# File 'lib/sru/explain.rb', line 5

def to_s
  return "host=#{host} port=#{port} database=#{database} version=#{version}"
end

#versionObject



27
28
29
30
31
32
33
34
35
36
# File 'lib/sru/explain.rb', line 27

def version
  version = xpath(@doc, './/zs:version', @namespaces)
  return version if version

  # also look here 
  info = xpath(@doc, './/ns0:serverInfo', @namespaces)
  #return info.attributes['version'] if info
  return get_attribute(info, "version") if info
  return nil
end