Class: RelatonUn::UnBibliography
- Inherits:
-
Object
- Object
- RelatonUn::UnBibliography
- Defined in:
- lib/relaton_un/un_bibliography.rb
Overview
Class methods for search ISO standards.
Class Method Summary collapse
- .get(ref, _year = nil, _opts = {}) ⇒ RelatonUn::UnBibliographicItem
- .search(text) ⇒ RelatonUn::HitCollection
Class Method Details
.get(ref, _year = nil, _opts = {}) ⇒ RelatonUn::UnBibliographicItem
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/relaton_un/un_bibliography.rb', line 23 def get(ref, _year = nil, _opts = {}) Util.info "Fetching from documents.un.org ...", key: ref /^(?:UN\s)?(?<code>.*)/ =~ ref result = isobib_search_filter(code) if result Util.info "Found: `#{result.fetch.docidentifier[0].id}`", key: ref result.fetch else Util.info "Not found.", key: ref nil end end |
.search(text) ⇒ RelatonUn::HitCollection
9 10 11 12 13 14 15 16 17 |
# File 'lib/relaton_un/un_bibliography.rb', line 9 def search(text) HitCollection.new text rescue SocketError, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError, Net::ReadTimeout, Net::OpenTimeout, OpenSSL::SSL::SSLError, Errno::ETIMEDOUT => e raise RelatonBib::RequestError, "Could not access #{HitCollection::DOMAIN}: #{e.}" end |