summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Baumann <ryan.baumann@gmail.com>2016-08-23 17:09:00 -0400
committerRyan Baumann <ryan.baumann@gmail.com>2016-08-23 17:09:00 -0400
commitc28a4a55d93a0e54d232e0564fd4f66fe18d7283 (patch)
treed13311c68f1871ab43ab8276fd355f9af6950f4e
parent4d49e254189cfa70929cd00d1ec263440db10159 (diff)
Guard against unset NYPL_API_TOKEN environment variable
-rwxr-xr-xnypl_recrop.rb4
1 files changed, 4 insertions, 0 deletions
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