umlaut_borrow_direct 1.0.0.pre2 → 1.0.0.pre3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. checksums.yaml +8 -8
  2. data/app/controllers/umlaut_borrow_direct/controller_implementation.rb +13 -2
  3. data/app/service_adaptors/borrow_direct_adaptor.rb +12 -4
  4. data/lib/tasks/umlaut_borrow_direct_tasks.rake +116 -0
  5. data/lib/umlaut_borrow_direct/version.rb +1 -1
  6. data/test/dummy/log/test.log +22951 -0
  7. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_alerts.scssc +0 -0
  8. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_badges.scssc +0 -0
  9. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_breadcrumbs.scssc +0 -0
  10. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_button-groups.scssc +0 -0
  11. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_buttons.scssc +0 -0
  12. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_carousel.scssc +0 -0
  13. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_close.scssc +0 -0
  14. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_code.scssc +0 -0
  15. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_component-animations.scssc +0 -0
  16. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_dropdowns.scssc +0 -0
  17. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_forms.scssc +0 -0
  18. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_glyphicons.scssc +0 -0
  19. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_grid.scssc +0 -0
  20. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_input-groups.scssc +0 -0
  21. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_jumbotron.scssc +0 -0
  22. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_labels.scssc +0 -0
  23. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_list-group.scssc +0 -0
  24. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_media.scssc +0 -0
  25. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_mixins.scssc +0 -0
  26. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_modals.scssc +0 -0
  27. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_navbar.scssc +0 -0
  28. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_navs.scssc +0 -0
  29. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_normalize.scssc +0 -0
  30. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_pager.scssc +0 -0
  31. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_pagination.scssc +0 -0
  32. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_panels.scssc +0 -0
  33. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_popovers.scssc +0 -0
  34. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_print.scssc +0 -0
  35. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_progress-bars.scssc +0 -0
  36. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_responsive-embed.scssc +0 -0
  37. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_responsive-utilities.scssc +0 -0
  38. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_scaffolding.scssc +0 -0
  39. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_tables.scssc +0 -0
  40. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_thumbnails.scssc +0 -0
  41. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_tooltip.scssc +0 -0
  42. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_type.scssc +0 -0
  43. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_utilities.scssc +0 -0
  44. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_variables.scssc +0 -0
  45. data/test/dummy/tmp/cache/assets/test/sass/1362b85f37ca4c085c17817dd2a4f41eb3ed56e6/_wells.scssc +0 -0
  46. data/test/dummy/tmp/cache/assets/test/sass/2366d925eea0f2ec723ea30502f282b3e0163b3f/_admin.scssc +0 -0
  47. data/test/dummy/tmp/cache/assets/test/sass/2366d925eea0f2ec723ea30502f282b3e0163b3f/_az.scssc +0 -0
  48. data/test/dummy/tmp/cache/assets/test/sass/2366d925eea0f2ec723ea30502f282b3e0163b3f/_forms.scssc +0 -0
  49. data/test/dummy/tmp/cache/assets/test/sass/2366d925eea0f2ec723ea30502f282b3e0163b3f/_icons.scssc +0 -0
  50. data/test/dummy/tmp/cache/assets/test/sass/2366d925eea0f2ec723ea30502f282b3e0163b3f/_layout.scssc +0 -0
  51. data/test/dummy/tmp/cache/assets/test/sass/2366d925eea0f2ec723ea30502f282b3e0163b3f/_misc.scssc +0 -0
  52. data/test/dummy/tmp/cache/assets/test/sass/2366d925eea0f2ec723ea30502f282b3e0163b3f/_mixins.scssc +0 -0
  53. data/test/dummy/tmp/cache/assets/test/sass/2366d925eea0f2ec723ea30502f282b3e0163b3f/_modal.scssc +0 -0
  54. data/test/dummy/tmp/cache/assets/test/sass/2366d925eea0f2ec723ea30502f282b3e0163b3f/_resolve.scssc +0 -0
  55. data/test/dummy/tmp/cache/assets/test/sass/2366d925eea0f2ec723ea30502f282b3e0163b3f/_results.scssc +0 -0
  56. data/test/dummy/tmp/cache/assets/test/sass/2366d925eea0f2ec723ea30502f282b3e0163b3f/_search.scssc +0 -0
  57. data/test/dummy/tmp/cache/assets/test/sass/2366d925eea0f2ec723ea30502f282b3e0163b3f/_spinner.scssc +0 -0
  58. data/test/dummy/tmp/cache/assets/test/sass/2366d925eea0f2ec723ea30502f282b3e0163b3f/_variables.scssc +0 -0
  59. data/test/dummy/tmp/cache/assets/test/sass/5c5a3985fee424ec97ed23d23a371c871a5b5096/_alerts.scssc +0 -0
  60. data/test/dummy/tmp/cache/assets/test/sass/5c5a3985fee424ec97ed23d23a371c871a5b5096/_background-variant.scssc +0 -0
  61. data/test/dummy/tmp/cache/assets/test/sass/5c5a3985fee424ec97ed23d23a371c871a5b5096/_border-radius.scssc +0 -0
  62. data/test/dummy/tmp/cache/assets/test/sass/5c5a3985fee424ec97ed23d23a371c871a5b5096/_buttons.scssc +0 -0
  63. data/test/dummy/tmp/cache/assets/test/sass/5c5a3985fee424ec97ed23d23a371c871a5b5096/_center-block.scssc +0 -0
  64. data/test/dummy/tmp/cache/assets/test/sass/5c5a3985fee424ec97ed23d23a371c871a5b5096/_clearfix.scssc +0 -0
  65. data/test/dummy/tmp/cache/assets/test/sass/5c5a3985fee424ec97ed23d23a371c871a5b5096/_forms.scssc +0 -0
  66. data/test/dummy/tmp/cache/assets/test/sass/5c5a3985fee424ec97ed23d23a371c871a5b5096/_gradients.scssc +0 -0
  67. data/test/dummy/tmp/cache/assets/test/sass/5c5a3985fee424ec97ed23d23a371c871a5b5096/_grid-framework.scssc +0 -0
  68. data/test/dummy/tmp/cache/assets/test/sass/5c5a3985fee424ec97ed23d23a371c871a5b5096/_grid.scssc +0 -0
  69. data/test/dummy/tmp/cache/assets/test/sass/5c5a3985fee424ec97ed23d23a371c871a5b5096/_hide-text.scssc +0 -0
  70. data/test/dummy/tmp/cache/assets/test/sass/5c5a3985fee424ec97ed23d23a371c871a5b5096/_image.scssc +0 -0
  71. data/test/dummy/tmp/cache/assets/test/sass/5c5a3985fee424ec97ed23d23a371c871a5b5096/_labels.scssc +0 -0
  72. data/test/dummy/tmp/cache/assets/test/sass/5c5a3985fee424ec97ed23d23a371c871a5b5096/_list-group.scssc +0 -0
  73. data/test/dummy/tmp/cache/assets/test/sass/5c5a3985fee424ec97ed23d23a371c871a5b5096/_nav-divider.scssc +0 -0
  74. data/test/dummy/tmp/cache/assets/test/sass/5c5a3985fee424ec97ed23d23a371c871a5b5096/_nav-vertical-align.scssc +0 -0
  75. data/test/dummy/tmp/cache/assets/test/sass/5c5a3985fee424ec97ed23d23a371c871a5b5096/_opacity.scssc +0 -0
  76. data/test/dummy/tmp/cache/assets/test/sass/5c5a3985fee424ec97ed23d23a371c871a5b5096/_pagination.scssc +0 -0
  77. data/test/dummy/tmp/cache/assets/test/sass/5c5a3985fee424ec97ed23d23a371c871a5b5096/_panels.scssc +0 -0
  78. data/test/dummy/tmp/cache/assets/test/sass/5c5a3985fee424ec97ed23d23a371c871a5b5096/_progress-bar.scssc +0 -0
  79. data/test/dummy/tmp/cache/assets/test/sass/5c5a3985fee424ec97ed23d23a371c871a5b5096/_reset-filter.scssc +0 -0
  80. data/test/dummy/tmp/cache/assets/test/sass/5c5a3985fee424ec97ed23d23a371c871a5b5096/_resize.scssc +0 -0
  81. data/test/dummy/tmp/cache/assets/test/sass/5c5a3985fee424ec97ed23d23a371c871a5b5096/_responsive-visibility.scssc +0 -0
  82. data/test/dummy/tmp/cache/assets/test/sass/5c5a3985fee424ec97ed23d23a371c871a5b5096/_size.scssc +0 -0
  83. data/test/dummy/tmp/cache/assets/test/sass/5c5a3985fee424ec97ed23d23a371c871a5b5096/_tab-focus.scssc +0 -0
  84. data/test/dummy/tmp/cache/assets/test/sass/5c5a3985fee424ec97ed23d23a371c871a5b5096/_table-row.scssc +0 -0
  85. data/test/dummy/tmp/cache/assets/test/sass/5c5a3985fee424ec97ed23d23a371c871a5b5096/_text-emphasis.scssc +0 -0
  86. data/test/dummy/tmp/cache/assets/test/sass/5c5a3985fee424ec97ed23d23a371c871a5b5096/_text-overflow.scssc +0 -0
  87. data/test/dummy/tmp/cache/assets/test/sass/5c5a3985fee424ec97ed23d23a371c871a5b5096/_vendor-prefixes.scssc +0 -0
  88. data/test/dummy/tmp/cache/assets/test/sass/a2d59a70ef53ef9b8d319a70f93eadd4d6ccb126/_bootstrap-sprockets.scssc +0 -0
  89. data/test/dummy/tmp/cache/assets/test/sass/a2d59a70ef53ef9b8d319a70f93eadd4d6ccb126/_bootstrap.scssc +0 -0
  90. data/test/dummy/tmp/cache/assets/test/sass/b05e8727119abef6b70673f3bdb183ff28fb8943/umlaut.css.scssc +0 -0
  91. data/test/dummy/tmp/cache/assets/test/sprockets/07a4694fe07acf1c2fedda2cac798bc9 +0 -0
  92. data/test/dummy/tmp/cache/assets/test/sprockets/1360c5743e6c56b131feeb8bd4692855 +0 -0
  93. data/test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  94. data/test/dummy/tmp/cache/assets/test/sprockets/1447c69f602d8988ba7d3613374b9192 +0 -0
  95. data/test/dummy/tmp/cache/assets/test/sprockets/14e244a20d79f91a83f6e3b6c5fc17c8 +0 -0
  96. data/test/dummy/tmp/cache/assets/test/sprockets/1898cdf9f07847e531543baa63512abb +0 -0
  97. data/test/dummy/tmp/cache/assets/test/sprockets/1ded392702443b3183fe4593decc78a1 +0 -0
  98. data/test/dummy/tmp/cache/assets/test/sprockets/28d1b98052a09b97bbc88fbe5961fa0b +0 -0
  99. data/test/dummy/tmp/cache/assets/test/sprockets/2e0c51d5557aa5342438b9151117b726 +0 -0
  100. data/test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  101. data/test/dummy/tmp/cache/assets/test/sprockets/306cfd89581a76ae90e5620130d1230f +0 -0
  102. data/test/dummy/tmp/cache/assets/test/sprockets/31603c401447ef43ed7749623b20173f +0 -0
  103. data/test/dummy/tmp/cache/assets/test/sprockets/34a91e558d222e4927b61dfedde2741f +0 -0
  104. data/test/dummy/tmp/cache/assets/test/sprockets/3c48d963e9cb0ab17a3c2df71845c65e +0 -0
  105. data/test/dummy/tmp/cache/assets/test/sprockets/41b5737df347367ac2d25d056942953c +0 -0
  106. data/test/dummy/tmp/cache/assets/test/sprockets/4a69dcaff39c483365574b8a5adf8c1e +0 -0
  107. data/test/dummy/tmp/cache/assets/test/sprockets/5261e14c939f24d69198e8cc8cbe77b8 +0 -0
  108. data/test/dummy/tmp/cache/assets/test/sprockets/5282063d0bc5fdc4b86a9aa07a16c5ca +0 -0
  109. data/test/dummy/tmp/cache/assets/test/sprockets/57b8645734a1dd6817b4879c005219ca +0 -0
  110. data/test/dummy/tmp/cache/assets/test/sprockets/59e30bd46b8b43100a4a34c94a39c21f +0 -0
  111. data/test/dummy/tmp/cache/assets/test/sprockets/5b910420983cbd1e8fc373433ea92fa4 +0 -0
  112. data/test/dummy/tmp/cache/assets/test/sprockets/5cec1b0830a49fb304d40e8f13ac8282 +0 -0
  113. data/test/dummy/tmp/cache/assets/test/sprockets/63d6cc65a5a6fcbf12fe6c35f2d27813 +0 -0
  114. data/test/dummy/tmp/cache/assets/test/sprockets/65d602bdfff59430dc54cc10b37b160d +0 -0
  115. data/test/dummy/tmp/cache/assets/test/sprockets/6a813e9c25d7fa816423dd429340ab72 +0 -0
  116. data/test/dummy/tmp/cache/assets/test/sprockets/6f6b80b3e5ef142338834285588b36b1 +0 -0
  117. data/test/dummy/tmp/cache/assets/test/sprockets/81418fe0b09e8c9f3755326c90b99735 +0 -0
  118. data/test/dummy/tmp/cache/assets/test/sprockets/8768c04463df6739a6f5fb3693822fb0 +0 -0
  119. data/test/dummy/tmp/cache/assets/test/sprockets/8a571b88845483039807b38c9723e008 +0 -0
  120. data/test/dummy/tmp/cache/assets/test/sprockets/8fecdaba532a2a1bba14d55bc0406535 +0 -0
  121. data/test/dummy/tmp/cache/assets/test/sprockets/91ca2fb64bf748b6238c146752a7c864 +0 -0
  122. data/test/dummy/tmp/cache/assets/test/sprockets/94090977c499b165894487a5798769f4 +0 -0
  123. data/test/dummy/tmp/cache/assets/test/sprockets/a2ea4b719ca9026220a671803b988a31 +0 -0
  124. data/test/dummy/tmp/cache/assets/test/sprockets/a70424fe2d1cdc6b718024d0eae0b05a +0 -0
  125. data/test/dummy/tmp/cache/assets/test/sprockets/aa6c6aa8db2af9c4b297ebeefa8c05b6 +0 -0
  126. data/test/dummy/tmp/cache/assets/test/sprockets/b2ecbebd998b7c7c7729ead4017d30ce +0 -0
  127. data/test/dummy/tmp/cache/assets/test/sprockets/b3578e64c31fe804f95589727da2126e +0 -0
  128. data/test/dummy/tmp/cache/assets/test/sprockets/b3f151531550c6e907ec763ae5bfe373 +0 -0
  129. data/test/dummy/tmp/cache/assets/test/sprockets/b76fe5c6b9c99e9ec616db4b60385d9c +0 -0
  130. data/test/dummy/tmp/cache/assets/test/sprockets/b96fbde526f7d9458f59e2ada8672feb +0 -0
  131. data/test/dummy/tmp/cache/assets/test/sprockets/c3a7673cbf27d723a50e936436cde8a3 +0 -0
  132. data/test/dummy/tmp/cache/assets/test/sprockets/d009317a0978714955954142f41ba552 +0 -0
  133. data/test/dummy/tmp/cache/assets/test/sprockets/d08802d82ae1799fefdb574fff989be1 +0 -0
  134. data/test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  135. data/test/dummy/tmp/cache/assets/test/sprockets/f62eef088a833d88f92a38fff8d31a91 +0 -0
  136. data/test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  137. data/test/dummy/tmp/cache/assets/test/sprockets/f92edeb4e4e73c8b19ed3520bd8c00c3 +0 -0
  138. data/test/dummy/tmp/cache/assets/test/sprockets/f93aefd3b059f9814da72bdc0cb0828e +0 -0
  139. data/test/dummy/tmp/cache/assets/test/sprockets/fedb2b01e83bd131bc90e797455ee4ca +0 -0
  140. metadata +260 -2
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZjlkY2Y1ODU0Zjg0MWNlZWY2MjUzNTFhZmU5ODgyM2QwZDYyYTg1NQ==
4
+ OTBlNGIxNjQxMWMzZTM3YzEyMTJmOTBlN2UyMjRhMWI2ZWY4NDU5Ng==
5
5
  data.tar.gz: !binary |-
6
- NWFlZDVkNTRhMmZhYTI4YmY0NWRhZWViY2EyYmE3YjU0MWE3ZTNhNw==
6
+ MTYxZmRlMDkxYWIwMzg4ZjllMWQyNWIyZmE5NWFiNzczODIyOWEyYg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZjNlYzhlMWFkYWViZTAwOTkzNGFlOWFhOGY1ZmE4OTBjMGY3OTQ5YmY5OWIy
10
- MGU2OGE2YTg1ZTZlN2MyZmExMGQxNzZkZDI1NWZiMmRlNDc4ZTBjY2U0YTlk
11
- NzFkYzk5ODEwOGNkYTE0NzQ2ZTRkZTUyNDcxNWUyYzZjNDJlNWQ=
9
+ MGU4MDczNWUxMTQ2M2E4ZTk0ZDMyMzlkY2VlZTY5MjViMWNhNjQwYWMzYjEw
10
+ OTVhYmMyMjQ5ODg3YjM1MDg2OTUzZTg2ZDFmNThlNmI2YzljOThjNDM4MWE5
11
+ MzNlOGI5NGEwNjlkNjVjMzE5ZTFkMjljYTk1ZTdjZjQwYTRhYTc=
12
12
  data.tar.gz: !binary |-
13
- NjQyZmM5ZmE5NjM0ODBhYjVmNTIwNTgwYjBlMGE1OWU0OTIyZWM3ODZkMjQz
14
- ZTM1MzQyMmQ2MTZjYTFjMWY2MjYyOTUxMWRjNTgzY2E3ZmZjMDAwN2NhODBm
15
- M2UyZWM1YmMyNGMyYjg5MTVjMDM2MGU4ZGUzY2MzNWVhY2FkZGY=
13
+ OTVlMmFhMmQxYTBmZmExMzk2MTNkZGE3MmZmZWMwNDlkODg0MWFhOTY3YWQ0
14
+ MTM3ZDkzOTRmMmY0MGIxZTQ2YjI5NWE2NDE4NWU3M2NlODMyZGQzMDkzMjU1
15
+ Y2MwNDBhOTcwMzgzNDYwN2Q4ZDMwZTI5ZDJkMmIyZGZmYTQ5M2M=
@@ -44,6 +44,7 @@ module UmlautBorrowDirect
44
44
  # Saving the @bg_thread only so in testing we can wait on it.
45
45
  @bg_thread = Thread.new(@request, @service, @request.referent.isbn) do |request, service, isbn|
46
46
  begin
47
+ ActiveRecord::Base.forbid_implicit_checkout_for_thread!
47
48
 
48
49
  requester = BorrowDirect::RequestItem.new(self.patron_barcode, service.library_symbol)
49
50
  requester.timeout = @service.http_timeout
@@ -56,7 +57,17 @@ module UmlautBorrowDirect
56
57
  set_status_response({:status => Successful, :request_number => request_number }, request)
57
58
  end
58
59
 
59
- rescue StandardError => e
60
+ rescue StandardError => e
61
+ # If it was an AR error in the first place, forget trying to record
62
+ # it.
63
+ if e.kind_of?(ActiveRecord::ActiveRecordError)
64
+ Rails.logger.fatal("BorrowDirect: Error placing request, and we could not log to database (#{e}): #{e.class} #{e.message}. Backtrace:\n #{Umlaut::Util.clean_backtrace(e).join("\n ")}\n")
65
+
66
+ # Nothing will do anything with this since we aren't waiting on
67
+ # the thread, but oh well.
68
+ raise e
69
+ end
70
+
60
71
  ActiveRecord::Base.connection_pool.with_connection do
61
72
  Rails.logger.error("BorrowDirect: Error placing request: #{e.class} #{e.message}. Backtrace:\n #{Umlaut::Util.clean_backtrace(e).join("\n ")}\n")
62
73
 
@@ -68,7 +79,7 @@ module UmlautBorrowDirect
68
79
  set_status_response(status_response_data, request)
69
80
 
70
81
  if service
71
- service.bd_api_log(isbn, "RequestItem", e, requester.last_request_time)
82
+ service.bd_api_log(isbn, "RequestItem", e, (requester.last_request_time if requester))
72
83
  end
73
84
 
74
85
 
@@ -47,6 +47,11 @@ class BorrowDirectAdaptor < Service
47
47
  return ! title_is_serial?(request.referent)
48
48
  end
49
49
 
50
+ # Make sure there are no hyphens, BD doesn't seem to like it
51
+ def isbn(request)
52
+ request.referent.isbn && request.referent.isbn.gsub('-', '')
53
+ end
54
+
50
55
  def handle(request)
51
56
  if request.referrer_id && @suppress_rfr_ids.include?(request.referrer_id)
52
57
  return request.dispatched(self, true)
@@ -70,10 +75,10 @@ class BorrowDirectAdaptor < Service
70
75
  begin
71
76
  finditem = BorrowDirect::FindItem.new(@find_item_patron_barcode, @library_symbol)
72
77
  finditem.timeout = @http_timeout
73
- response = finditem.find(:isbn => request.referent.isbn)
78
+ response = finditem.find(:isbn => isbn(request))
74
79
 
75
80
  # Log success if configured, used for looking at error rate
76
- bd_api_log(request.referent.isbn, "FindItem", "SUCCESS", finditem.last_request_time)
81
+ bd_api_log(isbn(request), "FindItem", "SUCCESS", finditem.last_request_time)
77
82
 
78
83
  if response.requestable?
79
84
  # Mark it requestable!
@@ -100,7 +105,7 @@ class BorrowDirectAdaptor < Service
100
105
  Rails.logger.error(msg)
101
106
 
102
107
  # Special BD error log if configured
103
- bd_api_log(request.referent.isbn, "FindItem", e, finditem.last_request_time)
108
+ bd_api_log(isbn(request), "FindItem", e, finditem.last_request_time)
104
109
 
105
110
  # And mark it as an error so error message will be displayed. Let's
106
111
  # mark it a temporary error, so it'll be tried again later, it might
@@ -123,12 +128,15 @@ class BorrowDirectAdaptor < Service
123
128
  def can_precheck_borrow_direct?(request)
124
129
  return false unless @use_bd_api
125
130
 
126
- request.referent.isbn.present?
131
+ isbn(request).present?
127
132
  end
128
133
 
129
134
  def bd_api_log(isbn, action, result, timing)
130
135
  if result.kind_of? Exception
131
136
  result = "#{result.class}/#{result.message}"
137
+ if result.respond_to?(:bd_code) && result.bd_code.present?
138
+ result += "/#{result.bd_code}"
139
+ end
132
140
  end
133
141
 
134
142
  if @bd_api_log_level
@@ -2,3 +2,119 @@
2
2
  # task :umlaut_borrow_direct do
3
3
  # # Task goes here
4
4
  # end
5
+ namespace :umlaut_borrow_direct do
6
+ desc "BD API stats calc"
7
+ task :api_stats, [:filename] do |t, args|
8
+
9
+ stats = {
10
+ "FindItem" => {
11
+ :times => [],
12
+ :errors => [],
13
+ :timeouts => [],
14
+ :count => 0
15
+ },
16
+ "RequestItem" => {
17
+ :times => [],
18
+ :errors => [],
19
+ :timeouts => [],
20
+ :count => 0
21
+ }
22
+ }
23
+
24
+ if args["filename"] == "stdin"
25
+ file = STDIN
26
+ else
27
+ file = File.open(File.expand_path args[:filename])
28
+ end
29
+
30
+ file.each_line do |line|
31
+
32
+ if line =~ /BD API log\t([^\t]*)\t([^\t]*)\t([^\t]*)\t([^\t]*)/
33
+ action = $1
34
+ result = $2
35
+ timing = $3
36
+ query = $4
37
+
38
+ if timing.present? && (timing.to_f == 0)
39
+ raise "Timing does not look like a float: #{timingf}"
40
+ end
41
+ timing = timing.to_f
42
+
43
+ if ["FindItem", "RequestItem"].include? action
44
+ stats[action][:count] += 1
45
+
46
+ if line =~ /(\d\d\d\d-\d\d-\d\d)/
47
+
48
+ date = Date.parse($1)
49
+
50
+ stats[action][:min_date] = date if stats[action][:min_date].nil? || (date < stats[action][:min_date])
51
+ stats[action][:max_date] = date if stats[action][:max_date].nil? || (date > stats[action][:max_date])
52
+ end
53
+
54
+ value_dict = {:action => action, :result => result, :timing => timing, :query => query}
55
+
56
+ stats[action][:times] << timing unless timing == 0
57
+ unless result == "SUCCESS"
58
+ (exception_class, exception_message) = result.split("/")
59
+ value_dict[:exception_class] = exception_class
60
+ value_dict[:exception_message] = exception_message
61
+ if exception_class == "BorrowDirect::HttpTimeoutError"
62
+ stats[action][:timeouts] << value_dict
63
+ else
64
+ stats[action][:errors] << value_dict
65
+ end
66
+ end
67
+ else
68
+ puts "Warning, unrecognized action: #{action}"
69
+ end
70
+ end
71
+ end
72
+
73
+ ["FindItem", "RequestItem"].each do |action|
74
+ sorted_times = stats[action][:times].sort
75
+
76
+ next if sorted_times.empty?
77
+
78
+ puts "\n\n#{action} API: #{stats[action][:count]} requests from #{stats[action][:min_date]} to #{stats[action][:max_date]}"
79
+ puts " Timing (not including timeouts):"
80
+ puts " Min: #{sorted_times.first}"
81
+ puts " 25th %ile: #{percentile sorted_times, 25}"
82
+ puts " Median: #{percentile sorted_times, 50}"
83
+ puts " 75th %ile: #{percentile sorted_times, 75}"
84
+ puts " 95th %ile: #{percentile sorted_times, 95}"
85
+ puts " Max: #{sorted_times.last}"
86
+ puts ""
87
+ puts " Timeouts: #{stats[action][:timeouts].count}"
88
+ puts " Errors: #{stats[action][:errors].count}"
89
+
90
+ #error_types = stats[action][:errors].group_by {|dict| dict[:exception_class]}
91
+ #error_types.each_pair do |type, list|
92
+ # puts " #{type} (#{list.count}) #{list}"
93
+ #end
94
+
95
+ end
96
+ puts "\n\n"
97
+
98
+
99
+ end
100
+
101
+ # pass in a SORTED array a
102
+ def percentile a, p
103
+ rank = (p.to_f / 100) * (a.length + 1)
104
+
105
+ if a.length == 0
106
+ return nil
107
+ elsif rank.modulo(1) != 0
108
+
109
+
110
+ sample_0 = a[rank.truncate - 1]
111
+ sample_1 = a[rank.truncate]
112
+
113
+
114
+ return sample_0 if sample_1.nil?
115
+ return (sample_1 + sample_0) / 2
116
+ else
117
+ return a[rank - 1]
118
+ end
119
+ end
120
+ end
@@ -1,3 +1,3 @@
1
1
  module UmlautBorrowDirect
2
- VERSION = "1.0.0.pre2"
2
+ VERSION = "1.0.0.pre3"
3
3
  end