Class: Alma::Loan
Class Method Summary
collapse
Instance Method Summary
collapse
apikey, bibs_base_path, configuration_base_path, headers, items_base_path, 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
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/alma/loan.rb', line 24
def self.where_user(user_id, args = {})
args[:expand] ||= "renewable"
args[:limit] ||= 100
response = Net.get(
"#{users_base_path}/#{user_id}/loans",
query: args,
headers:,
timeout:
)
Alma::LoanSet.new(response, args)
end
|
Instance Method Details
#overdue? ⇒ Boolean
16
17
18
|
# File 'lib/alma/loan.rb', line 16
def overdue?
loan_status == "Overdue"
end
|
#renew ⇒ Object
20
21
22
|
# File 'lib/alma/loan.rb', line 20
def renew
Alma::User.renew_loan({ user_id:, loan_id: })
end
|
#renewable ⇒ Object
12
13
14
|
# File 'lib/alma/loan.rb', line 12
def renewable
response.fetch("renewable", false)
end
|
#renewable? ⇒ Boolean
8
9
10
|
# File 'lib/alma/loan.rb', line 8
def renewable?
!!renewable
end
|