exlibris-aleph 1.1.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +199 -82
- data/Rakefile +8 -14
- data/lib/exlibris-aleph.rb +0 -3
- data/lib/exlibris/aleph/admin_library.rb +27 -0
- data/lib/exlibris/aleph/api/base.rb +27 -0
- data/lib/exlibris/aleph/api/client/base.rb +86 -0
- data/lib/exlibris/aleph/api/client/patron.rb +20 -0
- data/lib/exlibris/aleph/api/client/patron/address.rb +22 -0
- data/lib/exlibris/aleph/api/client/patron/record.rb +23 -0
- data/lib/exlibris/aleph/api/client/patron/record/item.rb +26 -0
- data/lib/exlibris/aleph/api/client/patron/record/item/create_hold.rb +31 -0
- data/lib/exlibris/aleph/api/client/patron/record/item/create_hold/parameters.rb +55 -0
- data/lib/exlibris/aleph/api/client/patron/record/item/hold.rb +29 -0
- data/lib/exlibris/aleph/api/client/patron/status.rb +22 -0
- data/lib/exlibris/aleph/api/client/record.rb +21 -0
- data/lib/exlibris/aleph/api/client/record/filters.rb +23 -0
- data/lib/exlibris/aleph/api/client/record/holding.rb +23 -0
- data/lib/exlibris/aleph/api/client/record/holdings.rb +23 -0
- data/lib/exlibris/aleph/api/client/record/item.rb +23 -0
- data/lib/exlibris/aleph/api/client/record/items.rb +23 -0
- data/lib/exlibris/aleph/api/reader/base.rb +15 -0
- data/lib/exlibris/aleph/api/reader/patron.rb +19 -0
- data/lib/exlibris/aleph/api/reader/patron/address.rb +90 -0
- data/lib/exlibris/aleph/api/reader/patron/record.rb +38 -0
- data/lib/exlibris/aleph/api/reader/patron/record/item.rb +77 -0
- data/lib/exlibris/aleph/api/reader/patron/record/item/create_hold.rb +33 -0
- data/lib/exlibris/aleph/api/reader/patron/record/item/hold.rb +56 -0
- data/lib/exlibris/aleph/api/reader/patron/status.rb +33 -0
- data/lib/exlibris/aleph/api/reader/record.rb +10 -0
- data/lib/exlibris/aleph/api/reader/record/item.rb +45 -0
- data/lib/exlibris/aleph/collection.rb +26 -0
- data/lib/exlibris/aleph/config.rb +17 -57
- data/lib/exlibris/aleph/holding.rb +59 -0
- data/lib/exlibris/aleph/holding/metadata.rb +28 -0
- data/lib/exlibris/aleph/holdings.rb +51 -0
- data/lib/exlibris/aleph/item.rb +138 -0
- data/lib/exlibris/aleph/item/call_number.rb +14 -0
- data/lib/exlibris/aleph/item/circulation_policy.rb +30 -0
- data/lib/exlibris/aleph/item/circulation_policy/display.rb +16 -0
- data/lib/exlibris/aleph/item/circulation_policy/identifier.rb +34 -0
- data/lib/exlibris/aleph/item/circulation_policy/privileges.rb +72 -0
- data/lib/exlibris/aleph/item/circulation_status.rb +31 -0
- data/lib/exlibris/aleph/item/display_mask.rb +19 -0
- data/lib/exlibris/aleph/item/opac_note.rb +17 -0
- data/lib/exlibris/aleph/item/processing_status.rb +23 -0
- data/lib/exlibris/aleph/item/queue.rb +32 -0
- data/lib/exlibris/aleph/item/status.rb +23 -0
- data/lib/exlibris/aleph/items.rb +51 -0
- data/lib/exlibris/aleph/metadata.rb +25 -0
- data/lib/exlibris/aleph/patron.rb +18 -82
- data/lib/exlibris/aleph/patron/address.rb +56 -0
- data/lib/exlibris/aleph/patron/circulation_policy.rb +26 -0
- data/lib/exlibris/aleph/patron/circulation_policy/identifier.rb +29 -0
- data/lib/exlibris/aleph/patron/circulation_policy/privileges.rb +56 -0
- data/lib/exlibris/aleph/patron/record.rb +39 -0
- data/lib/exlibris/aleph/patron/record/circulation_policy.rb +18 -0
- data/lib/exlibris/aleph/patron/record/circulation_policy/privileges.rb +42 -0
- data/lib/exlibris/aleph/patron/record/item.rb +63 -0
- data/lib/exlibris/aleph/patron/record/item/circulation_policy.rb +21 -0
- data/lib/exlibris/aleph/patron/record/item/circulation_policy/privileges.rb +39 -0
- data/lib/exlibris/aleph/patron/record/item/create_hold.rb +43 -0
- data/lib/exlibris/aleph/patron/record/item/hold.rb +41 -0
- data/lib/exlibris/aleph/patron/status.rb +19 -0
- data/lib/exlibris/aleph/pickup_location.rb +12 -0
- data/lib/exlibris/aleph/record.rb +14 -43
- data/lib/exlibris/aleph/record/metadata.rb +8 -0
- data/lib/exlibris/aleph/sub_library.rb +30 -0
- data/lib/exlibris/aleph/table/base.rb +22 -0
- data/lib/exlibris/aleph/table/collections.rb +17 -0
- data/lib/exlibris/aleph/table/item/circulation_policies.rb +65 -0
- data/lib/exlibris/aleph/table/item/display_masks.rb +19 -0
- data/lib/exlibris/aleph/table/patron/circulation_policies.rb +47 -0
- data/lib/exlibris/aleph/table/patron/statuses.rb +19 -0
- data/lib/exlibris/aleph/table/reader/base.rb +57 -0
- data/lib/exlibris/aleph/table/reader/collections.rb +35 -0
- data/lib/exlibris/aleph/table/reader/item_circulation_policies.rb +50 -0
- data/lib/exlibris/aleph/table/reader/item_display_masks.rb +19 -0
- data/lib/exlibris/aleph/table/reader/matcher/base.rb +30 -0
- data/lib/exlibris/aleph/table/reader/matcher/collections.rb +17 -0
- data/lib/exlibris/aleph/table/reader/matcher/item_circulation_policies.rb +17 -0
- data/lib/exlibris/aleph/table/reader/matcher/item_display_masks.rb +17 -0
- data/lib/exlibris/aleph/table/reader/matcher/patron_circulation_policies.rb +17 -0
- data/lib/exlibris/aleph/table/reader/matcher/patron_statuses.rb +17 -0
- data/lib/exlibris/aleph/table/reader/matcher/sub_libraries.rb +17 -0
- data/lib/exlibris/aleph/table/reader/patron_circulation_policies.rb +51 -0
- data/lib/exlibris/aleph/table/reader/patron_statuses.rb +19 -0
- data/lib/exlibris/aleph/table/reader/row/base.rb +25 -0
- data/lib/exlibris/aleph/table/reader/row/collections.rb +13 -0
- data/lib/exlibris/aleph/table/reader/row/item_circulation_policies.rb +17 -0
- data/lib/exlibris/aleph/table/reader/row/item_display_masks.rb +13 -0
- data/lib/exlibris/aleph/table/reader/row/patron_circulation_policies.rb +20 -0
- data/lib/exlibris/aleph/table/reader/row/patron_statuses.rb +13 -0
- data/lib/exlibris/aleph/table/reader/row/sub_libraries.rb +13 -0
- data/lib/exlibris/aleph/table/reader/sub_libraries.rb +32 -0
- data/lib/exlibris/aleph/table/sub_libraries.rb +11 -0
- data/lib/exlibris/aleph/tables_manager.rb +66 -0
- data/lib/exlibris/aleph/version.rb +1 -1
- data/spec/exlibris/aleph/admin_library_spec.rb +83 -0
- data/spec/exlibris/aleph/api/base_spec.rb +23 -0
- data/spec/exlibris/aleph/api/client/base_spec.rb +40 -0
- data/spec/exlibris/aleph/api/client/patron/address_spec.rb +40 -0
- data/spec/exlibris/aleph/api/client/patron/record/item/create_hold/parameters_spec.rb +101 -0
- data/spec/exlibris/aleph/api/client/patron/record/item/create_hold_spec.rb +102 -0
- data/spec/exlibris/aleph/api/client/patron/record/item/hold_spec.rb +89 -0
- data/spec/exlibris/aleph/api/client/patron/record/item_spec.rb +52 -0
- data/spec/exlibris/aleph/api/client/patron/record_spec.rb +45 -0
- data/spec/exlibris/aleph/api/client/patron/status_spec.rb +40 -0
- data/spec/exlibris/aleph/api/client/patron_spec.rb +38 -0
- data/spec/exlibris/aleph/api/client/record/filters_spec.rb +46 -0
- data/spec/exlibris/aleph/api/client/record/holding_spec.rb +41 -0
- data/spec/exlibris/aleph/api/client/record/holdings_spec.rb +46 -0
- data/spec/exlibris/aleph/api/client/record/item_spec.rb +41 -0
- data/spec/exlibris/aleph/api/client/record/items_spec.rb +46 -0
- data/spec/exlibris/aleph/api/client/record_spec.rb +43 -0
- data/spec/exlibris/aleph/api/reader/base_spec.rb +18 -0
- data/spec/exlibris/aleph/api/reader/patron/address_spec.rb +151 -0
- data/spec/exlibris/aleph/api/reader/patron/record/item/create_hold_spec.rb +65 -0
- data/spec/exlibris/aleph/api/reader/patron/record/item/hold_spec.rb +145 -0
- data/spec/exlibris/aleph/api/reader/patron/record/item_spec.rb +266 -0
- data/spec/exlibris/aleph/api/reader/patron/record_spec.rb +98 -0
- data/spec/exlibris/aleph/api/reader/patron/status_spec.rb +57 -0
- data/spec/exlibris/aleph/api/reader/patron_spec.rb +28 -0
- data/spec/exlibris/aleph/api/reader/record/item_spec.rb +178 -0
- data/spec/exlibris/aleph/collection_spec.rb +95 -0
- data/spec/exlibris/aleph/config_spec.rb +17 -0
- data/spec/exlibris/aleph/holding/metadata_spec.rb +57 -0
- data/spec/exlibris/aleph/holding_spec.rb +53 -0
- data/spec/exlibris/aleph/holdings_spec.rb +59 -0
- data/spec/exlibris/aleph/item/call_number_spec.rb +20 -0
- data/spec/exlibris/aleph/item/circulation_policy/display_spec.rb +33 -0
- data/spec/exlibris/aleph/item/circulation_policy/identifier_spec.rb +154 -0
- data/spec/exlibris/aleph/item/circulation_policy/privileges_spec.rb +183 -0
- data/spec/exlibris/aleph/item/circulation_policy_spec.rb +146 -0
- data/spec/exlibris/aleph/item/circulation_status_spec.rb +83 -0
- data/spec/exlibris/aleph/item/display_mask_spec.rb +72 -0
- data/spec/exlibris/aleph/item/opac_note_spec.rb +19 -0
- data/spec/exlibris/aleph/item/processing_status_spec.rb +75 -0
- data/spec/exlibris/aleph/item/queue_spec.rb +31 -0
- data/spec/exlibris/aleph/item/status_spec.rb +80 -0
- data/spec/exlibris/aleph/item_spec.rb +97 -0
- data/spec/exlibris/aleph/items_spec.rb +59 -0
- data/spec/exlibris/aleph/metadata_spec.rb +118 -0
- data/spec/exlibris/aleph/patron/address_spec.rb +68 -0
- data/spec/exlibris/aleph/patron/circulation_policy/identifier_spec.rb +115 -0
- data/spec/exlibris/aleph/patron/circulation_policy/privileges_spec.rb +128 -0
- data/spec/exlibris/aleph/patron/circulation_policy_spec.rb +119 -0
- data/spec/exlibris/aleph/patron/record/circulation_policy/privileges_spec.rb +88 -0
- data/spec/exlibris/aleph/patron/record/circulation_policy_spec.rb +37 -0
- data/spec/exlibris/aleph/patron/record/item/circulation_policy/privileges_spec.rb +76 -0
- data/spec/exlibris/aleph/patron/record/item/circulation_policy_spec.rb +52 -0
- data/spec/exlibris/aleph/patron/record/item/create_hold_spec.rb +49 -0
- data/spec/exlibris/aleph/patron/record/item/hold_spec.rb +41 -0
- data/spec/exlibris/aleph/patron/record/item_spec.rb +64 -0
- data/spec/exlibris/aleph/patron/record_spec.rb +30 -0
- data/spec/exlibris/aleph/patron/status_spec.rb +72 -0
- data/spec/exlibris/aleph/patron_spec.rb +28 -0
- data/spec/exlibris/aleph/pickup_location_spec.rb +19 -0
- data/spec/exlibris/aleph/record/metadata_spec.rb +120 -0
- data/spec/exlibris/aleph/record_spec.rb +44 -0
- data/spec/exlibris/aleph/sub_library_spec.rb +110 -0
- data/spec/exlibris/aleph/table/base_spec.rb +17 -0
- data/spec/exlibris/aleph/table/collections_spec.rb +24 -0
- data/spec/exlibris/aleph/table/item/circulation_policies_spec.rb +65 -0
- data/spec/exlibris/aleph/table/item/display_masks_spec.rb +26 -0
- data/spec/exlibris/aleph/table/patron/circulation_policies_spec.rb +47 -0
- data/spec/exlibris/aleph/table/patron/statuses_spec.rb +26 -0
- data/spec/exlibris/aleph/table/reader/base_spec.rb +28 -0
- data/spec/exlibris/aleph/table/reader/collections_spec.rb +33 -0
- data/spec/exlibris/aleph/table/reader/item_circulation_policies_spec.rb +33 -0
- data/spec/exlibris/aleph/table/reader/item_display_masks_spec.rb +27 -0
- data/spec/exlibris/aleph/table/reader/matcher/base_spec.rb +32 -0
- data/spec/exlibris/aleph/table/reader/matcher/collections_spec.rb +39 -0
- data/spec/exlibris/aleph/table/reader/matcher/item_circulation_policies_spec.rb +39 -0
- data/spec/exlibris/aleph/table/reader/matcher/item_display_masks_spec.rb +40 -0
- data/spec/exlibris/aleph/table/reader/matcher/patron_circulation_policies_spec.rb +40 -0
- data/spec/exlibris/aleph/table/reader/matcher/patron_statuses_spec.rb +40 -0
- data/spec/exlibris/aleph/table/reader/matcher/sub_libraries_spec.rb +40 -0
- data/spec/exlibris/aleph/table/reader/patron_circulation_policies_spec.rb +27 -0
- data/spec/exlibris/aleph/table/reader/patron_statuses_spec.rb +27 -0
- data/spec/exlibris/aleph/table/reader/row/base_spec.rb +20 -0
- data/spec/exlibris/aleph/table/reader/row/collections_spec.rb +37 -0
- data/spec/exlibris/aleph/table/reader/row/item_circulation_policies_spec.rb +89 -0
- data/spec/exlibris/aleph/table/reader/row/item_display_masks_spec.rb +29 -0
- data/spec/exlibris/aleph/table/reader/row/patron_circulation_policies_spec.rb +115 -0
- data/spec/exlibris/aleph/table/reader/row/patron_statuses_spec.rb +29 -0
- data/spec/exlibris/aleph/table/reader/row/sub_libraries_spec.rb +41 -0
- data/spec/exlibris/aleph/table/reader/sub_libraries_spec.rb +36 -0
- data/spec/exlibris/aleph/table/sub_libraries_spec.rb +19 -0
- data/spec/exlibris/aleph/tables_manager_spec.rb +120 -0
- data/spec/exlibris/aleph_spec.rb +5 -0
- data/spec/spec_helper.rb +27 -0
- data/spec/support/mnt/aleph_tab/adm50/tab/filename +0 -0
- data/{test → spec/support}/mnt/aleph_tab/alephe/tab/tab_sub_library.eng +0 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu50/tab/pc_tab_exp_field_extended.eng +0 -0
- data/{test/mnt/aleph_tab → spec/support/mnt/aleph_tab/nyu50/tab}/tab15.eng +2 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu50/tab/tab16 +0 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu50/tab/tab31 +0 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu50/tab/tab37 +0 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu50/tab/tab40.eng +0 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu50/tab/tab_www_item_desc.eng +0 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu51/tab/pc_tab_exp_field_extended.eng +0 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu51/tab/tab15.eng +0 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu51/tab/tab16 +0 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu51/tab/tab31 +0 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu51/tab/tab37 +0 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu51/tab/tab40.eng +0 -0
- data/{test → spec/support}/mnt/aleph_tab/nyu51/tab/tab_www_item_desc.eng +0 -0
- data/spec/vcr_cassettes/patron.yml +1443 -0
- data/spec/vcr_cassettes/record.yml +763 -0
- metadata +351 -165
- data/lib/exlibris/aleph/abstract.rb +0 -28
- data/lib/exlibris/aleph/rest/base.rb +0 -56
- data/lib/exlibris/aleph/tab_helper.rb +0 -303
- data/lib/exlibris/aleph/tabs_parser/base.rb +0 -49
- data/lib/exlibris/aleph/tabs_parser/pc_tab_exp_field_extended.rb +0 -20
- data/lib/exlibris/aleph/tabs_parser/sub_library.rb +0 -32
- data/lib/exlibris/aleph/tabs_parser/tab15_by_item_process_status.rb +0 -33
- data/lib/exlibris/aleph/tabs_parser/tab15_by_item_status.rb +0 -33
- data/lib/exlibris/aleph/tabs_parser/tab31.rb +0 -39
- data/lib/exlibris/aleph/tabs_parser/tab37.rb +0 -63
- data/lib/exlibris/aleph/tabs_parser/tab40.rb +0 -20
- data/lib/exlibris/aleph/tabs_parser/tab_sub_library.rb +0 -21
- data/lib/exlibris/aleph/tabs_parser/tab_www_item_desc.rb +0 -20
- data/lib/exlibris/aleph/task_installer.rb +0 -25
- data/lib/exlibris/aleph/write_attributes.rb +0 -38
- data/lib/exlibris/aleph/xml_util.rb +0 -50
- data/lib/exlibris/aleph/xservice/bor_auth.rb +0 -47
- data/lib/tasks/exlibris-aleph_tasks.rake +0 -48
- data/test/config/aleph/alephe/sub_libraries.yml +0 -801
- data/test/config/aleph/nyu50/collections.yml +0 -1168
- data/test/config/aleph/nyu50/item_permissions_by_item_process_status.yml +0 -61876
- data/test/config/aleph/nyu50/item_permissions_by_item_status.yml +0 -17319
- data/test/config/aleph/nyu50/items.yml +0 -617
- data/test/config/aleph/nyu50/patron_permissions.yml +0 -19720
- data/test/config/aleph/nyu50/patrons.yml +0 -249
- data/test/config/aleph/nyu50/pickup_locations.yml +0 -2910
- data/test/config/aleph/nyu51/collections.yml +0 -41
- data/test/config/aleph/nyu51/item_permissions_by_item_process_status.yml +0 -7689
- data/test/config/aleph/nyu51/item_permissions_by_item_status.yml +0 -430
- data/test/config/aleph/nyu51/items.yml +0 -617
- data/test/config/aleph/nyu51/patron_permissions.yml +0 -6588
- data/test/config/aleph/nyu51/patrons.yml +0 -237
- data/test/config/aleph/nyu51/pickup_locations.yml +0 -456
- data/test/config_test.rb +0 -24
- data/test/exlibris-aleph_test.rb +0 -7
- data/test/mnt/aleph_tab/nyu50/tab/tab15.eng +0 -4742
- data/test/mnt/aleph_tab/pc_tab_exp_field_extended.eng +0 -158
- data/test/mnt/aleph_tab/tab16 +0 -3792
- data/test/mnt/aleph_tab/tab31 +0 -998
- data/test/mnt/aleph_tab/tab37 +0 -405
- data/test/mnt/aleph_tab/tab40.eng +0 -335
- data/test/mnt/aleph_tab/tab_sub_library.eng +0 -378
- data/test/mnt/aleph_tab/tab_www_item_desc.eng +0 -208
- data/test/patron_test.rb +0 -98
- data/test/record_benchmarks.rb +0 -26
- data/test/record_test.rb +0 -64
- data/test/support/config.yml +0 -2
- data/test/tab_helper_benchmarks.rb +0 -53
- data/test/tab_helper_test.rb +0 -192
- data/test/test_helper.rb +0 -46
- data/test/vcr_cassettes/bor_auth.yml +0 -42
- data/test/vcr_cassettes/patron.yml +0 -142
- data/test/vcr_cassettes/patron_address.yml +0 -45
- data/test/vcr_cassettes/patron_bogus_url.yml +0 -731
- data/test/vcr_cassettes/patron_error.yml +0 -93
- data/test/vcr_cassettes/record.yml +0 -146
- data/test/vcr_cassettes/record_bogus_url.yml +0 -690
- data/test/xservice/bor_auth_test.rb +0 -28
@@ -0,0 +1,38 @@
|
|
1
|
+
module Exlibris
|
2
|
+
module Aleph
|
3
|
+
module API
|
4
|
+
module Reader
|
5
|
+
class Patron < Base
|
6
|
+
class Record < Base
|
7
|
+
|
8
|
+
attr_reader :hold_request, :short_loan, :ill, :booking_request,
|
9
|
+
:acquisition_request
|
10
|
+
|
11
|
+
def initialize(root)
|
12
|
+
super(root)
|
13
|
+
@hold_request = privilege_for_type('HoldRequest')
|
14
|
+
@short_loan = privilege_for_type('ShortLoan')
|
15
|
+
@ill = privilege_for_type('ILL')
|
16
|
+
@booking_request = privilege_for_type('BookingRequest')
|
17
|
+
@acquisition_request = privilege_for_type('AcquisitionRequest')
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
def record
|
22
|
+
@record ||= root['record']
|
23
|
+
end
|
24
|
+
|
25
|
+
def info
|
26
|
+
@info ||= record['info']
|
27
|
+
end
|
28
|
+
|
29
|
+
def privilege_for_type(type)
|
30
|
+
privilege = info.find { |element| element['type'] == type }
|
31
|
+
privilege['allowed'] if privilege
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
module Exlibris
|
2
|
+
module Aleph
|
3
|
+
module API
|
4
|
+
module Reader
|
5
|
+
class Patron < Base
|
6
|
+
class Record < Base
|
7
|
+
class Item < Base
|
8
|
+
|
9
|
+
attr_reader :hold_request, :short_loan, :photocopy_request,
|
10
|
+
:booking_request
|
11
|
+
|
12
|
+
def initialize(root)
|
13
|
+
super(root)
|
14
|
+
@hold_request = privilege_for_type('HoldRequest')
|
15
|
+
@short_loan = privilege_for_type('ShortLoan')
|
16
|
+
@photocopy_request = privilege_for_type('PhotocopyRequest')
|
17
|
+
@booking_request = privilege_for_type('BookingRequest')
|
18
|
+
end
|
19
|
+
|
20
|
+
def pickup_locations
|
21
|
+
@pickup_locations ||= pickup_location.map do |location|
|
22
|
+
code = location['code']
|
23
|
+
display = location['__content__']
|
24
|
+
PickupLocation.new(code, display)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
def item
|
30
|
+
@item ||= root['item']
|
31
|
+
end
|
32
|
+
|
33
|
+
def info
|
34
|
+
@info ||= item['info']
|
35
|
+
end
|
36
|
+
|
37
|
+
def hold_request_root
|
38
|
+
@hold_request_root ||= info.find do |element|
|
39
|
+
element['type'] == 'HoldRequest'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def hold
|
44
|
+
@hold ||= hold_request_root['hold']
|
45
|
+
end
|
46
|
+
|
47
|
+
def pickup_locations_root
|
48
|
+
unless hold.nil?
|
49
|
+
@pickup_locations_root ||= hold['pickup_locations']
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def pickup_location
|
54
|
+
@pickup_location ||= begin
|
55
|
+
if pickup_locations_root.nil?
|
56
|
+
[]
|
57
|
+
elsif pickup_locations_root['pickup_location'].nil?
|
58
|
+
[]
|
59
|
+
elsif pickup_locations_root['pickup_location'].is_a?(Hash)
|
60
|
+
[pickup_locations_root['pickup_location']]
|
61
|
+
else
|
62
|
+
pickup_locations_root['pickup_location']
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def privilege_for_type(type)
|
68
|
+
privilege = info.find { |element| element['type'] == type }
|
69
|
+
privilege['allowed'] if privilege
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Exlibris
|
2
|
+
module Aleph
|
3
|
+
module API
|
4
|
+
module Reader
|
5
|
+
class Patron < Base
|
6
|
+
class Record < Base
|
7
|
+
class Item < Base
|
8
|
+
class CreateHold < Base
|
9
|
+
|
10
|
+
attr_reader :note, :type
|
11
|
+
|
12
|
+
def initialize(root)
|
13
|
+
super(root)
|
14
|
+
@note = note_root['__content__']
|
15
|
+
@type = note_root['type']
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
def create_hold
|
20
|
+
@create_hold ||= root['create_hold']
|
21
|
+
end
|
22
|
+
|
23
|
+
def note_root
|
24
|
+
@note_root ||= create_hold['note']
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Exlibris
|
2
|
+
module Aleph
|
3
|
+
module API
|
4
|
+
module Reader
|
5
|
+
class Patron < Base
|
6
|
+
class Record < Base
|
7
|
+
class Item < Base
|
8
|
+
class Hold < Base
|
9
|
+
|
10
|
+
attr_reader :allowed
|
11
|
+
|
12
|
+
def initialize(root)
|
13
|
+
super(root)
|
14
|
+
@allowed = hold['allowed']
|
15
|
+
end
|
16
|
+
|
17
|
+
def pickup_locations
|
18
|
+
@pickup_locations ||= pickup_location.map do |location|
|
19
|
+
code = location['code']
|
20
|
+
display = location['__content__']
|
21
|
+
PickupLocation.new(code, display)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
def hold
|
27
|
+
@hold ||= root['hold']
|
28
|
+
end
|
29
|
+
|
30
|
+
def pickup_locations_root
|
31
|
+
unless hold.nil?
|
32
|
+
@pickup_locations_root ||= hold['pickup_locations']
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def pickup_location
|
37
|
+
@pickup_location ||= begin
|
38
|
+
if pickup_locations_root.nil?
|
39
|
+
[]
|
40
|
+
elsif pickup_locations_root['pickup_location'].nil?
|
41
|
+
[]
|
42
|
+
elsif pickup_locations_root['pickup_location'].is_a?(Hash)
|
43
|
+
[pickup_locations_root['pickup_location']]
|
44
|
+
else
|
45
|
+
pickup_locations_root['pickup_location']
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Exlibris
|
2
|
+
module Aleph
|
3
|
+
module API
|
4
|
+
module Reader
|
5
|
+
class Patron < Base
|
6
|
+
class Status < Base
|
7
|
+
|
8
|
+
attr_reader :code, :display, :type, :expiration_date,
|
9
|
+
:institution_code
|
10
|
+
|
11
|
+
def initialize(root)
|
12
|
+
super(root)
|
13
|
+
@code = institution['z305_bor_status_code']
|
14
|
+
@display = institution['z305_bor_status']
|
15
|
+
@type = institution['z305_bor_type']
|
16
|
+
@expiration_date = institution['z305_expiry_date']
|
17
|
+
@institution_code = institution['code']
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
def registration
|
22
|
+
@registration ||= root['registration']
|
23
|
+
end
|
24
|
+
|
25
|
+
def institution
|
26
|
+
@institution ||= registration['institution']
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Exlibris
|
2
|
+
module Aleph
|
3
|
+
module API
|
4
|
+
module Reader
|
5
|
+
class Record < Base
|
6
|
+
class Item < Base
|
7
|
+
attr_reader :admin_library_code, :sub_library_code, :collection_code,
|
8
|
+
:status_code, :processing_status_code, :sub_library_display,
|
9
|
+
:collection_display, :status_display, :processing_status_display,
|
10
|
+
:circulation_status_value, :classification, :description, :opac_note,
|
11
|
+
:queue
|
12
|
+
|
13
|
+
def initialize(root)
|
14
|
+
super(root)
|
15
|
+
@admin_library_code = z30['translate_change_active_library']
|
16
|
+
@sub_library_code = item['z30_sub_library_code']
|
17
|
+
@collection_code = item['z30_collection_code']
|
18
|
+
@status_code = item['z30_item_status_code']
|
19
|
+
@processing_status_code = item['z30_item_process_status_code']
|
20
|
+
@sub_library_display= z30['z30_sub_library']
|
21
|
+
@collection_display = z30['z30_collection']
|
22
|
+
@status_display = z30['z30_item_status']
|
23
|
+
@processing_status_display = z30['z30_item_process_status']
|
24
|
+
@classification = z30['z30_call_no']
|
25
|
+
@description = z30['z30_description']
|
26
|
+
@circulation_status_value = item['status']
|
27
|
+
@opac_note = z30['z30_note_opac']
|
28
|
+
@queue = item['queue']
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
private
|
33
|
+
def item
|
34
|
+
@item ||= root['item']
|
35
|
+
end
|
36
|
+
|
37
|
+
def z30
|
38
|
+
@z30 ||= item['z30']
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Exlibris
|
2
|
+
module Aleph
|
3
|
+
class Collection
|
4
|
+
attr_reader :code, :display, :sub_library
|
5
|
+
|
6
|
+
def initialize(code, display, sub_library)
|
7
|
+
unless sub_library.is_a?(SubLibrary)
|
8
|
+
raise ArgumentError.new("Expecting #{sub_library} to be an SubLibrary")
|
9
|
+
end
|
10
|
+
@code = code
|
11
|
+
@display = display
|
12
|
+
@sub_library = sub_library
|
13
|
+
end
|
14
|
+
|
15
|
+
def to_s
|
16
|
+
display
|
17
|
+
end
|
18
|
+
|
19
|
+
def ==(other_object)
|
20
|
+
other_object.instance_of?(self.class) && code == other_object.code &&
|
21
|
+
sub_library == other_object.sub_library
|
22
|
+
end
|
23
|
+
alias_method :eql?, :==
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -1,76 +1,36 @@
|
|
1
1
|
module Exlibris
|
2
2
|
module Aleph
|
3
|
-
|
4
3
|
#
|
5
|
-
#
|
4
|
+
# Global configuration settings for Exlibris::Aleph
|
6
5
|
#
|
7
6
|
module Config
|
8
7
|
class << self
|
9
|
-
|
10
|
-
|
11
|
-
:yml_path, :logger, :irrelevant_sub_libraries, :load_time
|
8
|
+
attr_accessor :base_url, :rest_url, :adms, :table_path,
|
9
|
+
:irrelevant_sub_libraries
|
12
10
|
|
13
|
-
def load_yaml file
|
14
|
-
write_attributes YAML.load_file(file)
|
15
|
-
self.load_time = Time.now
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
#
|
20
|
-
# These attributes default to the global config settings if not
|
21
|
-
# specified locally.
|
22
|
-
#
|
23
|
-
module Attributes
|
24
|
-
def config
|
25
|
-
@config ||= Config
|
26
|
-
end
|
27
|
-
|
28
|
-
# Aleph base url
|
29
|
-
def base_url
|
30
|
-
@base_url ||= String.new config.base_url.to_s
|
31
|
-
end
|
32
|
-
|
33
|
-
# Aleph rest url
|
34
11
|
def rest_url
|
35
|
-
@rest_url ||=
|
12
|
+
@rest_url ||= "#{base_url}:1891"
|
36
13
|
end
|
37
14
|
|
38
|
-
# Refresh time for TabHelper
|
39
|
-
def refresh_time
|
40
|
-
@refresh_time ||= (config.refresh_time) ? config.refresh_time : lambda{1.day.ago}
|
41
|
-
end
|
42
|
-
|
43
|
-
# Aleph ADMs to parse
|
44
15
|
def adms
|
45
|
-
@adms ||=
|
46
|
-
end
|
47
|
-
|
48
|
-
# Tab path for Aleph tables
|
49
|
-
def tab_path
|
50
|
-
@tab_path ||= File.join(config.tab_path)
|
51
|
-
end
|
52
|
-
|
53
|
-
# YAML path for persisting Aleph config
|
54
|
-
def yml_path
|
55
|
-
@yml_path ||= (File.join(config.yml_path) || File.join(tab_path, "..", "config", "aleph"))
|
16
|
+
@adms ||= []
|
56
17
|
end
|
57
18
|
|
58
|
-
def
|
59
|
-
@
|
19
|
+
def admin_libraries
|
20
|
+
@admin_libraries ||= adms.map { |code| AdminLibrary.new(code) }
|
60
21
|
end
|
61
22
|
|
62
23
|
def irrelevant_sub_libraries
|
63
|
-
@irrelevant_sub_libraries ||=
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
"NEDUC", "NHLTH", "NLINC", "NLAW", "NMUSI", "NSCI", "NUPTN" ]
|
24
|
+
@irrelevant_sub_libraries ||= %w{
|
25
|
+
USR00 HOME BOX ILLDT NYU51 ALEPH USM50 MED HYL HIL LAM LAW LIT MUS
|
26
|
+
WID EXL CIRC HILR HIL01 HYL01 HYL02 HYL03 HYL04 HYL05 HYL06 LAM01
|
27
|
+
LAM02 LAM03 LAW01 LAW02 LAW03 LIT01 LIT02 MED01 MED02 MUS01 MUS02
|
28
|
+
WID01 WID02 WID03 WID04 WID05 U60WD U60HL U60LA U70WD CBAB BCU
|
29
|
+
MBAZU USM51 ELEC5 GDOC5 EDUC5 LINC5 RRLIN OU511 OR512 OR513 OR514
|
30
|
+
OR515 U61ED U61EL U61LN S61GD USM53 ELEC7 GDOC7 EDUC7 LINC7 USM54
|
31
|
+
ELEC4 USM55 CUN50 CLEC5 CDOC5 CDUC5 CINC5 UNI50 NARCV NELEC NRLEC
|
32
|
+
NGDOC NRDOC NEDUC NHLTH NLINC NLAW NMUSI NSCI NUPTN
|
33
|
+
}
|
74
34
|
end
|
75
35
|
end
|
76
36
|
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module Exlibris
|
2
|
+
module Aleph
|
3
|
+
class Holding
|
4
|
+
attr_reader :record_id, :id
|
5
|
+
def initialize(record_id, id)
|
6
|
+
@record_id = record_id
|
7
|
+
@id = id
|
8
|
+
end
|
9
|
+
|
10
|
+
def collection
|
11
|
+
unless client.error?
|
12
|
+
@collection ||= collections[admin_library].find do |collection|
|
13
|
+
collection.code == collection_code &&
|
14
|
+
collection.sub_library == sub_library
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def metadata
|
20
|
+
@metadata ||= Metadata.new(client.to_xml) unless client.error?
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
def client
|
25
|
+
@client ||= API::Client::Record::Holding.new(record_id, id)
|
26
|
+
end
|
27
|
+
|
28
|
+
def admin_library
|
29
|
+
@admin_library ||= sub_library.admin_library
|
30
|
+
end
|
31
|
+
|
32
|
+
def sub_library
|
33
|
+
@sub_library ||= sub_libraries.find do |sub_library|
|
34
|
+
sub_library.code == sub_library_code
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def sub_libraries
|
39
|
+
@sub_libraries ||= tables_manager.sub_libraries
|
40
|
+
end
|
41
|
+
|
42
|
+
def collections
|
43
|
+
@collections ||= tables_manager.collections
|
44
|
+
end
|
45
|
+
|
46
|
+
def tables_manager
|
47
|
+
@tables_manager ||= TablesManager.instance
|
48
|
+
end
|
49
|
+
|
50
|
+
def sub_library_code
|
51
|
+
@sub_library_code ||= metadata.sub_location
|
52
|
+
end
|
53
|
+
|
54
|
+
def collection_code
|
55
|
+
@collection_code ||= metadata.shelving_location
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|