Class: RelatonOgc::HitCollection

Inherits:
RelatonBib::HitCollection
  • Object
show all
Defined in:
lib/relaton_ogc/hit_collection.rb

Constant Summary collapse

ENDPOINT =
"https://raw.githubusercontent.com/opengeospatial/"\
"NamingAuthority/master/incubation/bibliography/bibliography.json".freeze
DATADIR =
File.expand_path ".relaton/ogc/", Dir.home
DATAFILE =
File.expand_path "bibliography.json", DATADIR
ETAGFILE =
File.expand_path "etag.txt", DATADIR

Instance Method Summary collapse

Constructor Details

#initialize(ref, year = nil, _opts = {}) ⇒ HitCollection

Returns a new instance of HitCollection.

Parameters:

  • ref (Strig)
  • year (String) (defaults to: nil)
  • opts (Hash)


16
17
18
19
20
21
22
23
24
# File 'lib/relaton_ogc/hit_collection.rb', line 16

def initialize(ref, year = nil, _opts = {})
  @text = ref
  @year = year
  @fetched = false
  hits = from_json(ref).sort_by do |hit|
    hit.hit["date"] ? Date.parse(hit.hit["date"]) : Date.new
  end
  concat hits.reverse
end