1
1
module OAI ::Provider
2
2
# = OAI::Provider::Model
3
3
#
4
- # Model implementers should subclass OAI::Provider::Model and override
4
+ # Model implementers should subclass OAI::Provider::Model and override
5
5
# 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
10
10
# during initialization.
11
11
#
12
12
# earliest - should return the earliest update time in the repository.
13
13
# latest - should return the most recent update time in the repository.
14
14
# sets - should return an array of sets supported by the repository.
15
15
# deleted? - individual records returned should respond true or false
16
16
# 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,
19
19
# if other than ["oai_dc"]
20
20
# about - if overridden, should return a String or Array of XML Strings to
21
21
# insert into the OAI Record <about> chunks.
@@ -28,10 +28,9 @@ module OAI::Provider
28
28
# There are several helper models for dealing with resumption tokens please
29
29
# see the ResumptionToken class for more details.
30
30
#
31
-
32
31
class Model
33
32
attr_reader :timestamp_field
34
-
33
+
35
34
def initialize ( limit = nil , timestamp_field = 'updated_at' )
36
35
@limit = limit
37
36
@timestamp_field = timestamp_field
@@ -41,16 +40,16 @@ def initialize(limit = nil, timestamp_field = 'updated_at')
41
40
def earliest
42
41
raise NotImplementedError . new
43
42
end
44
-
43
+
45
44
# should return the latest timestamp available from this model.
46
45
def latest
47
46
raise NotImplementedError . new
48
47
end
49
-
48
+
50
49
def sets
51
50
nil
52
51
end
53
-
52
+
54
53
# find is the core method of a model, it returns records from the model
55
54
# bases on the parameters passed in.
56
55
#
@@ -61,12 +60,12 @@ def sets
61
60
# * :from => earliest timestamp to be included in the results
62
61
# * :until => latest timestamp to be included in the results
63
62
# * :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
65
64
# not all records are available in all formats)
66
65
def find ( selector , options = { } )
67
66
raise NotImplementedError . new
68
67
end
69
-
68
+
70
69
def deleted?
71
70
false
72
71
end
@@ -76,5 +75,5 @@ def about record
76
75
nil
77
76
end
78
77
end
79
-
78
+
80
79
end
0 commit comments