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,23 @@
|
|
1
|
+
module Exlibris
|
2
|
+
module Aleph
|
3
|
+
class Item
|
4
|
+
class ProcessingStatus
|
5
|
+
attr_reader :code, :display
|
6
|
+
|
7
|
+
def initialize(code, display=nil)
|
8
|
+
@code = code
|
9
|
+
@display = display
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_s
|
13
|
+
(display || code)
|
14
|
+
end
|
15
|
+
|
16
|
+
def ==(other_object)
|
17
|
+
other_object.instance_of?(self.class) && code == other_object.code
|
18
|
+
end
|
19
|
+
alias_method :eql?, :==
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Exlibris
|
2
|
+
module Aleph
|
3
|
+
class Item
|
4
|
+
class Queue
|
5
|
+
attr_reader :value
|
6
|
+
|
7
|
+
def initialize(value)
|
8
|
+
@value = value
|
9
|
+
end
|
10
|
+
|
11
|
+
def to_s
|
12
|
+
value
|
13
|
+
end
|
14
|
+
|
15
|
+
def number_of_requests
|
16
|
+
@number_of_requests ||= begin
|
17
|
+
if number_of_requests_matched_data.nil?
|
18
|
+
0
|
19
|
+
else
|
20
|
+
number_of_requests_matched_data[1].to_i
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
def number_of_requests_matched_data
|
27
|
+
@number_of_requests_matched_data ||= /^(\d+) request\(s\)/.match(value)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Exlibris
|
2
|
+
module Aleph
|
3
|
+
class Item
|
4
|
+
class Status
|
5
|
+
attr_reader :code, :display
|
6
|
+
|
7
|
+
def initialize(code, display=nil)
|
8
|
+
@code = code
|
9
|
+
@display = display
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_s
|
13
|
+
(display || code)
|
14
|
+
end
|
15
|
+
|
16
|
+
def ==(other_object)
|
17
|
+
other_object.instance_of?(self.class) && code == other_object.code
|
18
|
+
end
|
19
|
+
alias_method :eql?, :==
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Exlibris
|
2
|
+
module Aleph
|
3
|
+
class Items
|
4
|
+
|
5
|
+
extend Forwardable
|
6
|
+
def_delegators :to_a, :each, :size
|
7
|
+
|
8
|
+
include Enumerable
|
9
|
+
|
10
|
+
attr_reader :record_id
|
11
|
+
|
12
|
+
def initialize(record_id)
|
13
|
+
@record_id = record_id
|
14
|
+
end
|
15
|
+
|
16
|
+
def to_a
|
17
|
+
@array ||= ids.map { |id| Item.new(record_id, id) }
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
def client
|
22
|
+
@client ||= API::Client::Record::Items.new(record_id)
|
23
|
+
end
|
24
|
+
|
25
|
+
def root
|
26
|
+
@root ||= client.root
|
27
|
+
end
|
28
|
+
|
29
|
+
def items_root
|
30
|
+
@items_root ||= root['items']
|
31
|
+
end
|
32
|
+
|
33
|
+
def items
|
34
|
+
@items ||= items_root['item'] unless items_root.nil?
|
35
|
+
end
|
36
|
+
|
37
|
+
def ids
|
38
|
+
@ids ||= begin
|
39
|
+
if items.nil?
|
40
|
+
[]
|
41
|
+
else
|
42
|
+
items.map do |item|
|
43
|
+
href = (items.size > 1) ? item['href'] : item[1]
|
44
|
+
href.split('/').pop
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Exlibris
|
2
|
+
module Aleph
|
3
|
+
require 'marc'
|
4
|
+
class Metadata
|
5
|
+
attr_reader :marc_xml
|
6
|
+
|
7
|
+
def initialize(marc_xml)
|
8
|
+
@marc_xml = marc_xml.strip
|
9
|
+
end
|
10
|
+
|
11
|
+
def marc_record
|
12
|
+
@marc_record ||= marc_xml_reader.first
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
def string_io
|
17
|
+
StringIO.new(marc_xml)
|
18
|
+
end
|
19
|
+
|
20
|
+
def marc_xml_reader
|
21
|
+
MARC::XMLReader.new(string_io)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -1,100 +1,36 @@
|
|
1
1
|
module Exlibris
|
2
2
|
module Aleph
|
3
|
-
|
4
|
-
|
5
|
-
class Patron < Rest::Base
|
6
|
-
attr_accessor :patron_id
|
3
|
+
class Patron
|
4
|
+
attr_reader :id
|
7
5
|
|
8
|
-
|
9
|
-
|
10
|
-
# Raises an exception if the response is not valid XML or there are errors.
|
11
|
-
def place_hold(adm_library, bib_library, bib_id, item_id, params)
|
12
|
-
options = { :body => "post_xml=#{place_hold_xml(params)}"}
|
13
|
-
self.response = self.class.put("#{patron_url}/record/#{bib_library}#{bib_id}/items/#{item_id}/hold", options)
|
14
|
-
raise_error_if("Error placing hold through Aleph REST APIs. #{error}") {
|
15
|
-
(response.parsed_response["put_item_hold"].nil? or response.parsed_response["put_item_hold"]["create_hold"].nil?)
|
16
|
-
}
|
17
|
-
response.parsed_response["put_item_hold"]["create_hold"]
|
6
|
+
def initialize(id)
|
7
|
+
@id = id
|
18
8
|
end
|
19
9
|
|
20
|
-
|
21
|
-
|
22
|
-
# Raises an exception if the response is not valid XML or there are errors.
|
23
|
-
def address
|
24
|
-
self.response = self.class.get("#{patron_url}/patronInformation/address")
|
25
|
-
raise_error_if("Error getting patron address through Aleph REST APIs.") {
|
26
|
-
(response.parsed_response["get_pat_adrs"].nil? or response.parsed_response["get_pat_adrs"]["address_information"].nil?)
|
27
|
-
}
|
28
|
-
response.parsed_response["get_pat_adrs"]["address_information"]
|
29
|
-
end
|
30
|
-
|
31
|
-
# Returns an Array of institutions.
|
32
|
-
# Each institution is a Hash containing an array of loans for that institution.
|
33
|
-
# Every method call refreshes the data from the underlying API.
|
34
|
-
# Raises an exception if the response is not valid XML or there are errors.
|
35
|
-
def loans
|
36
|
-
self.response = self.class.get("#{patron_url}/circulationActions/loans?view=full")
|
37
|
-
raise_error_if("Error getting loans through Aleph REST APIs.") {
|
38
|
-
(response.parsed_response["pat_loan_list"].nil? or response.parsed_response["pat_loan_list"]["loans"].nil?)
|
39
|
-
}
|
40
|
-
[response.parsed_response["pat_loan_list"]["loans"]["institution"]].flatten
|
10
|
+
def admin_library
|
11
|
+
@admin_library ||= AdminLibrary.new(reader.admin_library_code)
|
41
12
|
end
|
42
13
|
|
43
|
-
|
44
|
-
|
45
|
-
# Returns an Array of institutions.
|
46
|
-
# Each institution is a Hash containing an array of loan renewals for that institution.
|
47
|
-
# Raises an exception if the response is not valid XML or there are errors.
|
48
|
-
def renew_loans(item_id="")
|
49
|
-
self.response = self.class.post("#{patron_url}/circulationActions/loans/#{item_id}")
|
50
|
-
raise_error_if("Error renewing loans through Aleph REST APIs.") {
|
51
|
-
(response.parsed_response["renew_loan"].nil? or response.parsed_response["renew_loan"]["renewals"].nil?)
|
52
|
-
}
|
53
|
-
[response.parsed_response["renew_loan"]["renewals"]["institution"]].flatten
|
14
|
+
def address
|
15
|
+
@address ||= Address.new(id)
|
54
16
|
end
|
55
17
|
|
56
|
-
|
57
|
-
|
58
|
-
return (not response.first.last.kind_of?(Hash) or response.first.last["create_hold"].nil?) ? "" : ": #{response.first.last["create_hold"]["note"]["__content__"]}" if response.instance_of?(Hash)
|
18
|
+
def record(record_id)
|
19
|
+
Record.new(id, record_id)
|
59
20
|
end
|
60
21
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
return nil if reply_code == "0000"
|
65
|
-
return "#{reply_text}#{note}"
|
22
|
+
private
|
23
|
+
def client
|
24
|
+
@client ||= API::Client::Patron.new(id)
|
66
25
|
end
|
67
26
|
|
68
|
-
def
|
69
|
-
@
|
27
|
+
def root
|
28
|
+
@root ||= client.root
|
70
29
|
end
|
71
|
-
private :patron_url
|
72
30
|
|
73
|
-
def
|
74
|
-
|
75
|
-
last_interest_date = params.fetch(:last_interest_date, "")
|
76
|
-
start_interest_date = params.fetch(:start_interest_date, "")
|
77
|
-
sub_author = params.fetch(:sub_author, "")
|
78
|
-
sub_title = params.fetch(:sub_title, "")
|
79
|
-
pages = params.fetch(:pages, "")
|
80
|
-
note_1 = params.fetch(:note_1, "")
|
81
|
-
note_2 = params.fetch(:note_2, "")
|
82
|
-
rush = params.fetch(:rush, "N")
|
83
|
-
build_xml { |xml|
|
84
|
-
xml.send(:"hold-request-parameters") {
|
85
|
-
xml.send :"pickup-location", pickup_location
|
86
|
-
xml.send :"last-interest-date", last_interest_date
|
87
|
-
xml.send :"start-interest-date", start_interest_date
|
88
|
-
xml.send :"sub-author", sub_author
|
89
|
-
xml.send :"sub-title", sub_title
|
90
|
-
xml.send :"pages", pages
|
91
|
-
xml.send :"note-1", note_1
|
92
|
-
xml.send :"note-2", note_2
|
93
|
-
xml.send :"rush", rush
|
94
|
-
}
|
95
|
-
}
|
31
|
+
def reader
|
32
|
+
@reader ||= API::Reader::Patron.new(root)
|
96
33
|
end
|
97
|
-
private :place_hold_xml
|
98
34
|
end
|
99
35
|
end
|
100
|
-
end
|
36
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Exlibris
|
2
|
+
module Aleph
|
3
|
+
class Patron
|
4
|
+
class Address
|
5
|
+
attr_reader :patron_id
|
6
|
+
|
7
|
+
def initialize(patron_id)
|
8
|
+
@patron_id = patron_id
|
9
|
+
end
|
10
|
+
|
11
|
+
(1..5).each do |n|
|
12
|
+
address_n = "address#{n}".to_sym
|
13
|
+
define_method(address_n) do
|
14
|
+
eval("@#{address_n} ||= reader.send(address_n)")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
(1..4).each do |n|
|
19
|
+
telephone_n = "telephone#{n}".to_sym
|
20
|
+
define_method(telephone_n) do
|
21
|
+
eval("@#{telephone_n} ||= reader.send(telephone_n)")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def zip
|
26
|
+
@zip ||= reader.zip
|
27
|
+
end
|
28
|
+
|
29
|
+
def sms_number
|
30
|
+
@sms_number ||= reader.sms_number
|
31
|
+
end
|
32
|
+
|
33
|
+
def want_sms
|
34
|
+
@want_sms ||= reader.want_sms
|
35
|
+
end
|
36
|
+
|
37
|
+
def email
|
38
|
+
@email ||= reader.email
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
def client
|
43
|
+
@client ||= API::Client::Patron::Address.new(patron_id)
|
44
|
+
end
|
45
|
+
|
46
|
+
def root
|
47
|
+
@root ||= client.root
|
48
|
+
end
|
49
|
+
|
50
|
+
def reader
|
51
|
+
@reader ||= API::Reader::Patron::Address.new(root)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Exlibris
|
2
|
+
module Aleph
|
3
|
+
class Patron
|
4
|
+
class CirculationPolicy
|
5
|
+
attr_reader :identifier, :privileges
|
6
|
+
|
7
|
+
def initialize(identifier, privileges)
|
8
|
+
unless identifier.is_a?(Identifier)
|
9
|
+
raise ArgumentError.new("Expecting #{identifier} to be a Patron::CirculationPolicy::Identifier")
|
10
|
+
end
|
11
|
+
unless privileges.is_a?(Privileges)
|
12
|
+
raise ArgumentError.new("Expecting #{privileges} to be a Patron::CirculationPolicy::Privileges")
|
13
|
+
end
|
14
|
+
@identifier = identifier
|
15
|
+
@privileges = privileges
|
16
|
+
end
|
17
|
+
|
18
|
+
def ==(other_object)
|
19
|
+
(other_object.instance_of?(self.class) &&
|
20
|
+
identifier == other_object.identifier)
|
21
|
+
end
|
22
|
+
alias_method :eql?, :==
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Exlibris
|
2
|
+
module Aleph
|
3
|
+
class Patron
|
4
|
+
class CirculationPolicy
|
5
|
+
class Identifier
|
6
|
+
attr_reader :status, :sub_library
|
7
|
+
|
8
|
+
def initialize(status, sub_library)
|
9
|
+
unless status.is_a?(Status)
|
10
|
+
raise ArgumentError.new("Expecting #{status} to be a Patron::Status")
|
11
|
+
end
|
12
|
+
unless sub_library.is_a?(SubLibrary)
|
13
|
+
raise ArgumentError.new("Expecting #{sub_library} to be a SubLibrary")
|
14
|
+
end
|
15
|
+
@status = status
|
16
|
+
@sub_library = sub_library
|
17
|
+
end
|
18
|
+
|
19
|
+
def ==(other_object)
|
20
|
+
(other_object.instance_of?(self.class) &&
|
21
|
+
status == other_object.status &&
|
22
|
+
sub_library == other_object.sub_library)
|
23
|
+
end
|
24
|
+
alias_method :eql?, :==
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Exlibris
|
2
|
+
module Aleph
|
3
|
+
class Patron
|
4
|
+
class CirculationPolicy
|
5
|
+
class Privileges
|
6
|
+
|
7
|
+
attr_reader :borrow, :photocopy, :request, :request_multiple,
|
8
|
+
:request_on_shelf, :renew, :book, :rush_cataloging
|
9
|
+
|
10
|
+
def initialize(privileges)
|
11
|
+
@borrow = privileges.borrow
|
12
|
+
@photocopy = privileges.photocopy
|
13
|
+
@request = privileges.request
|
14
|
+
@request_multiple = privileges.request_multiple
|
15
|
+
@request_on_shelf = privileges.request_on_shelf
|
16
|
+
@renew = privileges.renew
|
17
|
+
@book = privileges.book
|
18
|
+
@rush_cataloging = privileges.rush_cataloging
|
19
|
+
end
|
20
|
+
|
21
|
+
def can_borrow?
|
22
|
+
borrow == 'Y'
|
23
|
+
end
|
24
|
+
|
25
|
+
def can_photocopy?
|
26
|
+
photocopy == 'Y'
|
27
|
+
end
|
28
|
+
|
29
|
+
def can_request?
|
30
|
+
request == 'Y'
|
31
|
+
end
|
32
|
+
|
33
|
+
def can_request_multiple?
|
34
|
+
request_multiple == 'Y'
|
35
|
+
end
|
36
|
+
|
37
|
+
def can_request_on_shelf?
|
38
|
+
request_on_shelf == 'Y'
|
39
|
+
end
|
40
|
+
|
41
|
+
def can_renew?
|
42
|
+
renew == 'Y'
|
43
|
+
end
|
44
|
+
|
45
|
+
def can_book?
|
46
|
+
book == 'Y'
|
47
|
+
end
|
48
|
+
|
49
|
+
def can_rush_cataloging?
|
50
|
+
rush_cataloging == 'Y'
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|