11require 'builder' unless defined? ( Builder )
2-
32module OAI
43 module Provider
54 module Response
@@ -9,7 +8,6 @@ class Base
98
109 class << self
1110 attr_reader :valid_options , :default_options , :required_options
12-
1311 def valid_parameters ( *args )
1412 @valid_options ||= [ ]
1513 @valid_options = ( @valid_options + args . dup ) . uniq
@@ -27,23 +25,23 @@ def required_parameters(*args)
2725 end
2826
2927 end
30-
3128 def initialize ( provider , options = { } )
3229 @provider = provider
3330 @options = internalize ( options )
3431 raise OAI ::ArgumentException . new unless valid?
3532 end
36-
3733 def response
3834 @builder = Builder ::XmlMarkup . new
3935 @builder . instruct! :xml , :version => "1.0" , :encoding => "UTF-8"
4036 @builder . tag! ( 'OAI-PMH' , header ) do
4137 @builder . responseDate Time . now . utc . xmlschema
42- @builder . request ( provider . url , options )
38+ #options parameter has been removed here because with it
39+ #the data won't validate against oai validators. Without, it
40+ #validates.
41+ @builder . request ( provider . url ) #-- OAI 2.0 Hack - removed request options
4342 yield @builder
4443 end
4544 end
46-
4745 private
4846
4947 def header
@@ -54,7 +52,6 @@ def header
5452 http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd}
5553 }
5654 end
57-
5855 def extract_identifier ( id )
5956 id . sub ( "#{ provider . prefix } /" , '' )
6057 end
@@ -67,9 +64,7 @@ def valid?
6764 if self . class . required_options
6865 return false unless ( self . class . required_options - @options . keys ) . empty?
6966 end
70-
7167 return false unless ( @options . keys - self . class . valid_options ) . empty?
72-
7368 populate_defaults
7469 end
7570
@@ -95,7 +90,7 @@ def parse_date(value)
9590 return value if value . respond_to? ( :strftime )
9691
9792 Date . parse ( value ) # This will raise an exception for badly formatted dates
98- Time . parse ( value ) . utc # Sadly, this will not
93+ Time . parse ( value ) . utc # -- UTC Bug fix hack 8/08 not in core
9994 rescue
10095 raise OAI ::ArgumentError . new
10196 end
@@ -119,3 +114,4 @@ def internalize(hash = {})
119114end
120115end
121116end
117+
0 commit comments