Class: Alma::BibItemSet

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ BibItemSet

Returns a new instance of BibItemSet.



16
17
18
19
20
21
# File 'lib/alma/bib_item_set.rb', line 16

def initialize(response)
  @raw_response = response
  parsed = JSON.parse(response.body)
  @total_record_count = parsed["total_record_count"]
  @items = parsed.fetch("item",[]).map {|item| BibItem.new(item)}
end

Instance Attribute Details

#itemsObject

Returns the value of attribute items.



8
9
10
# File 'lib/alma/bib_item_set.rb', line 8

def items
  @items
end

#raw_responseObject (readonly)

Returns the value of attribute raw_response.



13
14
15
# File 'lib/alma/bib_item_set.rb', line 13

def raw_response
  @raw_response
end

#total_record_countObject (readonly)

Returns the value of attribute total_record_count.



13
14
15
# File 'lib/alma/bib_item_set.rb', line 13

def total_record_count
  @total_record_count
end

Instance Method Details

#filter_missing_and_lostObject



27
28
29
30
31
# File 'lib/alma/bib_item_set.rb', line 27

def filter_missing_and_lost
  clone = dup
  clone.items = reject(&:missing_or_lost?)
  clone
end

#grouped_by_libraryObject



23
24
25
# File 'lib/alma/bib_item_set.rb', line 23

def grouped_by_library
  group_by(&:library)
end