lib/alma/loan_set.rb in alma-0.2.6 vs lib/alma/loan_set.rb in alma-0.2.8
- old
+ new
@@ -3,19 +3,24 @@
extend Forwardable
include Enumerable
#include Alma::Error
attr_reader :response
- def_delegators :list, :each, :size
def_delegators :response, :[], :fetch
def initialize(response_body_hash)
@response = response_body_hash
end
- def list
- fetch(key, [])
+ def each
+ @response.fetch(key, []).map{|item| Alma::Loan.new(item)}
end
+ alias list each
+
+ def size
+ each.count
+ end
+
def key
'item_loan'
end