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
data/README.md
CHANGED
@@ -7,87 +7,204 @@
|
|
7
7
|
# Exlibris::Aleph
|
8
8
|
Exlibris::Aleph offers a set of libraries for interacting with the ExLibris Aleph ILS.
|
9
9
|
|
10
|
-
##
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
10
|
+
## Config
|
11
|
+
There are several configuration options
|
12
|
+
- `base_url`: a String representing the base url for Aleph, e.g. http://aleph.library.edu
|
13
|
+
- `rest_url`: a String representing rest url for the Aleph REST API, e.g. http://aleph.library.edu:1891
|
14
|
+
- `adms`: an Array of administrative library codes, e.g. ['ADM50', 'ADM51']
|
15
|
+
- `table_path`: the path to the Aleph tables on the system
|
16
|
+
- `irrelevant_sub_libraries`: an Array or Sub Library codes to ignore
|
17
|
+
|
18
|
+
An example:
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
Exlibris::Aleph.configure do |config|
|
22
|
+
config.base_url = 'http://aleph.library.edu'
|
23
|
+
config.rest_url = 'http://aleph.library.edu:1891'
|
24
|
+
config.adms = ['ADM50', 'ADM51']
|
25
|
+
config.table_path = "/mnt/aleph_tab"
|
26
|
+
end
|
27
|
+
|
28
|
+
```
|
29
|
+
|
30
|
+
## Basic Concepts
|
31
|
+
- `AdminLibrary`: an administrative library
|
32
|
+
```ruby
|
33
|
+
admin_library = AdminLibrary.new('ADM50')
|
34
|
+
# => Exlibris::Aleph::AdminLibrary
|
35
|
+
|
36
|
+
admin_library.code
|
37
|
+
# => 'ADM50'
|
38
|
+
```
|
39
|
+
- `SubLibrary`: a sub library
|
40
|
+
```ruby
|
41
|
+
sub_library = SubLibrary.new('SUB', 'Sub Library', admin_library)
|
42
|
+
# => Exlibris::Aleph::SubLibrary
|
43
|
+
|
44
|
+
sub_library.code
|
45
|
+
# => 'SUB'
|
46
|
+
|
47
|
+
sub_library.display
|
48
|
+
# => 'Sub Library'
|
49
|
+
|
50
|
+
sub_library.admin_library
|
51
|
+
# => Exlibris::Aleph::AdminLibrary
|
52
|
+
```
|
53
|
+
- `Collection`: a collection
|
54
|
+
```ruby
|
55
|
+
collection = Collection.new('MAIN', 'Main Collection', sub_library)
|
56
|
+
# => Exlibris::Aleph::Collection
|
57
|
+
|
58
|
+
collection.code
|
59
|
+
# => 'MAIN'
|
60
|
+
|
61
|
+
collection.display
|
62
|
+
# => 'Main Collection'
|
63
|
+
|
64
|
+
collection.sub_library
|
65
|
+
# => Exlibris::Aleph::SubLibrary
|
66
|
+
```
|
67
|
+
- `PickupLocation`: a pickup location
|
68
|
+
- `Patron::Status`: a patron status
|
69
|
+
```ruby
|
70
|
+
patron_status = Exlibris::Aleph::Patron::Status.new('01', 'Regular patron')
|
71
|
+
# => Exlibris::Aleph::Patron::Status
|
72
|
+
|
73
|
+
patron_status.code
|
74
|
+
# => '01'
|
75
|
+
|
76
|
+
patron_status.display
|
77
|
+
# => 'Regular patron'
|
78
|
+
```
|
79
|
+
- `Item::Status`: an item status
|
80
|
+
```ruby
|
81
|
+
item_status = Exlibris::Aleph::Item::Status.new('01', 'Regular loan')
|
82
|
+
# => Exlibris::Aleph::Item::Status
|
83
|
+
|
84
|
+
item_status.code
|
85
|
+
# => '01'
|
86
|
+
|
87
|
+
item_status.display
|
88
|
+
# => 'Regular loan'
|
89
|
+
```
|
90
|
+
- `Item::ProcessingStatus`: an item circulation status
|
91
|
+
```ruby
|
92
|
+
processing_status = Exlibris::Aleph::Item::ProcessingStatus.new('DP', 'Depository')
|
93
|
+
# => Exlibris::Aleph::Item::ProcessingStatus
|
94
|
+
|
95
|
+
processing_status.code
|
96
|
+
# => 'DP'
|
97
|
+
|
98
|
+
processing_status.display
|
99
|
+
# => 'Depository'
|
100
|
+
```
|
101
|
+
- `Item::CirculationStatus`
|
102
|
+
- `Item::CallNumber`
|
103
|
+
|
104
|
+
## Record
|
105
|
+
The primary interface for an Aleph record
|
106
|
+
|
107
|
+
An example:
|
108
|
+
|
109
|
+
```ruby
|
110
|
+
record_id = '000000001'
|
111
|
+
|
112
|
+
admin_library = Exlibris::Aleph::AdminLibrary.new('BIB01')
|
113
|
+
# => Exlibris::Aleph::AdminLibrary
|
114
|
+
|
115
|
+
record = Exlibris::Aleph::Record.new(record_id, admin_library)
|
116
|
+
# => Exlibris::Aleph::Record
|
117
|
+
|
118
|
+
bibliographic_metadata = record.metadata
|
119
|
+
# => Exlibris::Aleph::Record::Metadata
|
120
|
+
|
121
|
+
bibliographic_marc_record = bibliographic_metadata.marc_record
|
122
|
+
# => returns a MARC::Record
|
123
|
+
|
124
|
+
holdings = record.holdings
|
125
|
+
# => Exlibris::Aleph::Holdings
|
126
|
+
|
127
|
+
holdings.each do |holding|
|
128
|
+
|
129
|
+
holding.is_a?(Exlibris::Aleph::Holding)
|
130
|
+
# => true
|
22
131
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
Exlibris::Aleph
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
132
|
+
holding_metadata = holding.metadata
|
133
|
+
# => Exlibris::Aleph::Holding::Metadata
|
134
|
+
|
135
|
+
holding_marc_record = holding_metadata.marc_record
|
136
|
+
# => returns a MARC::Record
|
137
|
+
end
|
138
|
+
|
139
|
+
items = record.items
|
140
|
+
# => Exlibris::Aleph::Items
|
141
|
+
|
142
|
+
items.each do |item|
|
143
|
+
|
144
|
+
item.is_a?(Exlibris::Aleph::Item)
|
145
|
+
# => true
|
146
|
+
|
147
|
+
item_collection = item.collection
|
148
|
+
# => Exlibris::Aleph::Collection
|
149
|
+
|
150
|
+
item_status = item.status
|
151
|
+
# => Exlibris::Aleph::Item::Status
|
152
|
+
|
153
|
+
item_processing_status = item.processing_status
|
154
|
+
# => Exlibris::Aleph::Item::ProcessingStatus
|
155
|
+
|
156
|
+
item_circulation_status = item.circulation_status
|
157
|
+
# => Exlibris::Aleph::Item::CirculationStatus
|
158
|
+
|
159
|
+
item_call_number = item.call_number
|
160
|
+
# => Exlibris::Aleph::Item::CallNumber
|
161
|
+
|
162
|
+
item_opac_note = item.opac_note
|
163
|
+
# => Exlibris::Aleph::Item::OpacNote
|
164
|
+
|
165
|
+
item_queue = item.queue
|
166
|
+
# => Exlibris::Aleph::Item::Queue
|
167
|
+
|
168
|
+
item_on_shelf = item.on_shelf?
|
169
|
+
# => true
|
170
|
+
end
|
171
|
+
```
|
172
|
+
|
173
|
+
## Patron
|
174
|
+
The primary interface for an Aleph patron
|
175
|
+
|
176
|
+
An example:
|
177
|
+
|
178
|
+
```ruby
|
179
|
+
patron_id = 'N1234567890'
|
180
|
+
|
181
|
+
patron = Exlibris::Aleph::Patron.new(patron_id)
|
182
|
+
# => Exlibris::Aleph::Patron
|
183
|
+
|
184
|
+
address = patron.address
|
185
|
+
# => Exlibris::Aleph::Patron::Address
|
186
|
+
|
187
|
+
record_id = 'BIB01000000001'
|
188
|
+
|
189
|
+
patron_record = patron.record(record_id)
|
190
|
+
# => Exlibris::Aleph::Patron::Record
|
191
|
+
|
192
|
+
patron_record_circulation_policy = patron_record.circulation_policy
|
193
|
+
# => Exlibris::Aleph::Patron::Record::CirculationPolicy
|
194
|
+
|
195
|
+
item_id = 'ADM5000000000101'
|
196
|
+
|
197
|
+
patron_record_item = patron_record.item(item_id)
|
198
|
+
# => Exlibris::Aleph::Patron::Record::Item
|
199
|
+
|
200
|
+
patron_record_item_item = patron_record_item.item
|
201
|
+
# => Exlibris::Aleph::Item
|
202
|
+
|
203
|
+
patron_record_item_circulation_policy = patron_record_item.circulation_policy
|
204
|
+
# => Exlibris::Aleph::Patron::Record::Item::CirculationPolicy
|
205
|
+
|
206
|
+
```
|
207
|
+
|
208
|
+
## Tables
|
209
|
+
`Tables` are accessed through the `TablesManager`.
|
93
210
|
|
data/Rakefile
CHANGED
@@ -1,18 +1,12 @@
|
|
1
1
|
#!/usr/bin/env rake
|
2
|
-
|
3
|
-
|
4
|
-
rescue LoadError
|
5
|
-
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
-
end
|
7
|
-
Bundler::GemHelper.install_tasks
|
2
|
+
#!/usr/bin/env rake
|
3
|
+
require 'bundler/gem_tasks'
|
8
4
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
end
|
16
|
-
task :default => :test
|
5
|
+
# Add the RSpec rake tasks tasks and append to default
|
6
|
+
require 'rspec/core/rake_task'
|
7
|
+
desc 'Default: run specs'
|
8
|
+
task :default => :spec
|
9
|
+
desc "Run specs"
|
10
|
+
RSpec::Core::RakeTask.new
|
17
11
|
|
18
12
|
require 'exlibris-aleph'
|
data/lib/exlibris-aleph.rb
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
module Exlibris
|
2
|
+
module Aleph
|
3
|
+
class AdminLibrary
|
4
|
+
attr_reader :code
|
5
|
+
|
6
|
+
def initialize(code)
|
7
|
+
unless code.is_a?(String)
|
8
|
+
raise ArgumentError.new("Expecting #{code} to be a String")
|
9
|
+
end
|
10
|
+
@code = code
|
11
|
+
end
|
12
|
+
|
13
|
+
def normalized_code
|
14
|
+
@normalized_code ||= code.downcase
|
15
|
+
end
|
16
|
+
|
17
|
+
def ==(other_object)
|
18
|
+
other_object.instance_of?(self.class) && code == other_object.code
|
19
|
+
end
|
20
|
+
alias_method :eql?, :==
|
21
|
+
|
22
|
+
def hash
|
23
|
+
code.hash
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Exlibris
|
2
|
+
module Aleph
|
3
|
+
module API
|
4
|
+
class Base
|
5
|
+
extend Forwardable
|
6
|
+
|
7
|
+
protected
|
8
|
+
def client
|
9
|
+
raise RuntimeError.new('Should be implmented in sub classes')
|
10
|
+
end
|
11
|
+
|
12
|
+
def reader
|
13
|
+
@reader ||= reader_constant.new(client.root)
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
def reader_constant
|
18
|
+
eval("Reader::#{demodulized_class_name}")
|
19
|
+
end
|
20
|
+
|
21
|
+
def demodulized_class_name
|
22
|
+
@demodulized_class_name ||= self.class.name.split('::').last
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
module Exlibris
|
2
|
+
module Aleph
|
3
|
+
module API
|
4
|
+
module Client
|
5
|
+
require 'faraday'
|
6
|
+
require 'multi_xml'
|
7
|
+
class Base
|
8
|
+
|
9
|
+
DEFAULT_REQUEST_METHOD = :get
|
10
|
+
|
11
|
+
VALID_VIEWS = ['full', 'brief']
|
12
|
+
|
13
|
+
attr_reader :query
|
14
|
+
|
15
|
+
def initialize(query={})
|
16
|
+
unless query.is_a?(Hash)
|
17
|
+
raise ArgumentError.new("Expecting #{query} to be a Hash")
|
18
|
+
end
|
19
|
+
view = query[:view]
|
20
|
+
unless view.nil? || VALID_VIEWS.include?(view)
|
21
|
+
raise ArgumentError.new("Expecting #{view} to be one of #{VALID_VIEWS.join(', ')}")
|
22
|
+
end
|
23
|
+
@query ||= query.map { |key, value| "#{key}=#{value}"}.join('&')
|
24
|
+
end
|
25
|
+
|
26
|
+
def error?
|
27
|
+
reply_code != '0000'
|
28
|
+
end
|
29
|
+
|
30
|
+
def reply_code
|
31
|
+
@reply_code ||= root['reply_code']
|
32
|
+
end
|
33
|
+
|
34
|
+
def reply_text
|
35
|
+
@reply_text ||= root['reply_text']
|
36
|
+
end
|
37
|
+
|
38
|
+
def root
|
39
|
+
@root ||= to_h[root_key]
|
40
|
+
end
|
41
|
+
|
42
|
+
def to_h
|
43
|
+
@hash ||= MultiXml.parse(to_xml)
|
44
|
+
end
|
45
|
+
|
46
|
+
def to_xml
|
47
|
+
@xml ||= body.to_s
|
48
|
+
end
|
49
|
+
|
50
|
+
protected
|
51
|
+
def path
|
52
|
+
@path ||= '/rest-dlf'
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
def root_key
|
57
|
+
@root_key ||= to_h.keys.first
|
58
|
+
end
|
59
|
+
|
60
|
+
def body
|
61
|
+
@body ||= response.body
|
62
|
+
end
|
63
|
+
|
64
|
+
def response
|
65
|
+
@response ||= send(request_method)
|
66
|
+
end
|
67
|
+
|
68
|
+
def get
|
69
|
+
connection.get("#{path}?#{query}")
|
70
|
+
end
|
71
|
+
|
72
|
+
def request_method
|
73
|
+
@request_method ||= DEFAULT_REQUEST_METHOD
|
74
|
+
end
|
75
|
+
|
76
|
+
def connection
|
77
|
+
@connection ||= Faraday.new(url: rest_url)
|
78
|
+
end
|
79
|
+
def rest_url
|
80
|
+
@rest_url ||= Config.rest_url
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|