Class: Alexandria::BookProviders::LOCProvider
- Inherits:
-
Z3950Provider
- Object
- AbstractProvider
- Z3950Provider
- Alexandria::BookProviders::LOCProvider
- Includes:
- GetText
- Defined in:
- lib/alexandria/book_providers/loc_provider.rb
Instance Attribute Summary
Attributes inherited from AbstractProvider
Instance Method Summary collapse
-
#initialize ⇒ LOCProvider
constructor
A new instance of LOCProvider.
- #url(book) ⇒ Object
Methods inherited from Z3950Provider
#books_from_resultset, #search
Methods included from Logging
Methods inherited from AbstractProvider
#<=>, #abstract?, abstract?, #action_name, #enabled, #reinitialize, #remove, #toggle_enabled, #transport, unabstract, #variable_name
Constructor Details
#initialize ⇒ LOCProvider
Returns a new instance of LOCProvider.
18 19 20 21 22 23 24 25 26 |
# File 'lib/alexandria/book_providers/loc_provider.rb', line 18 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
28 29 30 31 32 33 34 35 |
# File 'lib/alexandria/book_providers/loc_provider.rb', line 28 def url(book) isbn = Library.canonicalise_isbn(book.isbn) "http://catalog.loc.gov/cgi-bin/Pwebrecon.cgi?" \ "DB=local&CNT=25+records+per+page&CMD=isbn+#{isbn}" rescue StandardError => ex log.warn { "Cannot create url for book #{book}; #{ex.}" } nil end |