Class: Alma::LoanSet

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Enumerable
Defined in:
lib/alma/loan_set.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response_body_hash) ⇒ LoanSet

Returns a new instance of LoanSet.



10
11
12
# File 'lib/alma/loan_set.rb', line 10

def initialize(response_body_hash)
  @response = response_body_hash
end

Instance Attribute Details

#responseObject (readonly)

include Alma::Error



7
8
9
# File 'lib/alma/loan_set.rb', line 7

def response
  @response
end

Instance Method Details

#eachObject Also known as: list



14
15
16
# File 'lib/alma/loan_set.rb', line 14

def each
  @response.fetch(key, []).map{|item| Alma::Loan.new(item)}
end

#keyObject



24
25
26
# File 'lib/alma/loan_set.rb', line 24

def key
  'item_loan'
end

#sizeObject



19
20
21
# File 'lib/alma/loan_set.rb', line 19

def size
  each.count
end

#total_record_countObject Also known as: total_records



28
29
30
# File 'lib/alma/loan_set.rb', line 28

def total_record_count
  fetch('total_record_count', 0)
end