Module: MetThumbnailFetcher

Defined in:
lib/met_thumbnail_fetcher.rb

Overview

Grab a thumbnail URL from the Met web service

Class Method Summary collapse

Class Method Details

.fetch(ident) ⇒ Object


8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/met_thumbnail_fetcher.rb', line 8

def self.fetch(ident)
  image_json = make_request(ident)

  return if image_json.blank?

  unless image_json['results']
    # Some records have null results
    DLME::Utils.logger.warn "No results found in #{ident}\n#{image_json}"
    return
  end
  # Some records e.g. 321624, return empty results
  result = image_json['results'].first
  result['webImageUrl'] if result
end