Module: Relaton::Ogc::Bibliography
Instance Method Summary collapse
- #get(code, year = nil, opts = {}) ⇒ Relaton::Ogc::ItemData?
- #search(text, year = nil, _opts = {}) ⇒ Relaton::Ogc::HitCollection
Instance Method Details
#get(code, year = nil, opts = {}) ⇒ Relaton::Ogc::ItemData?
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/relaton/ogc/bibliography.rb', line 20 def get(code, year = nil, opts = {}) result = bib_search_filter(code, year, opts) || (return nil) ret = bib_results_filter(result, year) if ret[:ret] Util.info "Found: `#{ret[:ret].docidentifier.first.content}`", key: code ret[:ret] else fetch_ref_err(code, year, ret[:years]) end end |
#search(text, year = nil, _opts = {}) ⇒ Relaton::Ogc::HitCollection
9 10 11 12 13 14 |
# File 'lib/relaton/ogc/bibliography.rb', line 9 def search(text, year = nil, _opts = {}) code = text.sub(/^OGC\s/, "") HitCollection.new(code, year).find rescue Faraday::ConnectionFailed, Faraday::SSLError raise Relaton::RequestError, HitCollection::ENDPOINT end |