Class: Alexandria::BookProviders::LOCProvider

Inherits:
Z3950Provider show all
Includes:
GetText
Defined in:
lib/alexandria/book_providers/z3950.rb

Instance Attribute Summary

Attributes inherited from AbstractProvider

#fullname, #name, #prefs

Instance Method Summary collapse

Methods inherited from Z3950Provider

#search

Methods included from Logging

included, #log

Methods inherited from AbstractProvider

#<=>, abstract?, #abstract?, #action_name, #enabled, #reinitialize, #remove, #toggle_enabled, #transport, unabstract, #variable_name

Constructor Details

#initializeLOCProvider

Returns a new instance of LOCProvider.



211
212
213
214
215
216
217
218
219
# File 'lib/alexandria/book_providers/z3950.rb', line 211

def initialize
  super('LOC', _('Library of Congress (Usa)'))
  prefs.variable_named('hostname').default_value = 'z3950.loc.gov'
  prefs.variable_named('port').default_value = 7090
  prefs.variable_named('database').default_value = 'Voyager'
  prefs.variable_named('record_syntax').default_value = 'USMARC'
  prefs.variable_named('charset').default_value = 'ISO-8859-1'
  prefs.read
end

Instance Method Details

#url(book) ⇒ Object



221
222
223
224
225
226
227
# File 'lib/alexandria/book_providers/z3950.rb', line 221

def url(book)
  'http://catalog.loc.gov/cgi-bin/Pwebrecon.cgi?DB=local&CNT=25+records+per+page&CMD=isbn+' +
    Library.canonicalise_isbn(book.isbn)
rescue => ex
  log.warn { "Cannot create url for book #{book}; #{ex.message}" }
  nil
end