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,17 @@
1
+ module Exlibris
2
+ module Aleph
3
+ describe Config do
4
+ subject(:config) { Config }
5
+ describe '.admin_libraries' do
6
+ subject { Config.admin_libraries }
7
+ it { should be_an Array }
8
+ it { should_not be_empty }
9
+ it 'should contain AdminLibraries' do
10
+ subject.each do |admin_library|
11
+ expect(admin_library).to be_an AdminLibrary
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,57 @@
1
+ require 'spec_helper'
2
+ module Exlibris
3
+ module Aleph
4
+ class Holding
5
+ describe Metadata do
6
+ let(:marc_xml) { %Q{
7
+ <holding>
8
+ <leader>cxH a22001092 4500</leader>
9
+ <controlfield tag="001">002367980</controlfield>
10
+ <controlfield tag="004">NYUb12672786</controlfield>
11
+ <controlfield tag="005">20080531131729.0</controlfield>
12
+ <controlfield tag="008">0510170|||||8 |001|||||0051017</controlfield>
13
+ <datafield tag="010" ind1=" " ind2=" ">
14
+ <subfield code="a">2002030296</subfield>
15
+ </datafield>
16
+ <datafield tag="020" ind1=" " ind2=" ">
17
+ <subfield code="a">0810844915 (alk. paper)</subfield>
18
+ </datafield>
19
+ <datafield tag="035" ind1="9" ind2=" ">
20
+ <subfield code="a">NYUH12672786/13890243</subfield>
21
+ </datafield>
22
+ <datafield tag="852" ind1="0" ind2=" ">
23
+ <subfield code="a">NNCoo</subfield>
24
+ <subfield code="b">CU</subfield>
25
+ <subfield code="c">MAIN</subfield>
26
+ <subfield code="h">HN90.I56</subfield>
27
+ <subfield code="i">K888 2003</subfield>
28
+ <subfield code="p">31206028778120</subfield>
29
+ <subfield code="7">13890243</subfield>
30
+ </datafield>
31
+ </holding>
32
+ }}
33
+ subject(:metadata) { Metadata.new(marc_xml) }
34
+ describe '#marc_xml' do
35
+ subject { metadata.marc_xml }
36
+ it { should eq marc_xml.strip.gsub('holding>', 'record>') }
37
+ end
38
+ describe '#marc_record' do
39
+ subject { metadata.marc_record }
40
+ it { should be_a MARC::Record }
41
+ end
42
+ describe '#location' do
43
+ subject { metadata.location }
44
+ it { should be_a MARC::DataField }
45
+ end
46
+ describe '#sub_location' do
47
+ subject { metadata.sub_location }
48
+ it { should eq 'CU' }
49
+ end
50
+ describe '#shelving_location' do
51
+ subject { metadata.shelving_location }
52
+ it { should eq 'MAIN' }
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,53 @@
1
+ require 'spec_helper'
2
+ module Exlibris
3
+ module Aleph
4
+ describe Holding, vcr: {cassette_name: 'record', record: :new_episodes} do
5
+ let(:record_id) { 'NYU01000864162' }
6
+ let(:id) { 'NYU60002367980' }
7
+ let(:tables_manager) { TablesManager.instance }
8
+ subject(:holding) { Holding.new(record_id, id) }
9
+ it { should be_a Holding }
10
+ describe '#record_id' do
11
+ subject { holding.record_id }
12
+ it { should eq record_id }
13
+ end
14
+ describe '#id' do
15
+ subject { holding.id }
16
+ it { should eq id }
17
+ end
18
+ describe '#metadata' do
19
+ subject { holding.metadata }
20
+ it { should be_a Holding::Metadata }
21
+ end
22
+ describe '#collection' do
23
+ let(:sub_libraries) { tables_manager.sub_libraries }
24
+ let(:sub_library) do
25
+ sub_libraries.find do |sub_library|
26
+ sub_library.code == 'CU'
27
+ end
28
+ end
29
+ let(:collections) { tables_manager.collections }
30
+ let(:admin_library) { sub_library.admin_library }
31
+ let(:collection) do
32
+ collections[admin_library].find do |collection|
33
+ collection.code == 'MAIN' && collection.sub_library == sub_library
34
+ end
35
+ end
36
+ subject { holding.collection }
37
+ it { should be_a Collection }
38
+ it { should eq collection }
39
+ end
40
+ context 'when the holding does not exist' do
41
+ let(:id) { 'ADM60' }
42
+ describe '#metadata' do
43
+ subject { holding.metadata }
44
+ it { should be_nil }
45
+ end
46
+ describe '#collection' do
47
+ subject { holding.collection }
48
+ it { should be_nil }
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,59 @@
1
+ require 'spec_helper'
2
+ module Exlibris
3
+ module Aleph
4
+ describe Holdings, vcr: {cassette_name: 'record', record: :new_episodes} do
5
+ let(:record_id) { 'NYU01000864162' }
6
+ subject(:holdings) { Holdings.new(record_id) }
7
+ it { should be_an Holdings }
8
+ describe '#record_id' do
9
+ subject { holdings.record_id }
10
+ it { should eq record_id }
11
+ end
12
+ describe '#each' do
13
+ subject { holdings.each }
14
+ it { should be_an Enumerable }
15
+ end
16
+ describe '#size' do
17
+ subject { holdings.size }
18
+ it { should eq 2 }
19
+ end
20
+ describe '#to_a' do
21
+ subject { holdings.to_a }
22
+ it { should be_an Array }
23
+ it 'should contain Holdings' do
24
+ subject.each do |holding|
25
+ expect(holding).to be_a Holding
26
+ end
27
+ end
28
+ end
29
+ context 'when there is only one holding' do
30
+ let(:record_id) { 'NYU01003415726' }
31
+ describe '#size' do
32
+ subject { holdings.size }
33
+ it { should eq 1 }
34
+ end
35
+ describe '#to_a' do
36
+ subject { holdings.to_a }
37
+ it { should be_an Array }
38
+ it 'should contain Holdings' do
39
+ subject.each do |holding|
40
+ expect(holding).to be_a Holding
41
+ end
42
+ end
43
+ end
44
+ end
45
+ context 'when there are no holdings' do
46
+ let(:record_id) { 'NYU01000000000' }
47
+ describe '#size' do
48
+ subject { holdings.size }
49
+ it { should eq 0 }
50
+ end
51
+ describe '#to_a' do
52
+ subject { holdings.to_a }
53
+ it { should be_an Array }
54
+ it { should be_empty }
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+ module Exlibris
3
+ module Aleph
4
+ class Item
5
+ describe CallNumber do
6
+ let(:classification) { }
7
+ let(:description) { }
8
+ subject(:call_number) { CallNumber.new(classification, description) }
9
+ describe '#classification' do
10
+ subject { call_number.classification }
11
+ it { should eq classification }
12
+ end
13
+ describe '#description' do
14
+ subject { call_number.description }
15
+ it { should eq description }
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,33 @@
1
+ require 'spec_helper'
2
+ module Exlibris
3
+ module Aleph
4
+ class Item
5
+ class CirculationPolicy
6
+ describe Display do
7
+ let(:value) { 'Display' }
8
+ let(:mask) { 'Display Mask' }
9
+ subject(:display) { Display.new(value, mask) }
10
+ it { should be_a Display }
11
+ describe '#value' do
12
+ subject { display.value }
13
+ it { should eq value }
14
+ end
15
+ describe '#mask' do
16
+ subject { display.mask }
17
+ it { should eq mask }
18
+ context 'when the mask is not given' do
19
+ let(:display) { Display.new(value) }
20
+ it { should eq value }
21
+ end
22
+ context 'when the mask is given' do
23
+ context 'and the mask is nil' do
24
+ let(:mask) { nil }
25
+ it { should eq value }
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,154 @@
1
+ require 'spec_helper'
2
+ module Exlibris
3
+ module Aleph
4
+ class Item
5
+ class CirculationPolicy
6
+ describe Identifier do
7
+ let(:status_code) { '##' }
8
+ let(:status) { Status.new(status_code) }
9
+ let(:processing_status_code) { 'DP' }
10
+ let(:processing_status) { ProcessingStatus.new(processing_status_code) }
11
+ let(:admin_library) { AdminLibrary.new('ADM50') }
12
+ let(:sub_library) { SubLibrary.new('SUB', 'Sub Library', admin_library) }
13
+ subject(:identifier) { Identifier.new(status, processing_status, sub_library) }
14
+ it { should be_a Identifier }
15
+ describe '#status' do
16
+ subject { identifier.status }
17
+ it { should be_a Status }
18
+ it { should eq status }
19
+ end
20
+ describe '#processing_status' do
21
+ subject { identifier.processing_status }
22
+ it { should be_a ProcessingStatus }
23
+ it { should eq processing_status }
24
+ end
25
+ describe '#sub_library' do
26
+ subject { identifier.sub_library }
27
+ it { should be_a SubLibrary }
28
+ it { should eq sub_library }
29
+ end
30
+ describe '#==' do
31
+ subject { identifier == other_object }
32
+ context 'when the other object is an Item::CirculationPolicy::Identifier' do
33
+ let(:other_status) { status }
34
+ let(:other_processing_status) { processing_status }
35
+ let(:other_sub_library) { sub_library }
36
+ let(:other_object) { Identifier.new(other_status, other_processing_status, other_sub_library) }
37
+ context 'but the status of the other object is different' do
38
+ let(:other_status) { Status.new('01') }
39
+ it { should be_false }
40
+ end
41
+ context 'and the status of the other object is the same' do
42
+ context 'but the processing status of the other object is different' do
43
+ let(:other_processing_status) { ProcessingStatus.new('##') }
44
+ it { should be_false }
45
+ end
46
+ context 'and the processing status of the other object is the same' do
47
+ context 'but the sub library of the other object is different' do
48
+ let(:other_sub_library) { SubLibrary.new('SUB1', 'Sub Library 1', admin_library) }
49
+ it { should be_false }
50
+ end
51
+ context 'and the sub library of the other object is the same' do
52
+ it { should be_true }
53
+ end
54
+ end
55
+ end
56
+ end
57
+ context 'when the other object is not an Item::CirculationPolicy::Identifier' do
58
+ let(:other_object) { "invalid" }
59
+ it { should be_false }
60
+ end
61
+ end
62
+ describe '#===' do
63
+ subject { identifier === other_object }
64
+ context 'when the other object is an Item::CirculationPolicy::Identifier' do
65
+ let(:other_status) { status }
66
+ let(:other_processing_status) { processing_status }
67
+ let(:other_sub_library) { sub_library }
68
+ let(:other_object) { Identifier.new(other_status, other_processing_status, other_sub_library) }
69
+ context 'but the status of the other object is different' do
70
+ let(:other_status) { Status.new('01') }
71
+ it { should be_false }
72
+ end
73
+ context 'and the status of the other object is the same' do
74
+ context 'but the processing status of the other object is different' do
75
+ let(:other_processing_status) { ProcessingStatus.new('##') }
76
+ it { should be_false }
77
+ end
78
+ context 'and the processing status of the other object is the same' do
79
+ context 'but the sub library of the other object is different' do
80
+ let(:other_sub_library) { SubLibrary.new('SUB1', 'Sub Library 1', admin_library) }
81
+ it { should be_false }
82
+ end
83
+ context 'and the sub library of the other object is the same' do
84
+ it { should be_true }
85
+ end
86
+ end
87
+ end
88
+ end
89
+ context 'when the other object is not an Item::CirculationPolicy::Identifier' do
90
+ let(:other_object) { "invalid" }
91
+ it { should be_false }
92
+ end
93
+ end
94
+ describe '#eql?' do
95
+ subject { identifier.eql?(other_object) }
96
+ context 'when the other object is an Item::CirculationPolicy::Identifier' do
97
+ let(:other_status) { status }
98
+ let(:other_processing_status) { processing_status }
99
+ let(:other_sub_library) { sub_library }
100
+ let(:other_object) { Identifier.new(other_status, other_processing_status, other_sub_library) }
101
+ context 'but the status of the other object is different' do
102
+ let(:other_status) { Status.new('01') }
103
+ it { should be_false }
104
+ end
105
+ context 'and the status of the other object is the same' do
106
+ context 'but the processing status of the other object is different' do
107
+ let(:other_processing_status) { ProcessingStatus.new('##') }
108
+ it { should be_false }
109
+ end
110
+ context 'and the processing status of the other object is the same' do
111
+ context 'but the sub library of the other object is different' do
112
+ let(:other_sub_library) { SubLibrary.new('SUB1', 'Sub Library 1', admin_library) }
113
+ it { should be_false }
114
+ end
115
+ context 'and the sub library of the other object is the same' do
116
+ it { should be_true }
117
+ end
118
+ end
119
+ end
120
+ end
121
+ context 'when the other object is not an Item::CirculationPolicy::Identifier' do
122
+ let(:other_object) { "invalid" }
123
+ it { should be_false }
124
+ end
125
+ end
126
+ context 'when initialized with arguments' do
127
+ context 'but the "status" argument is not an Item::Status' do
128
+ let(:status) { "invalid" }
129
+ it 'should raise an ArgumentError' do
130
+ expect { subject }.to raise_error ArgumentError
131
+ end
132
+ end
133
+ context 'and the "status" argument is an Item::Status' do
134
+ context 'but the "processing status" argument is not an Item::ProcessingStatus' do
135
+ let(:processing_status) { "invalid" }
136
+ it 'should raise an ArgumentError' do
137
+ expect { subject }.to raise_error ArgumentError
138
+ end
139
+ end
140
+ context 'and the "processing status" argument is an Item::ProcessingStatus' do
141
+ context 'but the "sub library" argument is not a SubLibrary' do
142
+ let(:sub_library) { "invalid" }
143
+ it 'should raise an ArgumentError' do
144
+ expect { subject }.to raise_error ArgumentError
145
+ end
146
+ end
147
+ end
148
+ end
149
+ end
150
+ end
151
+ end
152
+ end
153
+ end
154
+ end
@@ -0,0 +1,183 @@
1
+ require 'spec_helper'
2
+ module Exlibris
3
+ module Aleph
4
+ class Item
5
+ class CirculationPolicy
6
+ describe Privileges do
7
+ let(:row) { double }
8
+ let(:loanable) { 'Y' }
9
+ let(:renewable) { 'Y' }
10
+ let(:requestable) { 'Y' }
11
+ let(:photocopyable) { 'Y' }
12
+ let(:displayable) { 'Y' }
13
+ let(:specific_item) { 'Y' }
14
+ let(:limit_hold) { 'Y' }
15
+ let(:recallable) { 'Y' }
16
+ let(:rush_recallable) { 'Y' }
17
+ let(:reloaning_limit) { '00' }
18
+ let(:bookable) { 'Y' }
19
+ let(:booking_hours) { 'A' }
20
+ before do
21
+ allow(row).to receive(:loanable).and_return(loanable)
22
+ allow(row).to receive(:renewable).and_return(renewable)
23
+ allow(row).to receive(:requestable).and_return(requestable)
24
+ allow(row).to receive(:photocopyable).and_return(photocopyable)
25
+ allow(row).to receive(:displayable).and_return(displayable)
26
+ allow(row).to receive(:specific_item).and_return(specific_item)
27
+ allow(row).to receive(:limit_hold).and_return(limit_hold)
28
+ allow(row).to receive(:recallable).and_return(recallable)
29
+ allow(row).to receive(:rush_recallable).and_return(rush_recallable)
30
+ allow(row).to receive(:reloaning_limit).and_return(reloaning_limit)
31
+ allow(row).to receive(:bookable).and_return(bookable)
32
+ allow(row).to receive(:booking_hours).and_return(booking_hours)
33
+ end
34
+ subject(:privileges) { Privileges.new(row) }
35
+ describe '#loanable' do
36
+ subject { privileges.loanable }
37
+ it { should eq loanable }
38
+ end
39
+ describe '#loanable?' do
40
+ subject { privileges.loanable? }
41
+ it { should be_true }
42
+ context 'when the item is not loanable' do
43
+ let(:loanable) { 'N' }
44
+ it { should be_false }
45
+ end
46
+ end
47
+ describe '#renewable' do
48
+ subject { privileges.renewable }
49
+ it { should eq renewable }
50
+ end
51
+ describe '#renewable?' do
52
+ subject { privileges.renewable? }
53
+ it { should be_true }
54
+ context 'when the item is not renewable' do
55
+ let(:renewable) { 'N' }
56
+ it { should be_false }
57
+ end
58
+ end
59
+ describe '#requestable' do
60
+ subject { privileges.requestable }
61
+ it { should eq requestable }
62
+ end
63
+ describe '#requestable?' do
64
+ subject { privileges.requestable? }
65
+ it { should be_true }
66
+ context 'when the item is not requestable' do
67
+ let(:requestable) { 'N' }
68
+ it { should be_false }
69
+ end
70
+ context 'when the item is always requestable' do
71
+ let(:requestable) { 'C' }
72
+ it { should be_true }
73
+ end
74
+ end
75
+ describe '#always_requestable?' do
76
+ subject { privileges.always_requestable? }
77
+ it { should be_false }
78
+ context 'when the item is not requestable' do
79
+ let(:requestable) { 'N' }
80
+ it { should be_false }
81
+ end
82
+ context 'when the item is always requestable' do
83
+ let(:requestable) { 'C' }
84
+ it { should be_true }
85
+ end
86
+ end
87
+ describe '#photocopyable' do
88
+ subject { privileges.photocopyable }
89
+ it { should eq photocopyable }
90
+ end
91
+ describe '#photocopyable?' do
92
+ subject { privileges.photocopyable? }
93
+ it { should be_true }
94
+ context 'when the item is not photocopyable' do
95
+ let(:photocopyable) { 'N' }
96
+ it { should be_false }
97
+ end
98
+ end
99
+ describe '#displayable' do
100
+ subject { privileges.displayable }
101
+ it { should eq displayable }
102
+ end
103
+ describe '#displayable?' do
104
+ subject { privileges.displayable? }
105
+ it { should be_true }
106
+ context 'when the item is not displayable' do
107
+ let(:displayable) { 'N' }
108
+ it { should be_false }
109
+ end
110
+ end
111
+ describe '#specific_item' do
112
+ subject { privileges.specific_item }
113
+ it { should eq specific_item }
114
+ end
115
+ describe '#specific_item?' do
116
+ subject { privileges.specific_item? }
117
+ it { should be_true }
118
+ context 'when item requests are not for specific items' do
119
+ let(:specific_item) { 'N' }
120
+ it { should be_false }
121
+ end
122
+ end
123
+ describe '#limit_hold' do
124
+ subject { privileges.limit_hold }
125
+ it { should eq limit_hold }
126
+ end
127
+ describe '#limit_hold?' do
128
+ subject { privileges.limit_hold? }
129
+ it { should be_true }
130
+ context 'when the item is has no hold limit' do
131
+ let(:limit_hold) { 'N' }
132
+ it { should be_false }
133
+ end
134
+ end
135
+ describe '#recallable' do
136
+ subject { privileges.recallable }
137
+ it { should eq recallable }
138
+ end
139
+ describe '#recallable?' do
140
+ subject { privileges.recallable? }
141
+ it { should be_true }
142
+ context 'when the item is not recallable' do
143
+ let(:recallable) { 'N' }
144
+ it { should be_false }
145
+ end
146
+ end
147
+ describe '#rush_recallable' do
148
+ subject { privileges.rush_recallable }
149
+ it { should eq rush_recallable }
150
+ end
151
+ describe '#rush_recallable?' do
152
+ subject { privileges.rush_recallable? }
153
+ it { should be_true }
154
+ context 'when the item is not "rush" recallable' do
155
+ let(:rush_recallable) { 'N' }
156
+ it { should be_false }
157
+ end
158
+ end
159
+ describe '#reloaning_limit' do
160
+ subject { privileges.reloaning_limit }
161
+ it { should eq reloaning_limit }
162
+ end
163
+ describe '#bookable' do
164
+ subject { privileges.bookable }
165
+ it { should eq bookable }
166
+ end
167
+ describe '#bookable?' do
168
+ subject { privileges.bookable? }
169
+ it { should be_true }
170
+ context 'when the item is not bookable' do
171
+ let(:bookable) { 'N' }
172
+ it { should be_false }
173
+ end
174
+ end
175
+ describe '#booking_hours' do
176
+ subject { privileges.booking_hours }
177
+ it { should eq booking_hours }
178
+ end
179
+ end
180
+ end
181
+ end
182
+ end
183
+ end