Skip to content

Commit 35d4834

Browse files
committed
Merge pull request #5 from bess/master
Added code example to demo resumption tokens
2 parents 1498c10 + f1ce4d9 commit 35d4834

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

lib/oai/client.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def initialize(base_url, options={})
9898

9999
# Equivalent to a Identify request. You'll get back a OAI::IdentifyResponse
100100
# object which is essentially just a wrapper around a REXML::Document
101-
# for the response. If you are created your client using the libxml
101+
# for the response. If you created your client using the libxml
102102
# parser then you will get an XML::Node object instead.
103103

104104
def identify

lib/oai/client/response.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,24 @@
11
module OAI
2+
3+
# An OAI::Response contains entries and a resumption token. If a resumption token is present,
4+
# then you must use it to fetch the rest of the entries for your query. For example:
5+
# # List all records
6+
# i = 1
7+
# begin
8+
# response = client.list_records
9+
# while response.entries.size > 0
10+
# response.entries.each { |entry|
11+
# puts "<b>#{i}</b> #{entry.header.identifier}<br/>"
12+
# i +=1
13+
# }
14+
# token = response.resumption_token
15+
# response = client.list_records :resumption_token => token if token
16+
# end
17+
# rescue OAI::Exception => e
18+
# puts 'No records to process'
19+
# end
20+
# puts "Done processing #{i} records"
21+
222
class Response
323
include OAI::XPath
424
attr_reader :doc, :resumption_token

0 commit comments

Comments
 (0)