Module: Relaton::Ogc::Bibliography

Extended by:
Bibliography
Included in:
Bibliography
Defined in:
lib/relaton/ogc/bibliography.rb

Instance Method Summary collapse

Instance Method Details

#get(code, year = nil, opts = {}) ⇒ Relaton::Ogc::ItemData?

Parameters:

  • code (String)
  • year (String, nil) (defaults to: nil)
  • opts (Hash) (defaults to: {})

Returns:



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

Parameters:

  • text (String)
  • year (String, nil) (defaults to: nil)

Returns:



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