Module: Relaton::Ietf::Bibliography

Defined in:
lib/relaton/ietf/bibliography.rb

Overview

IETF bibliography module

Class Method Summary collapse

Class Method Details

.get(code, _year = nil, _opts = {}) ⇒ RelatonIetf::IetfBibliographicItem

Returns Relaton of reference.

Parameters:

  • code (String)

    the ISO standard Code to look up (e..g “ISO 9000”)

  • year (String)

    the year the standard was published (optional)

  • opts (Hash)

    options; restricted to :all_parts if all-parts reference is required

Returns:

  • (RelatonIetf::IetfBibliographicItem)

    Relaton of reference



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/relaton/ietf/bibliography.rb', line 21

def get(code, _year = nil, _opts = {})
  Util.info "Fetching from Relaton repository ...", key: code
  result = search code
  if result
    docid = result.docidentifier.detect(&:primary) || result.docidentifier.first
    Util.info "Found: `#{docid.content}`", key: code
  else
    Util.info "Not found.", key: code
  end
  result
end

.search(text) ⇒ RelatonIetf::IetfBibliographicItem

Parameters:

  • code (String)

    the ISO standard Code to look up (e..g “ISO 9000”)

Returns:

  • (RelatonIetf::IetfBibliographicItem)


12
13
14
# File 'lib/relaton/ietf/bibliography.rb', line 12

def search(text)
  Scraper.scrape_page text
end