Sha256: 6d8931555b27e52dd9793656e2d6dedfd371bf9cab5fc646788396f68fe52bf6
Contents?: true
Size: 815 Bytes
Versions: 1
Compression:
Stored size: 815 Bytes
Contents
require "nokogiri" require "skala/adapter/renew_user_loan" require_relative "../aleph_adapter" require_relative "./resolve_user" class Skala::AlephAdapter::RenewUserLoan < Skala::Adapter::RenewUserLoan include parent::ResolveUser def call(username, loan_id, options = {}) 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 end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
skala-1.1.0 | lib/skala/aleph_adapter/renew_user_loan.rb |