Repository navigation
Expand file tree
/
Copy pathtest.rb
More file actions
52 lines (39 loc) · 1.52 KB
/
Copy pathtest.rb
File metadata and controls
52 lines (39 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
require 'rubygems'
require 'wcapi'
client = WCAPI::Client.new :wskey => 'PYNtMxToldTvjQdsCUPqph5WPv2jnXX4IICzKZmILTHZRQ42JslUTz7Q6ngC4P1UVEkpyZ9XHbIGlfMX'
response = client.OpenSearch(:q=>'building digital libraries', :format=>'atom', :start => '1', :count => '25', :cformat => 'all')
puts "Total Results: " + response.header["totalResults"]
response.records.each {|rec|
puts "Title: " + rec[:title] + "\n"
puts "URL: " + rec[:link] + "\n"
puts "Authors: " + rec[:author].join(" ") + "\n"
puts "OCLC #: " + rec[:id] + "\n"
puts "Description: " + rec[:summary] + "\n"
puts "citation: " + rec[:citation] + "\n"
}
puts "\n\n\n"
puts "Get Record Test: " + "\n\n"
record = client.GetRecord(:type => "oclc", :id => "15550774")
puts record.record[:title] + "\n"
puts record.record[:link] + "\n"
puts "\n\n\n"
puts "Get Location Test: " + "\n\n"
info = client.GetLocations(:type=>"oclc", :id => "15550774")
info.institutions.each {|info|
puts "Institutional Identifier: " + info[:institutionIdentifier] + "\n"
puts "OPAC Link: " + info[:link] + "\n"
puts "Copies: " + info[:copies] + "\n\n\n"
}
puts "\n\n\n"
puts "Citation Example: " + "\n\n"
citation = client.GetCitation(:type=>"oclc", :id=>"15550774", :cformat => 'all')
puts citation
puts "\n\n"
puts "\n\n\n"
puts "SRU Search Example: " + "\n\n"
records = client.SRUSearch(:query => "civil war")
puts "Total Records: " + records.header["numberOfRecords"] + "\n"
records.records.each {|rec|
puts "Title: " + rec[:title] + "\n"
puts "URL: " + rec[:link] + "\n\n\n"
}