Class: Alma::Loan
Class Method Summary
collapse
Instance Method Summary
collapse
apikey, bibs_base_path, headers, region, timeout, users_base_path
Methods inherited from AlmaRecord
#initialize, #method_missing, #post_initialize, #respond_to_missing?, #response
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Alma::AlmaRecord
Class Method Details
.where_user(user_id, args = {}) ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/alma/loan.rb', line 22
def self.where_user(user_id, args={})
args[:expand] ||= "renewable"
args[:limit] ||= 100
response = HTTParty.get(
"#{users_base_path}/#{user_id}/loans",
query: args,
headers: ,
timeout: timeout
)
Alma::LoanSet.new(response, args)
end
|
Instance Method Details
#overdue? ⇒ Boolean
14
15
16
|
# File 'lib/alma/loan.rb', line 14
def overdue?
loan_status == "Overdue"
end
|
#renew ⇒ Object
18
19
20
|
# File 'lib/alma/loan.rb', line 18
def renew
Alma::User.renew_loan({user_id: user_id, loan_id: loan_id})
end
|
#renewable ⇒ Object
10
11
12
|
# File 'lib/alma/loan.rb', line 10
def renewable
response.fetch("renewable", false)
end
|
#renewable? ⇒ Boolean
6
7
8
|
# File 'lib/alma/loan.rb', line 6
def renewable?
!!renewable
end
|