Class: Skala::AlephAdapter::RenewUserLoan
- Inherits:
-
Skala::Adapter::RenewUserLoan
- Object
- Skala::Adapter::Operation
- Skala::Adapter::RenewUserLoan
- Skala::AlephAdapter::RenewUserLoan
- Includes:
- parentparent::ResolveUser
- Defined in:
- lib/skala/aleph_adapter/renew_user_loan.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, loan_id, options = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/skala/aleph_adapter/renew_user_loan.rb', line 9 def call(username, loan_id, = {}) resolved_user_id = resolve_user(username) raw_aleph_response = adapter.restful_api.patron(resolved_user_id).circulationActions.loans(loan_id).post reply_code = Nokogiri::XML(raw_aleph_response).at_xpath("//reply-code").try(:content).try(:to_i) if reply_code == 0 adapter.class::RenewUserLoan::Result.new( source: raw_aleph_response ) else if reply_code == 28 raise self.class::RenewFailedError else raise adapter.class::RequestFailedError end end end |