class RelatonOgc::HitCollection

Constants

ENDPOINT

ENDPOINT = “raw.githubusercontent.com/opengeospatial/”\

"NamingAuthority/master/incubation/bibliography/"\
"bibliography.json".freeze

Public Class Methods

new(code, year = nil) click to toggle source

@param code [Strig] @param year [String] @param opts [Hash]

Calls superclass method
# File lib/relaton_ogc/hit_collection.rb, line 20
def initialize(code, year = nil)
  super
  # @etagfile = File.expand_path "etag.txt", DATADIR
  # @array = from_json(ref).sort_by do |hit|
  #   hit.hit["date"] ? Date.parse(hit.hit["date"]) : Date.new
  # rescue ArgumentError
  #   Date.parse "0000-01-01"
  # end.reverse
  resp = Faraday.get "#{ENDPOINT}#{code.upcase.gsub(/[\s:.]/, '_')}.yaml"
  @array = case resp.status
           when 200
             bib = OgcBibliographicItem.from_hash YAML.safe_load(resp.body)
             [Hit.new(bib, self)]
           else []
           end
end