Class: RelatonBsi::BsiBibliography
- Inherits:
-
Object
- Object
- RelatonBsi::BsiBibliography
- Defined in:
- lib/relaton_bsi/bsi_bibliography.rb
Overview
Class methods for search ISO standards.
Class Method Summary collapse
-
.get(code, year = nil, opts = {}) ⇒ String
Relaton XML serialisation of reference.
- .search(text, year = nil) ⇒ RelatonBsi::HitCollection
Class Method Details
.get(code, year = nil, opts = {}) ⇒ String
Returns Relaton XML serialisation of reference.
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/relaton_bsi/bsi_bibliography.rb', line 35 def get(code, year = nil, opts = {}) # y = code.split(":")[1] year ||= code_parts(code)[:year] ret = bib_get1(code, year, opts) return nil if ret.nil? ret = ret.to_most_recent_reference unless year || opts[:keep_year] # ret = ret.to_all_parts if opts[:all_parts] ret end |
.search(text, year = nil) ⇒ RelatonBsi::HitCollection
18 19 20 21 22 23 24 25 |
# File 'lib/relaton_bsi/bsi_bibliography.rb', line 18 def search(text, year = nil) code = text.sub(/^BSI\s/, "") HitCollection.new code, year rescue SocketError, Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError, Algolia::AlgoliaUnreachableHostError => e raise RelatonBib::RequestError, e. end |