Skip to content

Instantly share code, notes, and snippets.

@dkinzer
Created May 15, 2019 21:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dkinzer/618d0c94ae4929998944545f0a0f2e04 to your computer and use it in GitHub Desktop.
Save dkinzer/618d0c94ae4929998944545f0a0f2e04 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# frozen_string_literal: true
#
# A script for retrieving a local repository of public and authentication notes
# for electronic collections and services.
#
items_ids = File.readlines("#{ENV["HOME"]}/Downloads/asrs_items.csv")
.map(&:strip)
.map { |l|
codes = l.split(",")
{
mms_id: codes[0].strip,
item_pid: codes[1].strip,
holding_id: codes[2].strip,
description: codes[3].strip,
barcode: codes[4].strip,
} }
items_ids.each do |item|
curl_request = "
curl -X POST \
'https://api-na.hosted.exlibrisgroup.com/almaws/v1/bibs/#{item[:mms_id]}/holdings/#{item[:holding_id]}/items/#{item[:item_pid]}/requests?apikey=l7xx8adc052f01ab478a8dcaf62d62f6832a&user_id=915619567&format-json=' \\
-H 'Content-Type: application/json' \\
-H 'cache-control: no-cache' \\
-d '{
\"pickup_location_type\": \"LIBRARY\",
\"request_type\": \"HOLD\",
\"pickup_location_library\": \"AMBLER\",
\"description\": \"#{item[:description]}\"
}'"
puts curl_request
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment