Class: Relaton::Un::Bibliography
- Inherits:
-
Object
- Object
- Relaton::Un::Bibliography
- Defined in:
- lib/relaton/un/bibliography.rb
Overview
Class methods for search UN standards.
Class Method Summary collapse
- .get(ref, _year = nil, _opts = {}) ⇒ Relaton::Bib::ItemData
- .search(text) ⇒ Relaton::Un::HitCollection
Class Method Details
.get(ref, _year = nil, _opts = {}) ⇒ Relaton::Bib::ItemData
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/relaton/un/bibliography.rb', line 22 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.item.docidentifier[0].content}`", key: ref result.item else Util.info "Not found.", key: ref nil end end |
.search(text) ⇒ Relaton::Un::HitCollection
10 11 12 13 14 15 16 |
# File 'lib/relaton/un/bibliography.rb', line 10 def search(text) HitCollection.search text rescue Faraday::ConnectionFailed, Faraday::TimeoutError, Faraday::SSLError => e raise Relaton::RequestError, "Could not access #{HitCollection::API_BASE}: #{e.}" end |