Skip to content

Commit d56e675

Browse files
author
Bess Sadler
committed
Clarified example code
1 parent 848fa5d commit d56e675

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

lib/oai/client/response.rb

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,17 @@ module OAI
22

33
# An OAI::Response contains entries and a resumption token. If a resumption token is present,
44
# 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"
5+
# # List all records in a given set
6+
# client = OAI::Client.new 'http://my-oai-provider.example.com/oai'
7+
# response = client.list_records :set => 'my_set_name'
8+
# while response.entries.count > 0
9+
# response.entries.each { |entry|
10+
# puts entry.header.identifier
11+
# }
12+
# token = response.resumption_token
13+
# # Note: You do not need to pass the options hash again, just the verb and the resumption token
14+
# response = client.list_records :resumption_token => token if token
15+
# end
2116

2217
class Response
2318
include OAI::XPath

0 commit comments

Comments
 (0)