sru 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/sru/client.rb +13 -5
  2. data/lib/sru/xpath.rb +1 -1
  3. metadata +33 -19
@@ -24,6 +24,9 @@ module SRU
24
24
  # client.scan('king tut', :maximumTerms => 12).each {|term| puts term}
25
25
 
26
26
  class Client
27
+
28
+ DEFAULT_SRU_VERSION = '1.2'
29
+
27
30
  attr_accessor :version
28
31
  # creates a client object which will automatically perform an
29
32
  # explain request to determine the version to be used in
@@ -37,9 +40,9 @@ module SRU
37
40
  begin
38
41
  require 'rubygems'
39
42
  require 'libxml'
40
- rescue
41
- raise SRU::Exception, "unknown parser: #{@parser}", caller
42
- end
43
+ rescue
44
+ raise SRU::Exception, "unknown parser: #{@parser}", caller
45
+ end
43
46
  when 'rexml'
44
47
  require 'rexml/document'
45
48
  require 'rexml/xpath'
@@ -103,8 +106,13 @@ module SRU
103
106
 
104
107
  def get_doc(hash)
105
108
  # all requests get a version
106
- hash[:version] = @version unless hash[:version]
107
-
109
+ if ! hash.has_key? :version
110
+ if defined? @version
111
+ hash[:version] = @version # value obtained from Explain operation
112
+ else
113
+ hash[:version] = DEFAULT_SRU_VERSION
114
+ end
115
+ end
108
116
 
109
117
  # don't want to monkey with the original
110
118
  uri = @server.clone
@@ -43,7 +43,7 @@ module SRU
43
43
  # figure out an attribute
44
44
  def get_attribute(node, attr_name)
45
45
  case node.class.to_s
46
- when 'REXML::XML::Element'
46
+ when 'REXML::Element'
47
47
  return node.attribute(attr_name)
48
48
  when 'LibXML::XML::Node'
49
49
  #There has been a method shift between 0.5 and 0.7
metadata CHANGED
@@ -1,25 +1,40 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sru
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
5
- prerelease: false
4
+ hash: 13
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 8
10
- version: 0.0.8
9
+ - 9
10
+ version: 0.0.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ed Summers
14
- autorequire: sru
14
+ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-11 00:00:00 -04:00
19
- default_executable:
20
- dependencies: []
18
+ date: 2012-08-07 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: libxml-ruby
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 0
31
+ version: "0"
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ description: |
35
+ Client for the Search/Retrieve via URL (SRU) protocol.
36
+ http://www.loc.gov/standards/sru/
21
37
 
22
- description:
23
38
  email: ehs@pobox.com
24
39
  executables: []
25
40
 
@@ -28,20 +43,19 @@ extensions: []
28
43
  extra_rdoc_files: []
29
44
 
30
45
  files:
31
- - lib/sru/client.rb
32
- - lib/sru/exception.rb
33
- - lib/sru/explain.rb
46
+ - lib/sru/xpath.rb
34
47
  - lib/sru/response.rb
48
+ - lib/sru/explain.rb
49
+ - lib/sru/term.rb
35
50
  - lib/sru/scan.rb
51
+ - lib/sru/client.rb
52
+ - lib/sru/exception.rb
36
53
  - lib/sru/search_retrieve.rb
37
- - lib/sru/term.rb
38
- - lib/sru/xpath.rb
39
54
  - lib/sru.rb
40
55
  - test/tc_http_client_test.rb
41
- - test/tc_libxml_client_test.rb
42
56
  - test/tc_rexml_client_test.rb
43
- has_rdoc: true
44
- homepage: http://www.textualize.com/sruby
57
+ - test/tc_libxml_client_test.rb
58
+ homepage: http://github.com/edsu/sru-ruby
45
59
  licenses: []
46
60
 
47
61
  post_install_message:
@@ -70,9 +84,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
84
  requirements: []
71
85
 
72
86
  rubyforge_project:
73
- rubygems_version: 1.3.7
87
+ rubygems_version: 1.8.15
74
88
  signing_key:
75
89
  specification_version: 3
76
- summary: a Ruby library for Search and Retrieve by URL
90
+ summary: a Ruby library for the Search/Retrieve via URL (SRU) protocol
77
91
  test_files: []
78
92