class Alma::Loan

Public Class Methods

where_user(user_id, args = {}) click to toggle source
# File lib/alma/loan.rb, line 24
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

Public Instance Methods

overdue?() click to toggle source
# File lib/alma/loan.rb, line 16
def overdue?
  loan_status == "Overdue"
end
renew() click to toggle source
# File lib/alma/loan.rb, line 20
def renew
  Alma::User.renew_loan({ user_id: user_id, loan_id: loan_id })
end
renewable() click to toggle source
# File lib/alma/loan.rb, line 12
def renewable
  response.fetch("renewable", false)
end
renewable?() click to toggle source
# File lib/alma/loan.rb, line 8
def renewable?
  !!renewable
end