Module: Classifoclc

Defined in:
lib/classifoclc.rb,
lib/classifoclc/work.rb,
lib/classifoclc/author.rb,
lib/classifoclc/errors.rb,
lib/classifoclc/edition.rb,
lib/classifoclc/version.rb,
lib/classifoclc/constants.rb,
lib/classifoclc/recommendations.rb

Overview

Interface to OCLC’s Classify service, “a FRBR-based prototype designed to support the assignment of classification numbers and subject headings for books, DVDs, CDs, and other types of materials.”

See Also:

Defined Under Namespace

Modules: Id, Order, OrderBy Classes: Author, BadIdentifierError, BadIdentifierFormatError, Edition, InfiniteLoopError, Recommendations, UnexpectedError, Work

Constant Summary collapse

VERSION =
"1.0.0"
URL =
"http://classify.oclc.org/classify2/Classify?%s"
@@maxRecs =

Number of records returned per request

25

Class Method Summary collapse

Class Method Details

.author(auth, hsh = {}) ⇒ Enumerator<Classifoclc::Work>

Find works by author



73
74
75
# File 'lib/classifoclc.rb', line 73

def self.author(auth, hsh = {})
  lookup(default_options(hsh, {:identifier => Id::AUTHOR, :value  => auth}))
end

.authorAndTitle(author, title, hsh = {}) ⇒ Enumerator<Classifoclc::Work>

Find works by author and title



90
91
92
# File 'lib/classifoclc.rb', line 90

def self.authorAndTitle(author, title, hsh = {})
  lookup(default_options(hsh, {:identifier => [Id::AUTHOR, Id::TITLE], :value => [author, title], :summary => false}))
end

.fast(ident, hsh = {}) ⇒ Enumerator<Classifoclc::Work>

Find works by FAST subject heading



99
100
101
# File 'lib/classifoclc.rb', line 99

def self.fast(ident, hsh = {})
  lookup(default_options(hsh, {:identifier => Id::IDENT, :value  => ident}))
end

.fetch_data(hsh) ⇒ Object



196
197
198
199
200
# File 'lib/classifoclc.rb', line 196

def self.fetch_data(hsh)
  resp = open(URL % param_string(hsh.clone), "User-Agent" => "Classifoclc/#{Classifoclc::VERSION}",).read
  parsed = Nokogiri::XML(resp)
  return parsed
end

.isbn(isbn, hsh = {}) ⇒ Enumerator<Classifoclc::Work>

Find works by ISBN number



41
42
43
# File 'lib/classifoclc.rb', line 41

def self.isbn(isbn, hsh = {})
  lookup(default_options(hsh, {:identifier => Id::ISBN, :value  => isbn}))
end

.lccn(lccn, hsh = {}) ⇒ Enumerator<Classifoclc::Work>

Find works by Library of Congress Control Number



65
66
67
# File 'lib/classifoclc.rb', line 65

def self.lccn(lccn, hsh = {})
  lookup(default_options(hsh, {:identifier => Id::LCCN, :value  => lccn}))
end

.maxRecsNumeric .maxRecs=(value) ⇒ Numeric

Overloads:

  • .maxRecsNumeric

    Get the max records per request

  • .maxRecs=(value) ⇒ Numeric

    Set the max records



29
30
31
# File 'lib/classifoclc.rb', line 29

def self.maxRecs
  @@maxRecs
end

.maxRecs=(m) ⇒ Object



33
34
35
# File 'lib/classifoclc.rb', line 33

def self.maxRecs= m
  @@maxRecs = m
end

.oclc(oclc, hsh = {}) ⇒ Enumerator<Classifoclc::Work>

Find works by OCLC number



57
58
59
# File 'lib/classifoclc.rb', line 57

def self.oclc(oclc, hsh = {})
  lookup(default_options(hsh, {:identifier => Id::OCLC, :value  => oclc}))
end

.owi(owi, hsh = {}) ⇒ Enumerator<Classifoclc::Work>

Find works by OCLC work ID



49
50
51
# File 'lib/classifoclc.rb', line 49

def self.owi(owi, hsh = {})
  lookup(default_options(hsh, {:identifier => Id::OWI, :value  => owi, :summary => false}))
end

.title(title, hsh = {}) ⇒ Enumerator<Classifoclc::Work>

Find works by title



81
82
83
# File 'lib/classifoclc.rb', line 81

def self.title(title, hsh = {})
  lookup(default_options(hsh, {:identifier => Id::TITLE, :value  => title}))
end