Class: Skala::AlephAdapter::GetUserHoldRequests
- Inherits:
-
Skala::Adapter::GetUserHoldRequests
- Object
- Skala::Adapter::Operation
- Skala::Adapter::GetUserHoldRequests
- Skala::AlephAdapter::GetUserHoldRequests
- Includes:
- parentparent::ResolveUser
- Defined in:
- lib/skala/aleph_adapter/get_user_hold_requests.rb
Instance Attribute Summary
Attributes inherited from Skala::Adapter::Operation
Instance Method Summary collapse
Methods inherited from Skala::Adapter::Operation
Constructor Details
This class inherits a constructor from Skala::Adapter::Operation
Instance Method Details
#call(username, options = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/skala/aleph_adapter/get_user_hold_requests.rb', line 9 def call(username, = {}) resolved_user_id = resolve_user(username.upcase) raw_aleph_response = adapter.restful_api.patron(resolved_user_id).circulationActions.requests.holds.get(view: :full) if raw_aleph_response.include?("<error>") return nil else self.class::Result.new( hold_requests: Nokogiri::XML(raw_aleph_response).xpath("//hold-request").map do |_hold_request| { id: id(_hold_request), deleteable: deleteable?(_hold_request), place_in_queue: place_in_queue(_hold_request), creation_date: creation_date(_hold_request), begin_request_date: begin_request_date(_hold_request), end_request_date: end_request_date(_hold_request), begin_hold_date: begin_hold_date(_hold_request), end_hold_date: end_hold_date(_hold_request), record: { id: record_id(_hold_request) }, status: status(_hold_request) } end, source: raw_aleph_response ) end end |