BCLibraries / primo-services

MIT License
9 stars 4 forks source link

Fix so AlmaClient chooses correct Alma ID #15

Closed danmichaelo closed 9 years ago

danmichaelo commented 9 years ago

Breaking change: I changed the alma_ids from

['institution1:id1', 'institution2:id2']

to

['institution1' => 'id1', 'institution2' => 'id2']

to make it easier to consume. I should have realized in #13, but I'm still struggling to get my head around the API response format, which is really dense. Sorry about that. (A new version bump is probably not needed since the commit is only two days old and we're still on 0.x.)


Some background:

Our library is part of a network zone consortium, which is probably why I run into a few issues. If you're interested, I've put up an example response here: https://gist.github.com/danmichaelo/6d5611592e396945b7a2

In short, delivery looks like this (notice the $$Is):

"delivery" : {
   "delcategory" : [
      "Alma-P$$IBIBSYS",
      "Alma-P$$ISINTEF",
      "Alma-P$$IUBO"
   ],
   "institution" : [
      "BIBSYS",
      "SINTEF",
      "UBO"
   ]
}

and control like this:

{
   "sourcesystem" : "Alma",
   "sourceformat" : "MARC21",
   "sourcerecordid" : "71354134370002201",
   "recordid" : "BIBSYS_ILS71354134370002201",
   "almaid" : [
      "47BIBSYS_NETWORK:71354134370002201",
      "47BIBSYS_SINTEF:213995760002287",
      "47BIBSYS_UBO:2113615280002204"
   ],
   "sourceid" : "BIBSYS_ILS",
   "addsrcrecordid" : "990918105824702201"
}

Since I'm setting $library to 47BIBSYS_UBO, I'm not interested in the sourcerecordid (which is the NZ id), but the ID for 47BIBSYS_UBO (2113615280002204). So that's what my PR is about.

I think the PR shouldn't break responses like the one in brief-search-result-local-01.json, but testing is needed :)

Otterfan commented 9 years ago

In general I wish the API would use real data structures rather than the stringy structures. What happens when Ex Libris gets a contract with the "$$International Big Money Library"?

danmichaelo commented 9 years ago

They would certainly love all the $$s ;)

                         "thumbnail" : [
                             "$$Tamazon_thumb",
                             "$$Tgoogle_thumb"
                          ],