Sha256: b6ed613d6ace1581972fba02620d2557acae0804f47fdab3803b1a471600ab43
Contents?: true
Size: 782 Bytes
Versions: 3
Compression:
Stored size: 782 Bytes
Contents
# frozen_string_literal: true module Alma class Loan < AlmaRecord extend Alma::ApiDefaults def renewable? !!renewable end def renewable response.fetch("renewable", false) end def overdue? loan_status == "Overdue" end def renew Alma::User.renew_loan({ user_id: user_id, loan_id: loan_id }) end def self.where_user(user_id, args = {}) # Always expand renewable unless you really don't want to args[:expand] ||= "renewable" # Default to upper limit args[:limit] ||= 100 response = HTTParty.get( "#{users_base_path}/#{user_id}/loans", query: args, headers: headers, timeout: timeout ) Alma::LoanSet.new(response, args) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
alma-0.4.0 | lib/alma/loan.rb |
alma-0.3.3 | lib/alma/loan.rb |
alma-0.3.2 | lib/alma/loan.rb |