Class: GeoCombine::GeoBlacklightHarvester::BlacklightResponseVersionFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/geo_combine/geo_blacklight_harvester.rb

Overview

A “factory” class to determine the blacklight response version to use

Class Method Summary collapse

Class Method Details

.call(json) ⇒ Object



80
81
82
83
84
85
86
87
88
89
90
# File 'lib/geo_combine/geo_blacklight_harvester.rb', line 80

def self.call(json)
  keys = json.keys
  if keys.include?('response')
    LegacyBlacklightResponse
  elsif keys.any? && %w[links data].all? { |param| keys.include?(param) }
    ModernBlacklightResponse
  else
    raise NotImplementedError,
          "The following json response was not able to be parsed by the GeoBlacklightHarvester\n#{json}"
  end
end