Class: Relaton::Iso::Hit

Inherits:
Core::Hit
  • Object
show all
Defined in:
lib/relaton/iso/hit.rb

Overview

Hit.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#itemRelaton::Iso::ItemData

Parse page.



15
16
17
18
19
20
21
22
23
# File 'lib/relaton/iso/hit.rb', line 15

def item
  @item ||= begin
    url = "#{HitCollection::ENDPOINT}#{hit[:file]}"
    resp = Net::HTTP.get_response URI(url)
    item = Item.from_yaml resp.body
    item.fetched = ::Date.today.to_s
    item
  end
end

#pubidPubid::Iso::Identifier

Returns:

  • (Pubid::Iso::Identifier)


37
38
39
40
41
42
43
44
# File 'lib/relaton/iso/hit.rb', line 37

def pubid
  return @pubid if defined? @pubid

  @pubid = create_pubid hit[:id]
rescue StandardError
  Util.warn "Unable to create an identifier from #{hit[:id]}"
  @pubid = nil
end

Instance Method Details

#sort_weightInteger

Returns:

  • (Integer)


26
27
28
29
30
31
32
33
34
# File 'lib/relaton/iso/hit.rb', line 26

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