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



73
74
75
76
77
78
79
80
81
82
# File 'lib/geo_combine/geo_blacklight_harvester.rb', line 73

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