Created
May 15, 2019 21:01
-
-
Save dkinzer/618d0c94ae4929998944545f0a0f2e04 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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