Sha256: 55b74c5591c9ac5014a2169ef6fb1de5b2f01cf19224c3afadf773a3c2a67409
Contents?: true
Size: 741 Bytes
Versions: 1
Compression:
Stored size: 741 Bytes
Contents
module Alma class RenewalResponse def initialize(response, loan=nil) @loan = loan @success = response.fetch('item_loan', nil) @error = response.fetch('web_service_result', nil) @renewed = @error.nil? end def renewed? @renewed end def new_due_date Time.parse(@success['due_date']).strftime('%m-%e-%y %H:%M') end def error_message @error['errorList']['error']['errorMessage'] end def item_title if @loan @loan.title else "This Item" end end def message if @success "#{item_title} is now due #{new_due_date}" else "#{item_title} could not be renewed." end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
alma-0.2.0 | lib/alma/renewal_response.rb |