Module: RelatonCalconnect::Scrapper

Defined in:
lib/relaton_calconnect/scrapper.rb

Constant Summary collapse

DOMAIN =
"https://standards.calconnect.org/".freeze

Class Method Summary collapse

Class Method Details

.parse_page(hit) ⇒ RelatonOgc::OrcBibliographicItem

papam hit [Hash]

Returns:

  • (RelatonOgc::OrcBibliographicItem)


10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/relaton_calconnect/scrapper.rb', line 10

def parse_page(hit)
  links = array(hit["link"])
  link = links.detect { |l| l["type"] == "rxl" }
  if link
    bib = fetch_bib_xml link["content"]
    update_links bib, links
    # XMLParser.from_xml bib_xml
  else
    bib = RelatonCalconnect::CcBibliographicItem.from_hash doc_to_hash(hit)
  end
  bib.link.each { |l| l.content.merge!(scheme: SCHEME, host: HOST) unless l.content.host }
  bib
end