exlibris-aleph 1.1.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (268) hide show
  1. data/README.md +199 -82
  2. data/Rakefile +8 -14
  3. data/lib/exlibris-aleph.rb +0 -3
  4. data/lib/exlibris/aleph/admin_library.rb +27 -0
  5. data/lib/exlibris/aleph/api/base.rb +27 -0
  6. data/lib/exlibris/aleph/api/client/base.rb +86 -0
  7. data/lib/exlibris/aleph/api/client/patron.rb +20 -0
  8. data/lib/exlibris/aleph/api/client/patron/address.rb +22 -0
  9. data/lib/exlibris/aleph/api/client/patron/record.rb +23 -0
  10. data/lib/exlibris/aleph/api/client/patron/record/item.rb +26 -0
  11. data/lib/exlibris/aleph/api/client/patron/record/item/create_hold.rb +31 -0
  12. data/lib/exlibris/aleph/api/client/patron/record/item/create_hold/parameters.rb +55 -0
  13. data/lib/exlibris/aleph/api/client/patron/record/item/hold.rb +29 -0
  14. data/lib/exlibris/aleph/api/client/patron/status.rb +22 -0
  15. data/lib/exlibris/aleph/api/client/record.rb +21 -0
  16. data/lib/exlibris/aleph/api/client/record/filters.rb +23 -0
  17. data/lib/exlibris/aleph/api/client/record/holding.rb +23 -0
  18. data/lib/exlibris/aleph/api/client/record/holdings.rb +23 -0
  19. data/lib/exlibris/aleph/api/client/record/item.rb +23 -0
  20. data/lib/exlibris/aleph/api/client/record/items.rb +23 -0
  21. data/lib/exlibris/aleph/api/reader/base.rb +15 -0
  22. data/lib/exlibris/aleph/api/reader/patron.rb +19 -0
  23. data/lib/exlibris/aleph/api/reader/patron/address.rb +90 -0
  24. data/lib/exlibris/aleph/api/reader/patron/record.rb +38 -0
  25. data/lib/exlibris/aleph/api/reader/patron/record/item.rb +77 -0
  26. data/lib/exlibris/aleph/api/reader/patron/record/item/create_hold.rb +33 -0
  27. data/lib/exlibris/aleph/api/reader/patron/record/item/hold.rb +56 -0
  28. data/lib/exlibris/aleph/api/reader/patron/status.rb +33 -0
  29. data/lib/exlibris/aleph/api/reader/record.rb +10 -0
  30. data/lib/exlibris/aleph/api/reader/record/item.rb +45 -0
  31. data/lib/exlibris/aleph/collection.rb +26 -0
  32. data/lib/exlibris/aleph/config.rb +17 -57
  33. data/lib/exlibris/aleph/holding.rb +59 -0
  34. data/lib/exlibris/aleph/holding/metadata.rb +28 -0
  35. data/lib/exlibris/aleph/holdings.rb +51 -0
  36. data/lib/exlibris/aleph/item.rb +138 -0
  37. data/lib/exlibris/aleph/item/call_number.rb +14 -0
  38. data/lib/exlibris/aleph/item/circulation_policy.rb +30 -0
  39. data/lib/exlibris/aleph/item/circulation_policy/display.rb +16 -0
  40. data/lib/exlibris/aleph/item/circulation_policy/identifier.rb +34 -0
  41. data/lib/exlibris/aleph/item/circulation_policy/privileges.rb +72 -0
  42. data/lib/exlibris/aleph/item/circulation_status.rb +31 -0
  43. data/lib/exlibris/aleph/item/display_mask.rb +19 -0
  44. data/lib/exlibris/aleph/item/opac_note.rb +17 -0
  45. data/lib/exlibris/aleph/item/processing_status.rb +23 -0
  46. data/lib/exlibris/aleph/item/queue.rb +32 -0
  47. data/lib/exlibris/aleph/item/status.rb +23 -0
  48. data/lib/exlibris/aleph/items.rb +51 -0
  49. data/lib/exlibris/aleph/metadata.rb +25 -0
  50. data/lib/exlibris/aleph/patron.rb +18 -82
  51. data/lib/exlibris/aleph/patron/address.rb +56 -0
  52. data/lib/exlibris/aleph/patron/circulation_policy.rb +26 -0
  53. data/lib/exlibris/aleph/patron/circulation_policy/identifier.rb +29 -0
  54. data/lib/exlibris/aleph/patron/circulation_policy/privileges.rb +56 -0
  55. data/lib/exlibris/aleph/patron/record.rb +39 -0
  56. data/lib/exlibris/aleph/patron/record/circulation_policy.rb +18 -0
  57. data/lib/exlibris/aleph/patron/record/circulation_policy/privileges.rb +42 -0
  58. data/lib/exlibris/aleph/patron/record/item.rb +63 -0
  59. data/lib/exlibris/aleph/patron/record/item/circulation_policy.rb +21 -0
  60. data/lib/exlibris/aleph/patron/record/item/circulation_policy/privileges.rb +39 -0
  61. data/lib/exlibris/aleph/patron/record/item/create_hold.rb +43 -0
  62. data/lib/exlibris/aleph/patron/record/item/hold.rb +41 -0
  63. data/lib/exlibris/aleph/patron/status.rb +19 -0
  64. data/lib/exlibris/aleph/pickup_location.rb +12 -0
  65. data/lib/exlibris/aleph/record.rb +14 -43
  66. data/lib/exlibris/aleph/record/metadata.rb +8 -0
  67. data/lib/exlibris/aleph/sub_library.rb +30 -0
  68. data/lib/exlibris/aleph/table/base.rb +22 -0
  69. data/lib/exlibris/aleph/table/collections.rb +17 -0
  70. data/lib/exlibris/aleph/table/item/circulation_policies.rb +65 -0
  71. data/lib/exlibris/aleph/table/item/display_masks.rb +19 -0
  72. data/lib/exlibris/aleph/table/patron/circulation_policies.rb +47 -0
  73. data/lib/exlibris/aleph/table/patron/statuses.rb +19 -0
  74. data/lib/exlibris/aleph/table/reader/base.rb +57 -0
  75. data/lib/exlibris/aleph/table/reader/collections.rb +35 -0
  76. data/lib/exlibris/aleph/table/reader/item_circulation_policies.rb +50 -0
  77. data/lib/exlibris/aleph/table/reader/item_display_masks.rb +19 -0
  78. data/lib/exlibris/aleph/table/reader/matcher/base.rb +30 -0
  79. data/lib/exlibris/aleph/table/reader/matcher/collections.rb +17 -0
  80. data/lib/exlibris/aleph/table/reader/matcher/item_circulation_policies.rb +17 -0
  81. data/lib/exlibris/aleph/table/reader/matcher/item_display_masks.rb +17 -0
  82. data/lib/exlibris/aleph/table/reader/matcher/patron_circulation_policies.rb +17 -0
  83. data/lib/exlibris/aleph/table/reader/matcher/patron_statuses.rb +17 -0
  84. data/lib/exlibris/aleph/table/reader/matcher/sub_libraries.rb +17 -0
  85. data/lib/exlibris/aleph/table/reader/patron_circulation_policies.rb +51 -0
  86. data/lib/exlibris/aleph/table/reader/patron_statuses.rb +19 -0
  87. data/lib/exlibris/aleph/table/reader/row/base.rb +25 -0
  88. data/lib/exlibris/aleph/table/reader/row/collections.rb +13 -0
  89. data/lib/exlibris/aleph/table/reader/row/item_circulation_policies.rb +17 -0
  90. data/lib/exlibris/aleph/table/reader/row/item_display_masks.rb +13 -0
  91. data/lib/exlibris/aleph/table/reader/row/patron_circulation_policies.rb +20 -0
  92. data/lib/exlibris/aleph/table/reader/row/patron_statuses.rb +13 -0
  93. data/lib/exlibris/aleph/table/reader/row/sub_libraries.rb +13 -0
  94. data/lib/exlibris/aleph/table/reader/sub_libraries.rb +32 -0
  95. data/lib/exlibris/aleph/table/sub_libraries.rb +11 -0
  96. data/lib/exlibris/aleph/tables_manager.rb +66 -0
  97. data/lib/exlibris/aleph/version.rb +1 -1
  98. data/spec/exlibris/aleph/admin_library_spec.rb +83 -0
  99. data/spec/exlibris/aleph/api/base_spec.rb +23 -0
  100. data/spec/exlibris/aleph/api/client/base_spec.rb +40 -0
  101. data/spec/exlibris/aleph/api/client/patron/address_spec.rb +40 -0
  102. data/spec/exlibris/aleph/api/client/patron/record/item/create_hold/parameters_spec.rb +101 -0
  103. data/spec/exlibris/aleph/api/client/patron/record/item/create_hold_spec.rb +102 -0
  104. data/spec/exlibris/aleph/api/client/patron/record/item/hold_spec.rb +89 -0
  105. data/spec/exlibris/aleph/api/client/patron/record/item_spec.rb +52 -0
  106. data/spec/exlibris/aleph/api/client/patron/record_spec.rb +45 -0
  107. data/spec/exlibris/aleph/api/client/patron/status_spec.rb +40 -0
  108. data/spec/exlibris/aleph/api/client/patron_spec.rb +38 -0
  109. data/spec/exlibris/aleph/api/client/record/filters_spec.rb +46 -0
  110. data/spec/exlibris/aleph/api/client/record/holding_spec.rb +41 -0
  111. data/spec/exlibris/aleph/api/client/record/holdings_spec.rb +46 -0
  112. data/spec/exlibris/aleph/api/client/record/item_spec.rb +41 -0
  113. data/spec/exlibris/aleph/api/client/record/items_spec.rb +46 -0
  114. data/spec/exlibris/aleph/api/client/record_spec.rb +43 -0
  115. data/spec/exlibris/aleph/api/reader/base_spec.rb +18 -0
  116. data/spec/exlibris/aleph/api/reader/patron/address_spec.rb +151 -0
  117. data/spec/exlibris/aleph/api/reader/patron/record/item/create_hold_spec.rb +65 -0
  118. data/spec/exlibris/aleph/api/reader/patron/record/item/hold_spec.rb +145 -0
  119. data/spec/exlibris/aleph/api/reader/patron/record/item_spec.rb +266 -0
  120. data/spec/exlibris/aleph/api/reader/patron/record_spec.rb +98 -0
  121. data/spec/exlibris/aleph/api/reader/patron/status_spec.rb +57 -0
  122. data/spec/exlibris/aleph/api/reader/patron_spec.rb +28 -0
  123. data/spec/exlibris/aleph/api/reader/record/item_spec.rb +178 -0
  124. data/spec/exlibris/aleph/collection_spec.rb +95 -0
  125. data/spec/exlibris/aleph/config_spec.rb +17 -0
  126. data/spec/exlibris/aleph/holding/metadata_spec.rb +57 -0
  127. data/spec/exlibris/aleph/holding_spec.rb +53 -0
  128. data/spec/exlibris/aleph/holdings_spec.rb +59 -0
  129. data/spec/exlibris/aleph/item/call_number_spec.rb +20 -0
  130. data/spec/exlibris/aleph/item/circulation_policy/display_spec.rb +33 -0
  131. data/spec/exlibris/aleph/item/circulation_policy/identifier_spec.rb +154 -0
  132. data/spec/exlibris/aleph/item/circulation_policy/privileges_spec.rb +183 -0
  133. data/spec/exlibris/aleph/item/circulation_policy_spec.rb +146 -0
  134. data/spec/exlibris/aleph/item/circulation_status_spec.rb +83 -0
  135. data/spec/exlibris/aleph/item/display_mask_spec.rb +72 -0
  136. data/spec/exlibris/aleph/item/opac_note_spec.rb +19 -0
  137. data/spec/exlibris/aleph/item/processing_status_spec.rb +75 -0
  138. data/spec/exlibris/aleph/item/queue_spec.rb +31 -0
  139. data/spec/exlibris/aleph/item/status_spec.rb +80 -0
  140. data/spec/exlibris/aleph/item_spec.rb +97 -0
  141. data/spec/exlibris/aleph/items_spec.rb +59 -0
  142. data/spec/exlibris/aleph/metadata_spec.rb +118 -0
  143. data/spec/exlibris/aleph/patron/address_spec.rb +68 -0
  144. data/spec/exlibris/aleph/patron/circulation_policy/identifier_spec.rb +115 -0
  145. data/spec/exlibris/aleph/patron/circulation_policy/privileges_spec.rb +128 -0
  146. data/spec/exlibris/aleph/patron/circulation_policy_spec.rb +119 -0
  147. data/spec/exlibris/aleph/patron/record/circulation_policy/privileges_spec.rb +88 -0
  148. data/spec/exlibris/aleph/patron/record/circulation_policy_spec.rb +37 -0
  149. data/spec/exlibris/aleph/patron/record/item/circulation_policy/privileges_spec.rb +76 -0
  150. data/spec/exlibris/aleph/patron/record/item/circulation_policy_spec.rb +52 -0
  151. data/spec/exlibris/aleph/patron/record/item/create_hold_spec.rb +49 -0
  152. data/spec/exlibris/aleph/patron/record/item/hold_spec.rb +41 -0
  153. data/spec/exlibris/aleph/patron/record/item_spec.rb +64 -0
  154. data/spec/exlibris/aleph/patron/record_spec.rb +30 -0
  155. data/spec/exlibris/aleph/patron/status_spec.rb +72 -0
  156. data/spec/exlibris/aleph/patron_spec.rb +28 -0
  157. data/spec/exlibris/aleph/pickup_location_spec.rb +19 -0
  158. data/spec/exlibris/aleph/record/metadata_spec.rb +120 -0
  159. data/spec/exlibris/aleph/record_spec.rb +44 -0
  160. data/spec/exlibris/aleph/sub_library_spec.rb +110 -0
  161. data/spec/exlibris/aleph/table/base_spec.rb +17 -0
  162. data/spec/exlibris/aleph/table/collections_spec.rb +24 -0
  163. data/spec/exlibris/aleph/table/item/circulation_policies_spec.rb +65 -0
  164. data/spec/exlibris/aleph/table/item/display_masks_spec.rb +26 -0
  165. data/spec/exlibris/aleph/table/patron/circulation_policies_spec.rb +47 -0
  166. data/spec/exlibris/aleph/table/patron/statuses_spec.rb +26 -0
  167. data/spec/exlibris/aleph/table/reader/base_spec.rb +28 -0
  168. data/spec/exlibris/aleph/table/reader/collections_spec.rb +33 -0
  169. data/spec/exlibris/aleph/table/reader/item_circulation_policies_spec.rb +33 -0
  170. data/spec/exlibris/aleph/table/reader/item_display_masks_spec.rb +27 -0
  171. data/spec/exlibris/aleph/table/reader/matcher/base_spec.rb +32 -0
  172. data/spec/exlibris/aleph/table/reader/matcher/collections_spec.rb +39 -0
  173. data/spec/exlibris/aleph/table/reader/matcher/item_circulation_policies_spec.rb +39 -0
  174. data/spec/exlibris/aleph/table/reader/matcher/item_display_masks_spec.rb +40 -0
  175. data/spec/exlibris/aleph/table/reader/matcher/patron_circulation_policies_spec.rb +40 -0
  176. data/spec/exlibris/aleph/table/reader/matcher/patron_statuses_spec.rb +40 -0
  177. data/spec/exlibris/aleph/table/reader/matcher/sub_libraries_spec.rb +40 -0
  178. data/spec/exlibris/aleph/table/reader/patron_circulation_policies_spec.rb +27 -0
  179. data/spec/exlibris/aleph/table/reader/patron_statuses_spec.rb +27 -0
  180. data/spec/exlibris/aleph/table/reader/row/base_spec.rb +20 -0
  181. data/spec/exlibris/aleph/table/reader/row/collections_spec.rb +37 -0
  182. data/spec/exlibris/aleph/table/reader/row/item_circulation_policies_spec.rb +89 -0
  183. data/spec/exlibris/aleph/table/reader/row/item_display_masks_spec.rb +29 -0
  184. data/spec/exlibris/aleph/table/reader/row/patron_circulation_policies_spec.rb +115 -0
  185. data/spec/exlibris/aleph/table/reader/row/patron_statuses_spec.rb +29 -0
  186. data/spec/exlibris/aleph/table/reader/row/sub_libraries_spec.rb +41 -0
  187. data/spec/exlibris/aleph/table/reader/sub_libraries_spec.rb +36 -0
  188. data/spec/exlibris/aleph/table/sub_libraries_spec.rb +19 -0
  189. data/spec/exlibris/aleph/tables_manager_spec.rb +120 -0
  190. data/spec/exlibris/aleph_spec.rb +5 -0
  191. data/spec/spec_helper.rb +27 -0
  192. data/spec/support/mnt/aleph_tab/adm50/tab/filename +0 -0
  193. data/{test → spec/support}/mnt/aleph_tab/alephe/tab/tab_sub_library.eng +0 -0
  194. data/{test → spec/support}/mnt/aleph_tab/nyu50/tab/pc_tab_exp_field_extended.eng +0 -0
  195. data/{test/mnt/aleph_tab → spec/support/mnt/aleph_tab/nyu50/tab}/tab15.eng +2 -0
  196. data/{test → spec/support}/mnt/aleph_tab/nyu50/tab/tab16 +0 -0
  197. data/{test → spec/support}/mnt/aleph_tab/nyu50/tab/tab31 +0 -0
  198. data/{test → spec/support}/mnt/aleph_tab/nyu50/tab/tab37 +0 -0
  199. data/{test → spec/support}/mnt/aleph_tab/nyu50/tab/tab40.eng +0 -0
  200. data/{test → spec/support}/mnt/aleph_tab/nyu50/tab/tab_www_item_desc.eng +0 -0
  201. data/{test → spec/support}/mnt/aleph_tab/nyu51/tab/pc_tab_exp_field_extended.eng +0 -0
  202. data/{test → spec/support}/mnt/aleph_tab/nyu51/tab/tab15.eng +0 -0
  203. data/{test → spec/support}/mnt/aleph_tab/nyu51/tab/tab16 +0 -0
  204. data/{test → spec/support}/mnt/aleph_tab/nyu51/tab/tab31 +0 -0
  205. data/{test → spec/support}/mnt/aleph_tab/nyu51/tab/tab37 +0 -0
  206. data/{test → spec/support}/mnt/aleph_tab/nyu51/tab/tab40.eng +0 -0
  207. data/{test → spec/support}/mnt/aleph_tab/nyu51/tab/tab_www_item_desc.eng +0 -0
  208. data/spec/vcr_cassettes/patron.yml +1443 -0
  209. data/spec/vcr_cassettes/record.yml +763 -0
  210. metadata +351 -165
  211. data/lib/exlibris/aleph/abstract.rb +0 -28
  212. data/lib/exlibris/aleph/rest/base.rb +0 -56
  213. data/lib/exlibris/aleph/tab_helper.rb +0 -303
  214. data/lib/exlibris/aleph/tabs_parser/base.rb +0 -49
  215. data/lib/exlibris/aleph/tabs_parser/pc_tab_exp_field_extended.rb +0 -20
  216. data/lib/exlibris/aleph/tabs_parser/sub_library.rb +0 -32
  217. data/lib/exlibris/aleph/tabs_parser/tab15_by_item_process_status.rb +0 -33
  218. data/lib/exlibris/aleph/tabs_parser/tab15_by_item_status.rb +0 -33
  219. data/lib/exlibris/aleph/tabs_parser/tab31.rb +0 -39
  220. data/lib/exlibris/aleph/tabs_parser/tab37.rb +0 -63
  221. data/lib/exlibris/aleph/tabs_parser/tab40.rb +0 -20
  222. data/lib/exlibris/aleph/tabs_parser/tab_sub_library.rb +0 -21
  223. data/lib/exlibris/aleph/tabs_parser/tab_www_item_desc.rb +0 -20
  224. data/lib/exlibris/aleph/task_installer.rb +0 -25
  225. data/lib/exlibris/aleph/write_attributes.rb +0 -38
  226. data/lib/exlibris/aleph/xml_util.rb +0 -50
  227. data/lib/exlibris/aleph/xservice/bor_auth.rb +0 -47
  228. data/lib/tasks/exlibris-aleph_tasks.rake +0 -48
  229. data/test/config/aleph/alephe/sub_libraries.yml +0 -801
  230. data/test/config/aleph/nyu50/collections.yml +0 -1168
  231. data/test/config/aleph/nyu50/item_permissions_by_item_process_status.yml +0 -61876
  232. data/test/config/aleph/nyu50/item_permissions_by_item_status.yml +0 -17319
  233. data/test/config/aleph/nyu50/items.yml +0 -617
  234. data/test/config/aleph/nyu50/patron_permissions.yml +0 -19720
  235. data/test/config/aleph/nyu50/patrons.yml +0 -249
  236. data/test/config/aleph/nyu50/pickup_locations.yml +0 -2910
  237. data/test/config/aleph/nyu51/collections.yml +0 -41
  238. data/test/config/aleph/nyu51/item_permissions_by_item_process_status.yml +0 -7689
  239. data/test/config/aleph/nyu51/item_permissions_by_item_status.yml +0 -430
  240. data/test/config/aleph/nyu51/items.yml +0 -617
  241. data/test/config/aleph/nyu51/patron_permissions.yml +0 -6588
  242. data/test/config/aleph/nyu51/patrons.yml +0 -237
  243. data/test/config/aleph/nyu51/pickup_locations.yml +0 -456
  244. data/test/config_test.rb +0 -24
  245. data/test/exlibris-aleph_test.rb +0 -7
  246. data/test/mnt/aleph_tab/nyu50/tab/tab15.eng +0 -4742
  247. data/test/mnt/aleph_tab/pc_tab_exp_field_extended.eng +0 -158
  248. data/test/mnt/aleph_tab/tab16 +0 -3792
  249. data/test/mnt/aleph_tab/tab31 +0 -998
  250. data/test/mnt/aleph_tab/tab37 +0 -405
  251. data/test/mnt/aleph_tab/tab40.eng +0 -335
  252. data/test/mnt/aleph_tab/tab_sub_library.eng +0 -378
  253. data/test/mnt/aleph_tab/tab_www_item_desc.eng +0 -208
  254. data/test/patron_test.rb +0 -98
  255. data/test/record_benchmarks.rb +0 -26
  256. data/test/record_test.rb +0 -64
  257. data/test/support/config.yml +0 -2
  258. data/test/tab_helper_benchmarks.rb +0 -53
  259. data/test/tab_helper_test.rb +0 -192
  260. data/test/test_helper.rb +0 -46
  261. data/test/vcr_cassettes/bor_auth.yml +0 -42
  262. data/test/vcr_cassettes/patron.yml +0 -142
  263. data/test/vcr_cassettes/patron_address.yml +0 -45
  264. data/test/vcr_cassettes/patron_bogus_url.yml +0 -731
  265. data/test/vcr_cassettes/patron_error.yml +0 -93
  266. data/test/vcr_cassettes/record.yml +0 -146
  267. data/test/vcr_cassettes/record_bogus_url.yml +0 -690
  268. data/test/xservice/bor_auth_test.rb +0 -28
@@ -0,0 +1,65 @@
1
+ require 'spec_helper'
2
+ module Exlibris
3
+ module Aleph
4
+ module API
5
+ module Reader
6
+ class Patron
7
+ class Record
8
+ class Item
9
+ describe CreateHold do
10
+ let(:root) do
11
+ {
12
+ 'reply_text' => 'ok',
13
+ 'reply_code' => '0000',
14
+ 'create_hold' => {
15
+ 'note' => {
16
+ '__content__' => 'Action Succeeded',
17
+ 'type' => 'info'
18
+ }
19
+ }
20
+ }
21
+ end
22
+ subject(:hold) { CreateHold.new(root) }
23
+ it { should be_a CreateHold }
24
+ describe '#root' do
25
+ subject { hold.root }
26
+ it { should eq root }
27
+ end
28
+ describe '#note' do
29
+ subject { hold.note }
30
+ it { should eq 'Action Succeeded' }
31
+ end
32
+ describe '#type' do
33
+ subject { hold.type }
34
+ it { should eq 'info' }
35
+ end
36
+ context 'when the user does not have permission to place a hold' do
37
+ let(:root) do
38
+ {
39
+ 'reply_text' => 'Failed to create request',
40
+ 'reply_code' => '0025',
41
+ 'create_hold' => {
42
+ 'note' => {
43
+ '__content__' => 'Item or like copy is on shelf. Cannot place hold request.',
44
+ 'type' => 'error'
45
+ }
46
+ }
47
+ }
48
+ end
49
+ describe '#note' do
50
+ subject { hold.note }
51
+ it { should eq 'Item or like copy is on shelf. Cannot place hold request.' }
52
+ end
53
+ describe '#type' do
54
+ subject { hold.type }
55
+ it { should eq 'error' }
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,145 @@
1
+ require 'spec_helper'
2
+ module Exlibris
3
+ module Aleph
4
+ module API
5
+ module Reader
6
+ class Patron
7
+ class Record
8
+ class Item
9
+ describe Hold do
10
+ let(:pickup_locations) { nil }
11
+ let(:root) do
12
+ {
13
+ 'reply_text' => 'ok',
14
+ 'reply_code' => '0000',
15
+ 'hold' => {
16
+ 'note' => [
17
+ nil, {
18
+ '__content__' => 'Item status: Regular loan<br /> Call number: HN90.I56 K888 2003<br />',
19
+ 'type' => 'info'
20
+ }
21
+ ],
22
+ 'last_interest_date' => {
23
+ '__content__' => '20140915',
24
+ 'usage' => 'Optional'
25
+ },
26
+ 'start_interest_date' => {
27
+ 'usage' => 'Optional'
28
+ },
29
+ 'sub_author' => {
30
+ 'usage' => 'Optional',
31
+ 'max_len' => '50'
32
+ },
33
+ 'sub_title' => {
34
+ 'usage' => 'Optional',
35
+ 'max_len' => '100'
36
+ },
37
+ 'pages' => {
38
+ 'usage' => 'Optional',
39
+ 'max_len' => '30'
40
+ },
41
+ 'note_1' => {
42
+ 'usage' => 'Optional',
43
+ 'max_len' => '50'
44
+ },
45
+ 'note_2' => {
46
+ 'usage' => 'Optional',
47
+ 'max_len' => '50'
48
+ },
49
+ 'rush' => {
50
+ 'usage' => 'Optional'
51
+ },
52
+ 'allowed' => 'Y'
53
+ }
54
+ }
55
+ end
56
+ before { root['hold']['pickup_locations'] = pickup_locations }
57
+ subject(:hold) { Hold.new(root) }
58
+ it { should be_a Hold }
59
+ describe '#root' do
60
+ subject { hold.root }
61
+ it { should eq root }
62
+ end
63
+ describe '#allowed' do
64
+ subject { hold.allowed }
65
+ it { should eq 'Y' }
66
+ end
67
+ describe '#pickup_locations' do
68
+ subject { hold.pickup_locations }
69
+ it { should be_an Array }
70
+ context 'when pickup locations is nil' do
71
+ let(:pickup_locations) { nil }
72
+ it { should be_an Array }
73
+ it { should be_empty }
74
+ end
75
+ context 'when there are no pickup locations' do
76
+ let(:pickup_locations) { {'usage' => 'Mandatory'} }
77
+ it { should be_an Array }
78
+ it { should be_empty }
79
+ end
80
+ context 'when there is only one pickup location' do
81
+ let(:pickup_locations) do
82
+ {
83
+ 'pickup_location' => {
84
+ '__content__' => 'NYU Bobst',
85
+ 'code' => 'BOBST'
86
+ },
87
+ 'default' => 'Y',
88
+ 'usage' => 'Mandatory'
89
+ }
90
+ end
91
+ it { should be_an Array }
92
+ it { should_not be_empty }
93
+ end
94
+ context 'when there are multiple pickup locations' do
95
+ let(:pickup_locations) do
96
+ {
97
+ 'pickup_location' => [
98
+ {
99
+ '__content__' => 'NYU Bobst',
100
+ 'code' => 'BOBST'
101
+ }, {
102
+ '__content__' => 'NYU Courant',
103
+ 'code' => 'NCOUR'
104
+ }, {
105
+ '__content__' => 'NYU Institute of Fine Arts',
106
+ 'code' => 'NIFA'
107
+ }, {
108
+ '__content__' => 'NYU Inst Study Ancient World',
109
+ 'code' => 'NISAW'
110
+ }, {
111
+ '__content__' => 'NYU Jack Brause',
112
+ 'code' => 'NREI'
113
+ }, {
114
+ '__content__' => 'NYU Poly',
115
+ 'code' => 'NPOLY'
116
+ }, {
117
+ '__content__' => 'NYU Abu Dhabi Library (UAE)',
118
+ 'code' => 'NYUAB'
119
+ }, {
120
+ '__content__' => 'NYUAD Ctr for Sci & Eng (UAE)',
121
+ 'code' => 'NYUSE'
122
+ }, {
123
+ '__content__' => 'NYUAD Sama Fac Offices (UAE)',
124
+ 'code' => 'NYUSS'
125
+ }, {
126
+ '__content__' => 'NYU Shanghai Library (China)',
127
+ 'code' => 'NYUSX'
128
+ }
129
+ ],
130
+ 'default' => 'Y',
131
+ 'usage' => 'Mandatory'
132
+ }
133
+ end
134
+ it { should be_an Array }
135
+ it { should_not be_empty }
136
+ end
137
+ end
138
+ end
139
+ end
140
+ end
141
+ end
142
+ end
143
+ end
144
+ end
145
+ end
@@ -0,0 +1,266 @@
1
+ require 'spec_helper'
2
+ module Exlibris
3
+ module Aleph
4
+ module API
5
+ module Reader
6
+ class Patron
7
+ class Record
8
+ describe Item do
9
+ let(:pickup_locations) { nil }
10
+ let(:root) do
11
+ {
12
+ 'reply_text' => 'ok',
13
+ 'reply_code' => '0000',
14
+ 'item' => {
15
+ 'z30_sub_library_code' => 'TNSGI',
16
+ 'z30_item_process_status_code' => 'DM',
17
+ 'z30_item_status_code' => '04',
18
+ 'z30_collection_code' => 'SPCLP',
19
+ 'queue' => '1 request(s) of 1 items.',
20
+ 'z30' => {
21
+ 'translate_change_active_library' => 'NYU50',
22
+ 'z30_doc_number' => '001951476',
23
+ 'z30_item_sequence' => ' 122.0',
24
+ 'z30_barcode' => '31207026692263',
25
+ 'z30_sub_library' => 'New School University Center',
26
+ 'z30_material' => 'Issue (bound)',
27
+ 'z30_item_status' => 'Ask at Reference',
28
+ 'z30_open_date' => '20110510',
29
+ 'z30_update_date' => '20140317',
30
+ 'z30_cataloger' => 'LOORC',
31
+ 'z30_date_last_return' => '20140206',
32
+ 'z30_hour_last_return' => '1151',
33
+ 'z30_ip_last_return' => '149.31.214.133',
34
+ 'z30_no_loans' => '001',
35
+ 'z30_alpha' => 'L',
36
+ 'z30_collection' => 'SpecCol Periodicals',
37
+ 'z30_call_no_type' => nil,
38
+ 'z30_call_no' => 'Non-circulating',
39
+ 'z30_call_no_key' => '$$mnon-circulating',
40
+ 'z30_call_no_2_type' => nil,
41
+ 'z30_call_no_2' => nil,
42
+ 'z30_call_no_2_key' => nil,
43
+ 'z30_description' => 'no.1(1991:spring)',
44
+ 'z30_note_opac' => 'Spring',
45
+ 'z30_note_circulation' => nil,
46
+ 'z30_note_internal' => 'Numbered limited edition /1000.',
47
+ 'z30_order_number' => nil,
48
+ 'z30_inventory_number' => nil,
49
+ 'z30_inventory_number_date' => '00000000',
50
+ 'z30_last_shelf_report_date' => '00000000',
51
+ 'z30_price' => nil, 'z30_shelf_report_number' => nil,
52
+ 'z30_on_shelf_date' => '00000000',
53
+ 'z30_on_shelf_seq' => '000000',
54
+ 'z30_doc_number_2' => '000000000',
55
+ 'z30_schedule_sequence_2' => '00000',
56
+ 'z30_copy_sequence_2' => '00000',
57
+ 'z30_vendor_code' => nil,
58
+ 'z30_invoice_number' => nil,
59
+ 'z30_line_number' => '00000',
60
+ 'z30_pages' => nil,
61
+ 'z30_issue_date' => '20110510',
62
+ 'z30_expected_arrival_date' => '20110510',
63
+ 'z30_arrival_date' => '20110510',
64
+ 'z30_item_statistic' => nil,
65
+ 'z30_item_process_status' => 'Depository mediated',
66
+ 'z30_copy_id' => nil,
67
+ 'z30_hol_doc_number' => '000036718',
68
+ 'z30_temp_location' => 'No',
69
+ 'z30_enumeration_a' => '1',
70
+ 'z30_enumeration_b' => nil,
71
+ 'z30_enumeration_c' => nil,
72
+ 'z30_enumeration_d' => nil,
73
+ 'z30_enumeration_e' => nil,
74
+ 'z30_enumeration_f' => nil,
75
+ 'z30_enumeration_g' => nil,
76
+ 'z30_enumeration_h' => nil,
77
+ 'z30_chronological_i' => '1991',
78
+ 'z30_chronological_j' => '21',
79
+ 'z30_chronological_k' => nil,
80
+ 'z30_chronological_l' => nil,
81
+ 'z30_chronological_m' => nil,
82
+ 'z30_supp_index_o' => nil,
83
+ 'z30_85x_type' => '3',
84
+ 'z30_depository_id' => 'TNSRS',
85
+ 'z30_linking_number' => '000000001',
86
+ 'z30_gap_indicator' => nil,
87
+ 'z30_maintenance_count' => '000',
88
+ 'z30_process_status_date' => '20140317'
89
+ },
90
+ 'z13' => {
91
+ 'translate_change_active_library' => 'NYU50',
92
+ 'z13_doc_number' => '001951476',
93
+ 'z13_year' => '1991',
94
+ 'z13_open_date' => '20080618',
95
+ 'z13_update_date' => '20140328',
96
+ 'z13_call_no_key' => nil,
97
+ 'z13_call_no_code' => 'LOC',
98
+ 'z13_call_no' => nil,
99
+ 'z13_author_code' => nil,
100
+ 'z13_author' => nil,
101
+ 'z13_title_code' => '24500',
102
+ 'z13_title' => 'Visionaire.',
103
+ 'z13_imprint_code' => '260',
104
+ 'z13_imprint' => '[New York] : Visionaire Publishing, c1991-',
105
+ 'z13_isbn_issn_code' => nil, 'z13_isbn_issn' => nil
106
+ },
107
+ 'status' => 'On Hold',
108
+ 'info' => [
109
+ {
110
+ 'note' => {
111
+ '__content__' => 'Item cannot be requested (tab15).',
112
+ 'type' => 'error'
113
+ },
114
+ 'type' => 'HoldRequest',
115
+ 'href' => 'http://aleph.library.nyu.edu:1891/rest-dlf/patron/BOR_ID/record/NYU01000980206/items/NYU50001951476001220/hold',
116
+ 'allowed' => 'N'
117
+ },
118
+ {
119
+ 'note' => {
120
+ '__content__' => 'The item has no short loan schedule',
121
+ 'type' => 'error'
122
+ },
123
+ 'type' => 'ShortLoan',
124
+ 'href' => 'http://aleph.library.nyu.edu:1891/rest-dlf/patron/BOR_ID/record/NYU01000980206/items/NYU50001951476001220/shortLoan',
125
+ 'allowed' => 'N'
126
+ },
127
+ {
128
+ 'note' => {
129
+ '__content__' => 'Item cannot be photocopied (tab15).',
130
+ 'type' => 'error'
131
+ },
132
+ 'adm_library' => 'NYU50',
133
+ 'adm_doc_number' => '001951476',
134
+ 'item_sequence' => '001220',
135
+ 'type' => 'PhotocopyRequest',
136
+ 'allowed' => 'N'
137
+ },
138
+ {
139
+ 'note' => {
140
+ '__content__' => 'Item cannot be booked (tab15).',
141
+ 'type' => 'error'
142
+ },
143
+ 'adm_library' => 'NYU50',
144
+ 'adm_doc_number' => '001951476',
145
+ 'item_sequence' => '001220',
146
+ 'exact_item' => 'Y',
147
+ 'type' => 'BookingRequest',
148
+ 'allowed' => 'N'
149
+ }
150
+ ]
151
+ }
152
+ }
153
+ end
154
+ let(:info) { root['item']['info'] }
155
+ before do
156
+ info.first['hold'] = { 'pickup_locations' => pickup_locations }
157
+ end
158
+ subject(:item) { Item.new(root) }
159
+ it { should be_a Item }
160
+ describe '#root' do
161
+ subject { item.root }
162
+ it { should eq root }
163
+ end
164
+ describe '#pickup_locations' do
165
+ subject { item.pickup_locations }
166
+ it { should be_an Array }
167
+ context 'when pickup locations is nil' do
168
+ let(:pickup_locations) { nil }
169
+ it { should be_an Array }
170
+ it { should be_empty }
171
+ end
172
+ context 'when there are no pickup locations' do
173
+ let(:pickup_locations) { {'usage' => 'Mandatory'} }
174
+ it { should be_an Array }
175
+ it { should be_empty }
176
+ end
177
+ context 'when there is only one pickup location' do
178
+ let(:pickup_locations) do
179
+ {
180
+ 'pickup_location' => {
181
+ '__content__' => 'NYU Bobst',
182
+ 'code' => 'BOBST'
183
+ },
184
+ 'default' => 'Y',
185
+ 'usage' => 'Mandatory'
186
+ }
187
+ end
188
+ it { should be_an Array }
189
+ it { should_not be_empty }
190
+ end
191
+ context 'when the item has multiple pickup locations' do
192
+ let(:pickup_locations) do
193
+ {
194
+ 'pickup_location' => [
195
+ {
196
+ '__content__' => 'NYU Bobst',
197
+ 'code' => 'BOBST'
198
+ },
199
+ {
200
+ '__content__' => 'NYU Courant',
201
+ 'code' => 'NCOUR'
202
+ },
203
+ {
204
+ '__content__' => 'NYU Institute of Fine Arts',
205
+ 'code' => 'NIFA'
206
+ },
207
+ {
208
+ '__content__' => 'NYU Inst Study Ancient World',
209
+ 'code' => 'NISAW'
210
+ },
211
+ {
212
+ '__content__' => 'NYU Jack Brause',
213
+ 'code' => 'NREI'
214
+ },
215
+ {
216
+ '__content__' => 'NYU Poly',
217
+ 'code' => 'NPOLY'
218
+ },
219
+ {
220
+ '__content__' => 'NYU Abu Dhabi Library (UAE)',
221
+ 'code' => 'NYUAB'
222
+ },
223
+ {
224
+ '__content__' => 'NYUAD Ctr for Sci & Eng (UAE)',
225
+ 'code' => 'NYUSE'
226
+ },
227
+ {
228
+ '__content__' => 'NYUAD Sama Fac Offices (UAE)',
229
+ 'code' => 'NYUSS'
230
+ },
231
+ {
232
+ '__content__' => 'NYU Shanghai Library (China)',
233
+ 'code' => 'NYUSX'
234
+ }
235
+ ],
236
+ 'default' => 'Y',
237
+ 'usage' => 'Mandatory'
238
+ }
239
+ end
240
+ it { should be_an Array }
241
+ it { should_not be_empty }
242
+ end
243
+ end
244
+ describe '#hold_request' do
245
+ subject { item.hold_request }
246
+ it { should eq 'N' }
247
+ end
248
+ describe '#short_loan' do
249
+ subject { item.short_loan }
250
+ it { should eq 'N' }
251
+ end
252
+ describe '#photocopy_request' do
253
+ subject { item.photocopy_request }
254
+ it { should eq 'N' }
255
+ end
256
+ describe '#booking_request' do
257
+ subject { item.booking_request }
258
+ it { should eq 'N' }
259
+ end
260
+ end
261
+ end
262
+ end
263
+ end
264
+ end
265
+ end
266
+ end