Class: RelatonIso::Hit
- Inherits:
-
RelatonBib::Hit
- Object
- RelatonBib::Hit
- RelatonIso::Hit
- Defined in:
- lib/relaton_iso/hit.rb
Overview
Hit.
Instance Attribute Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#fetch(_lang = nil) ⇒ RelatonIso::IsoBibliographicItem
Parse page.
22 23 24 25 26 27 28 29 30 |
# File 'lib/relaton_iso/hit.rb', line 22 def fetch(_lang = nil) @fetch ||= begin url = "#{HitCollection::ENDPOINT}#{hit[:file]}" resp = Net::HTTP.get_response URI(url) hash = YAML.safe_load resp.body hash["fetched"] = Date.today.to_s RelatonIsoBib::IsoBibliographicItem.from_hash hash end end |
#pubid ⇒ Pubid::Iso::Identifier
44 45 46 47 48 49 50 51 |
# File 'lib/relaton_iso/hit.rb', line 44 def pubid return @pubid if defined? @pubid create_pubid hit[:id] rescue StandardError Util.warn "Unable to create an identifier from #{hit[:id]}" @pubid = nil end |
Instance Method Details
#sort_weight ⇒ Integer
33 34 35 36 37 38 39 40 41 |
# File 'lib/relaton_iso/hit.rb', line 33 def sort_weight case hit[:status] # && hit["publicationStatus"]["key"] when "Published" then 0 when "Under development" then 1 when "Withdrawn" then 2 when "Deleted" then 3 else 4 end end |