-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2439 from sul-dlss/bound-with-holdings
Retrieve + display bound-with information
- Loading branch information
Showing
8 changed files
with
934 additions
and
522 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -325,3 +325,7 @@ label.btn-close { | |
} | ||
} | ||
} | ||
|
||
.status.availability { | ||
text-wrap: nowrap; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# frozen_string_literal: true | ||
|
||
module Folio | ||
# Represents a holdings record in Folio. | ||
class HoldingsRecord | ||
attr_reader :id, :call_number, :instance, :items | ||
|
||
def initialize(call_number:, id: nil, instance: nil, bound_with_item: nil, items: [], suppressed_from_discovery: false) # rubocop:disable Metrics/ParameterLists | ||
@id = id | ||
@call_number = call_number | ||
@instance = instance | ||
@bound_with_item = bound_with_item | ||
@suppressed_from_discovery = suppressed_from_discovery | ||
@items = items | ||
end | ||
|
||
def bound_with_item | ||
@bound_with_item&.with_bound_with_child_holdings_record(self) | ||
end | ||
|
||
def suppressed_from_discovery? | ||
@suppressed_from_discovery | ||
end | ||
|
||
def self.from_hash(hash) | ||
new( | ||
id: hash['id'], | ||
call_number: hash.fetch('callNumber'), | ||
instance: (Folio::Instance.from_dynamic(hash.fetch('instance')) if hash['instance']), | ||
bound_with_item: (Folio::Item.from_hash(hash.fetch('boundWithItem')) if hash['boundWithItem']), | ||
items: hash.fetch('items', []).map { |item| Folio::Item.from_hash(item.reverse_merge('holdingsRecord' => hash)) }, | ||
suppressed_from_discovery: hash['discoverySuppress'] | ||
) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.