Class: Alma::LoanSet
- Inherits:
-
Object
- Object
- Alma::LoanSet
- Defined in:
- lib/alma/loan_set.rb
Instance Attribute Summary collapse
-
#list ⇒ Object
readonly
Returns the value of attribute list.
-
#total_record_count ⇒ Object
readonly
Returns the value of attribute total_record_count.
Instance Method Summary collapse
-
#initialize(ws_response) ⇒ LoanSet
constructor
A new instance of LoanSet.
- #list_results ⇒ Object
- #response_records ⇒ Object
Constructor Details
#initialize(ws_response) ⇒ LoanSet
Returns a new instance of LoanSet.
6 7 8 9 10 |
# File 'lib/alma/loan_set.rb', line 6 def initialize(ws_response) @ws_response = ws_response @total_record_count = ws_response.fetch('total_record_count', 0) @list ||= list_results end |
Instance Attribute Details
#list ⇒ Object (readonly)
Returns the value of attribute list.
4 5 6 |
# File 'lib/alma/loan_set.rb', line 4 def list @list end |
#total_record_count ⇒ Object (readonly)
Returns the value of attribute total_record_count.
4 5 6 |
# File 'lib/alma/loan_set.rb', line 4 def total_record_count @total_record_count end |
Instance Method Details
#list_results ⇒ Object
16 17 18 19 20 |
# File 'lib/alma/loan_set.rb', line 16 def list_results response_records.map do |loan| Alma::Loan.new(loan) end end |
#response_records ⇒ Object
12 13 14 |
# File 'lib/alma/loan_set.rb', line 12 def response_records @ws_response['item_loans'].fetch('item_loan',[]) end |