lib/alma/bib_set.rb in alma-0.2.4 vs lib/alma/bib_set.rb in alma-0.2.5
- old
+ new
@@ -1,22 +1,31 @@
module Alma
- class BibSet < ResultSet
+ class BibSet
- def top_level_key
- 'bibs'
+ 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 response_records_key
- 'bib'
+ def list
+ @list ||= response.fetch(key, []).map do |record|
+ Alma::Bib.new(record)
+ end
end
- def single_record_class
- Alma::Bib
+ def key
+ 'bib'
end
- # Doesn't seem to actually return a total record count as documented.
def total_record_count
- (response_records.is_a? Array) ? size : 1
+ size
end
end
end