Class: Exlibris::Aleph::Xservice::BorAuth
- Inherits:
-
Object
- Object
- Exlibris::Aleph::Xservice::BorAuth
- Defined in:
- lib/exlibris/aleph/xservice/bor_auth.rb
Overview
Overview
Exlibris::Aleph::BorAuth provides access to the BorAuth Aleph XService.
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#session_id ⇒ Object
readonly
Returns the value of attribute session_id.
Instance Method Summary collapse
-
#initialize(aleph_url, library, sub_library, translate, bor_id, bor_verification) ⇒ BorAuth
constructor
Creates an instance of Exlibris::Aleph::BorAuth based on the input parameters.
-
#permissions ⇒ Object
Returns a Hash of permissions for the Aleph sub library passed into the constructor.
Constructor Details
#initialize(aleph_url, library, sub_library, translate, bor_id, bor_verification) ⇒ BorAuth
Creates an instance of Exlibris::Aleph::BorAuth based on the input parameters.
12 13 14 15 16 17 18 19 20 |
# File 'lib/exlibris/aleph/xservice/bor_auth.rb', line 12 def initialize(aleph_url, library, sub_library, translate, bor_id, bor_verification) url = "#{aleph_url}/X?" url += "op=bor-auth&library=#{library}&" url += "sub_library=#{sub_library}&translate=#{translate}&" url += "bor_id=#{bor_id}&verification=#{bor_verification}&" @response = Nokogiri.XML(open(url)) @session_id = @response.at("//session-id").inner_text unless @response.at("//session-id").nil? @error = @response.at("//error").inner_text unless @response.at("//error").nil? end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
9 10 11 |
# File 'lib/exlibris/aleph/xservice/bor_auth.rb', line 9 def error @error end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
9 10 11 |
# File 'lib/exlibris/aleph/xservice/bor_auth.rb', line 9 def response @response end |
#session_id ⇒ Object (readonly)
Returns the value of attribute session_id.
9 10 11 |
# File 'lib/exlibris/aleph/xservice/bor_auth.rb', line 9 def session_id @session_id end |
Instance Method Details
#permissions ⇒ Object
Returns a Hash of permissions for the Aleph sub library passed into the constructor.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/exlibris/aleph/xservice/bor_auth.rb', line 23 def rv = {} return rv unless @response and self.error.nil? rv[:home_sub_library] = @response.at("z303-home-library").inner_text unless @response.at("z303-home-library").nil? rv[:bor_status] = @response.at("z305-bor-status").inner_text unless @response.at("z305-bor-status").nil? rv[:bor_type] = @response.at("z305-bor-type").inner_text unless @response.at("z305-bor-type").nil? rv[:loan_permission] = @response.at("z305-loan-permission").inner_text unless @response.at("z305-loan-permission").nil? rv[:photo_permission] = @response.at("z305-photo-permission").inner_text unless @response.at("z305-photo-permission").nil? rv[:over_permission] = @response.at("z305-over-permission").inner_text unless @response.at("z305-over-permission").nil? rv[:multi_hold] = @response.at("z305-multi-hold").inner_text unless @response.at("z305-multi-hold").nil? rv[:loan_check] = @response.at("z305-loan-check").inner_text unless @response.at("z305-loan-check").nil? rv[:hold_permission] = @response.at("z305-hold-permission").inner_text unless @response.at("z305-hold-permission").nil? rv[:renew_permission] = @response.at("z305-renew-permission").inner_text unless @response.at("z305-renew-permission").nil? rv[:rr_permission] = @response.at("z305-rr-permission").inner_text unless @response.at("z305-rr-permission").nil? rv[:ignore_late_return] = @response.at("z305-ignore-late-return").inner_text unless @response.at("z305-ignore-late-return").nil? rv[:hold_on_shelf] = @response.at("z305-hold-on-shelf").inner_text unless @response.at("z305-hold-on-shelf").nil? rv[:end_block_date] = @response.at("z305-end-block-date").inner_text unless @response.at("z305-end-block-date").nil? rv[:booking_permission] = @response.at("z305-booking-permission").inner_text unless @response.at("z305-booking-permission").nil? rv[:booking_ignore_hours] = @response.at("z305-booking-ignore-hours").inner_text unless @response.at("z305-booking-ignore-hours").nil? return rv end |