Worldcat
A WorldCat API for Ruby to interact with WorldCat search webservices. www.worldcat.org
Install / Use
/learn @vivien/WorldcatREADME
= WorldCat Search API
A WorldCat API for Ruby to interact with WorldCat search webservices. http://www.worldcat.org
== Usage
require 'worldcat'
client = WorldCat.new '[api_key]'
Get Atom or RSS response from an OpenSearch
atom = client.open_search :query => "Civil War" puts atom.feed.title puts atom.entries.first.author
Get MARC XML or Dublin Core from a SRU CQL query
cql = 'srw.kw="civil war" and (srw.su="antietam" or srw.su="sharpsburg")'
records = client.sru_search :query => cql, :format => "marcxml" for record in records # print out field 245 subfield a puts record['245']['a'] end
If you'd like to use another implementation, the raw response is available:
client.raw_response
A faster way?
rss = WorldCat.new.open_search :q => "Globalization", :format => "rss", :wskey => '[api_key]'
For more information, please have a look at the documentation or the test cases.
== Installation
gem install worldcat
== Why?
The 'wcapi' gem does not satisfy several points, so another version is justified for many reasons:
- It is better to use a RSS Ruby implementation, actually SimpleRSS, to get Atom or RSS response.
- It is better to use the MARC Ruby implementation to get MARC XML or Dublin Core response from a SRU CQL search or other search.
- Unit testing is great.
== What this API can do
- Send searches in OpenSearch or SRU CQL syntax.
- Receive OpenSearch responses in RSS or Atom format (both are a SimpleRSS object).
- Receive SRU responses in an array of MARC::Record or Dublin Core (REXML::Document).
- Receive a MARC::Record for a single OCLC record.
- Receive a REXML::Document for geographically-sorted library holdings information.
- Receive a HTML formatted String for standard bibliographic citation formats (APA, Chicago, Harvard, MLA, and Turabian).
== To do
- Use SRU gem to get response from sru_search.
== Contribution
Feel free to fork and send me a pull request for changes, fixes or simply a message for any suggestion.
== See
- {WorldCat webservices}[http://www.worldcat.org/affiliate/tools?atype=wcapi]
- {Ruby MARC documentation}[http://marc.rubyforge.org/]
- {Ruby Simple RSS documentation}[http://simple-rss.rubyforge.org/]
Vivien Didelot vivien.didelot@gmail.com http://github.com/v0n/worldcat
Related Skills
node-connect
343.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
90.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
