Sha256: a3cbc90c3085b5bc57be47d6d46f0e115048d2331065b285c704d39d6345824a
Contents?: true
Size: 689 Bytes
Versions: 2
Compression:
Stored size: 689 Bytes
Contents
module Alma class RenewalResponse def initialize(response) @response = response @success = response.has_key?('loan_id') end def renewed? @success end def due_date @response.fetch('dueDate', '') end def due_date_pretty Time.parse(due_date).strftime('%m-%e-%y %H:%M') end def item_title if renewed? @response['title'] else 'This Item' end end def message if renewed? "#{item_title} is now due #{due_date}" else "#{item_title} could not be renewed." end end def error_message @response unless renewed? end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
alma-0.2.6 | lib/alma/renewal_response.rb |
alma-0.2.5 | lib/alma/renewal_response.rb |