Code Monkey home page Code Monkey logo

borrow_direct's People

Contributors

baroquem avatar jrochkind avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

borrow_direct's Issues

Find item with multiple ISBNs returns incorrect results

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).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.