jrochkind / borrow_direct Goto Github PK
View Code? Open in Web Editor NEWruby tools for interacting with Borrow Direct consortial borrowing service
License: MIT License
ruby tools for interacting with Borrow Direct consortial borrowing service
License: MIT License
I’ve come across a bug in the borrow_direct gem when trying to do a find with multiple ISBNs for the same item. It took me a while to pin it down, but I finally realized what’s going on.
Currently, doing something like this:
isbns = [‘9780821419755’, ‘0821419757’]
BorrowDirect::FindItem.new.find(:isbn => isbns)
produces a hash that looks like this:
{
"PartnershipId"=>"BD",
"ExactSearch"=>[
{"Type"=>"ISBN", "Value"=>”9780821419755"},
{"Type"=>"ISBN", "Value"=>”0821419757"}
]
}
However, this call yields incorrect results. A search of either ISBN individually shows that the item is available in BD, but trying the above search with two ISBNs returns a response of “unavailable”. This is because the hash — or rather, the JSON it’s converted into in request.rb — is improperly formed. According to Relais, the correct format should be:
{
"PartnershipId": "BD",
"ExactSearch": [{"Type": "ISBN", "Value": "9780821419755"}],
"ExactSearch": [{"Type": "ISBN", "Value": "0821419757"}]
}
So a hash won’t work here because duplicate keys are needed. I tried to find a gentle way of modifying the code in find_item.rb to handle this, but I haven’t come up with anything yet.
Also, on a very minor note, TEST_API_BASE should be updated to https://bdtest.relais-host.com/ (rc.relais-host is no longer working properly).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.