Module: Relaton::Ccsds::Bibliography

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

Instance Method Summary collapse

Instance Method Details

#get(reference, _year = nil, opts = {}) ⇒ RelatonCcsds::BibliographicItem

Get CCSDS standard by document reference. If format is not specified, then all format will be returned.

Parameters:

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

Options Hash (opts):

  • :format (String)

    format of fetched document (DOC, PDF)

Returns:

  • (RelatonCcsds::BibliographicItem)


30
31
32
33
34
35
36
37
38
39
40
# File 'lib/relaton/ccsds/bibliography.rb', line 30

def get(reference, _year = nil, opts = {})
  ref, opts = parse_format(reference, opts)
  Util.info "Fetching from Relaton repository ...", key: reference
  item, hit = fetch_item(ref)
  if item.nil? || filter_sources(item, opts[:format])
    Util.info "Not found.", key: reference
    return nil
  end
  Util.info "Found: `#{hit[:code]}`.", key: reference
  item
end

#search(ref) ⇒ RelatonCcsds::HitCollection

Search for CCSDS standards by document reference.

Parameters:

  • ref (String)

    document reference

Returns:

  • (RelatonCcsds::HitCollection)

    collection of hits



15
16
17
# File 'lib/relaton/ccsds/bibliography.rb', line 15

def search(ref)
  HitCollection.new(ref).fetch
end