From c28a4a55d93a0e54d232e0564fd4f66fe18d7283 Mon Sep 17 00:00:00 2001 From: Ryan Baumann Date: Tue, 23 Aug 2016 17:09:00 -0400 Subject: Guard against unset NYPL_API_TOKEN environment variable --- nypl_recrop.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nypl_recrop.rb b/nypl_recrop.rb index 304fc29..a5337ae 100755 --- a/nypl_recrop.rb +++ b/nypl_recrop.rb @@ -8,6 +8,10 @@ NYPL_API_TOKEN = ENV["NYPL_API_TOKEN"] NYPL_AUTH = "Token token=\"#{NYPL_API_TOKEN}\"" NYPL_ENDPOINT = "http://api.repo.nypl.org/api/v1/items" +if NYPL_API_TOKEN.nil? + abort("You must set an NYPL_API_TOKEN environment variable with your token from http://api.repo.nypl.org/") +end + stereo_metadata = JSON.parse(RestClient.get("http://stereo.nypl.org/view/#{ARGV[0]}.json")) unless stereo_metadata['external_id'] == 0 -- cgit v1.2.3-70-g09d2