Class: AuthpdsNyu::Exlibris::Aleph::BorAuth
- Inherits:
-
Object
- Object
- AuthpdsNyu::Exlibris::Aleph::BorAuth
- Defined in:
- lib/authpds-nyu/exlibris/aleph.rb
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
A new instance of BorAuth.
- #permissions ⇒ Object
Constructor Details
#initialize(aleph_url, library, sub_library, translate, bor_id, bor_verification) ⇒ BorAuth
Returns a new instance of BorAuth.
7 8 9 10 11 12 13 14 15 |
# File 'lib/authpds-nyu/exlibris/aleph.rb', line 7 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.
6 7 8 |
# File 'lib/authpds-nyu/exlibris/aleph.rb', line 6 def error @error end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
6 7 8 |
# File 'lib/authpds-nyu/exlibris/aleph.rb', line 6 def response @response end |
#session_id ⇒ Object (readonly)
Returns the value of attribute session_id.
6 7 8 |
# File 'lib/authpds-nyu/exlibris/aleph.rb', line 6 def session_id @session_id end |
Instance Method Details
#permissions ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/authpds-nyu/exlibris/aleph.rb', line 17 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 |