Class: Alma::BibItemSet
- Inherits:
-
Object
- Object
- Alma::BibItemSet
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/alma/bib_item_set.rb
Instance Attribute Summary collapse
-
#items ⇒ Object
Returns the value of attribute items.
-
#raw_response ⇒ Object
readonly
Returns the value of attribute raw_response.
-
#total_record_count ⇒ Object
readonly
Returns the value of attribute total_record_count.
Instance Method Summary collapse
- #filter_missing_and_lost ⇒ Object
- #grouped_by_library ⇒ Object
-
#initialize(response) ⇒ BibItemSet
constructor
A new instance of BibItemSet.
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
#items ⇒ Object
Returns the value of attribute items.
8 9 10 |
# File 'lib/alma/bib_item_set.rb', line 8 def items @items end |
#raw_response ⇒ Object (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_count ⇒ Object (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_lost ⇒ Object
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_library ⇒ Object
23 24 25 |
# File 'lib/alma/bib_item_set.rb', line 23 def grouped_by_library group_by(&:library) end |