11module OAI ::Provider
22 # = OAI::Provider::Model
33 #
4- # Model implementers should subclass OAI::Provider::Model and override
4+ # Model implementers should subclass OAI::Provider::Model and override
55 # Model#earliest, Model#latest, and Model#find. Optionally Model#sets and
6- # Model#deleted? can be used to support sets and record deletions. It
7- # is also the responsibility of the model implementer to account for
8- # resumption tokens if support is required. Models that don't support
9- # resumption tokens should raise an exception if a limit is requested
6+ # Model#deleted? can be used to support sets and record deletions. It
7+ # is also the responsibility of the model implementer to account for
8+ # resumption tokens if support is required. Models that don't support
9+ # resumption tokens should raise an exception if a limit is requested
1010 # during initialization.
1111 #
1212 # earliest - should return the earliest update time in the repository.
1313 # latest - should return the most recent update time in the repository.
1414 # sets - should return an array of sets supported by the repository.
1515 # deleted? - individual records returned should respond true or false
1616 # when sent the deleted? message.
17- # available_formats - if overridden, individual records should return an
18- # array of prefixes for all formats in which that record is available,
17+ # available_formats - if overridden, individual records should return an
18+ # array of prefixes for all formats in which that record is available,
1919 # if other than ["oai_dc"]
2020 # about - if overridden, should return a String or Array of XML Strings to
2121 # insert into the OAI Record <about> chunks.
@@ -28,10 +28,9 @@ module OAI::Provider
2828 # There are several helper models for dealing with resumption tokens please
2929 # see the ResumptionToken class for more details.
3030 #
31-
3231 class Model
3332 attr_reader :timestamp_field
34-
33+
3534 def initialize ( limit = nil , timestamp_field = 'updated_at' )
3635 @limit = limit
3736 @timestamp_field = timestamp_field
@@ -41,16 +40,16 @@ def initialize(limit = nil, timestamp_field = 'updated_at')
4140 def earliest
4241 raise NotImplementedError . new
4342 end
44-
43+
4544 # should return the latest timestamp available from this model.
4645 def latest
4746 raise NotImplementedError . new
4847 end
49-
48+
5049 def sets
5150 nil
5251 end
53-
52+
5453 # find is the core method of a model, it returns records from the model
5554 # bases on the parameters passed in.
5655 #
@@ -61,12 +60,12 @@ def sets
6160 # * :from => earliest timestamp to be included in the results
6261 # * :until => latest timestamp to be included in the results
6362 # * :set => the set from which to retrieve the results
64- # * :metadata_prefix => type of metadata requested (this may be useful if
63+ # * :metadata_prefix => type of metadata requested (this may be useful if
6564 # not all records are available in all formats)
6665 def find ( selector , options = { } )
6766 raise NotImplementedError . new
6867 end
69-
68+
7069 def deleted?
7170 false
7271 end
@@ -76,5 +75,5 @@ def about record
7675 nil
7776 end
7877 end
79-
78+
8079end
0 commit comments