From db8973fe7c2770fc5b14e3236ab03314bfff8cb2 Mon Sep 17 00:00:00 2001
From: Chris Beer <chris@cbeer.info>
Date: Tue, 7 Nov 2023 07:55:29 -0800
Subject: [PATCH] Consolidate Symphony library codes for HOOVER and HV-ARCHIVE
 into the FOLIO code HILA

---
 .../location_request_link_component.rb        |  2 +-
 app/models/hoover_open_url_request.rb         | 15 ------
 config/settings.yml                           | 12 -----
 lib/constants.rb                              | 10 +---
 .../at_the_library_component_spec.rb          |  2 +-
 spec/fixtures/solr_documents/56.yml           |  2 +-
 spec/models/hoover_open_url_request_spec.rb   | 54 ++-----------------
 .../location_request_link_policy_spec.rb      |  4 +-
 8 files changed, 11 insertions(+), 90 deletions(-)

diff --git a/app/components/location_request_link_component.rb b/app/components/location_request_link_component.rb
index 8884e1542..e14166410 100644
--- a/app/components/location_request_link_component.rb
+++ b/app/components/location_request_link_component.rb
@@ -6,7 +6,7 @@ class LocationRequestLinkComponent < ViewComponent::Base
   # @params [String] location the code for location with the holdings
   def self.for(document:, library:, location:, **kwargs)
     link_type = case library
-                when 'HOOVER', 'HV-ARCHIVE', 'HILA'
+                when 'HILA'
                   if document&.index_links&.finding_aid&.first&.href
                     RequestLinks::HooverArchiveRequestLinkComponent
                   else
diff --git a/app/models/hoover_open_url_request.rb b/app/models/hoover_open_url_request.rb
index a38215375..55e86e239 100644
--- a/app/models/hoover_open_url_request.rb
+++ b/app/models/hoover_open_url_request.rb
@@ -23,8 +23,6 @@ def as_params
   end
 
   def request_type
-    return 'GenericRequestManuscript' if archive?
-
     'GenericRequestMonograph'
   end
 
@@ -54,14 +52,10 @@ def item_author
   end
 
   def item_date
-    return unless archive?
-
     marc_data(field_codes: '245', subfield_codes: ['f'])
   end
 
   def item_publisher
-    return if archive?
-
     marc_260 = marc_data(field_codes: '260', subfield_codes: %w[a b c])
     marc_264 = marc_data(field_codes: '264', subfield_codes: %w[a b c])
     safe_join([marc_260, marc_264], ' ')
@@ -72,8 +66,6 @@ def item_place
   end
 
   def item_edition
-    return if archive?
-
     marc_data(field_codes: '250', subfield_codes: ['a'])
   end
 
@@ -82,8 +74,6 @@ def item_restrictions
   end
 
   def item_conditions
-    return unless archive?
-
     marc_data(field_codes: '540', subfield_codes: %w[3 a])
   end
 
@@ -91,11 +81,6 @@ def item_conditions
 
   attr_reader :library, :document
 
-  def archive?
-    # We are not currently routing any HV-ARCHIVE request links through this code...
-    library == 'HV-ARCHIVE'
-  end
-
   def marc
     document.to_marc
   end
diff --git a/config/settings.yml b/config/settings.yml
index ceaf837d6..26ad521be 100644
--- a/config/settings.yml
+++ b/config/settings.yml
@@ -134,22 +134,10 @@ libraries:
     name: Hoover Library
     suppress_items_list_on_results_view: true
     suppress_location_request_link: true
-  HOOVER:
-    about_url: https://www.hoover.org/library-archives
-    hours_api_url: hoover_archives/location/hv_archives
-    name: Hoover Library
-    suppress_items_list_on_results_view: true
-    suppress_location_request_link: true
   HOPKINS:
     about_url: https://library.stanford.edu/libraries/harold-miller-library-hopkins-marine-station
     hours_api_url: marine_biology/location/marine_biology_library
     name: Marine Biology Library (Miller)
-  HV-ARCHIVE:
-    about_url: https://www.hoover.org/library-archives
-    hours_api_url: hoover_archives/location/hv_archives
-    name: Hoover Archives
-    suppress_items_list_on_results_view: true
-    suppress_location_request_link: true
   IC:
     hours_api_url: green/location/reference
   IC-CHAT:
diff --git a/lib/constants.rb b/lib/constants.rb
index bb76aec8c..9570bf64c 100644
--- a/lib/constants.rb
+++ b/lib/constants.rb
@@ -790,7 +790,7 @@ module FolioStatus
     'EDU-RESV' => 'EDUCATION',
     'ENG-RESV' => 'ENG',
     'GREEN-RESV' => 'GREEN',
-    'HOOV-RESV' => 'HOOVER',
+    'HOOV-RESV' => 'HILA',
     'HOP-RESV' => 'HOPKINS',
     'LAW-RESV' => 'LAW',
     'MEDIA-RESV' => 'MEDIA-MTXT',
@@ -882,14 +882,6 @@ module FolioStatus
       heading: 'Access',
       text: 'Items must be requested in advance and viewed on-site.'
     },
-    'HOOVER' => {
-      heading: 'Access',
-      text: 'Items must be requested in advance and viewed on-site.'
-    },
-    'HV-ARCHIVE' => {
-      heading: 'Access',
-      text: 'Items must be requested in advance and viewed on-site.'
-    },
     'RUMSEY-MAP' => {
       heading: 'On-site access',
       text: 'Researchers can request to view these materials in the David Rumsey Map Center.'
diff --git a/spec/components/access_panels/at_the_library_component_spec.rb b/spec/components/access_panels/at_the_library_component_spec.rb
index 29a39c993..ae20cd738 100644
--- a/spec/components/access_panels/at_the_library_component_spec.rb
+++ b/spec/components/access_panels/at_the_library_component_spec.rb
@@ -441,7 +441,7 @@
         document = SolrDocument.new(
           id: '123',
           item_display_struct: [
-            { barcode: '123', library: 'HOOVER', home_location: 'STACKS', callnumber: 'ABC' }
+            { barcode: '123', library: 'HILA', home_location: 'STACKS', callnumber: 'ABC' }
           ],
           marc_links_struct: [{ href: "http://oac.cdlib.org/findaid/ark:/something-else", finding_aid: true }]
         )
diff --git a/spec/fixtures/solr_documents/56.yml b/spec/fixtures/solr_documents/56.yml
index f088428df..573b5e8a8 100644
--- a/spec/fixtures/solr_documents/56.yml
+++ b/spec/fixtures/solr_documents/56.yml
@@ -6,6 +6,6 @@
 <%= hoover_request_fixture %>
 :item_display_struct:
   - barcode: '123'
-    library: HOOVER
+    library: HILA
     home_location: STACKS
     callnumber: ABC 123
diff --git a/spec/models/hoover_open_url_request_spec.rb b/spec/models/hoover_open_url_request_spec.rb
index 89a206eb7..4b7d486a7 100644
--- a/spec/models/hoover_open_url_request_spec.rb
+++ b/spec/models/hoover_open_url_request_spec.rb
@@ -5,7 +5,7 @@
 
   subject(:url) { described_class.new(library, document) }
 
-  let(:library) { 'HOOVER' }
+  let(:library) { 'HILA' }
   let(:marc_json_struct) { metadata1 }
   let(:document) do
     SolrDocument.new(
@@ -43,32 +43,10 @@
         expect(url.as_params.keys).to include 'ReferenceNumber'
         expect(url.as_params.keys).to include 'ItemAuthor'
         expect(url.as_params.keys).to include 'Value'
-      end
-
-      context 'for HOOVER' do
-        it 'includes keys that are specific to hoover' do
-          expect(url.as_params.keys).to include 'ItemEdition'
-          expect(url.as_params.keys).to include 'ItemPublisher'
-        end
-
-        it 'does not include keys that are specific to the archive' do
-          expect(url.as_params.keys).not_to include 'ItemInfo3'
-          expect(url.as_params.keys).not_to include 'ItemDate'
-        end
-      end
-
-      context 'for HV-ARCHIVE' do
-        let(:library) { 'HV-ARCHIVE' }
-
-        it 'includes keys that are specific to the archive' do
-          expect(url.as_params.keys).to include 'ItemInfo3'
-          expect(url.as_params.keys).to include 'ItemDate'
-        end
-
-        it 'does not include keys that are specific to hoover' do
-          expect(url.as_params.keys).not_to include 'ItemEdition'
-          expect(url.as_params.keys).not_to include 'ItemPublisher'
-        end
+        expect(url.as_params.keys).to include 'ItemInfo3'
+        expect(url.as_params.keys).to include 'ItemDate'
+        expect(url.as_params.keys).to include 'ItemEdition'
+        expect(url.as_params.keys).to include 'ItemPublisher'
       end
     end
   end
@@ -151,21 +129,9 @@
         expect(url.item_edition).to eq '250 Subfield $a'
       end
     end
-
-    describe '#item_conditions' do
-      let(:marc_json_struct) { hoover_request_fixture }
-
-      it { expect(url.item_conditions).to be_nil }
-    end
   end
 
   context 'Hoover Archive' do
-    let(:library) { 'HV-ARCHIVE' }
-
-    describe '#request_type' do
-      it { expect(url.request_type).to eq 'GenericRequestManuscript' }
-    end
-
     describe '#item_date' do
       let(:marc_json_struct) { hoover_request_fixture }
 
@@ -174,16 +140,6 @@
       end
     end
 
-    describe '#item_publisher' do
-      it { expect(url.item_publisher).to be_nil }
-    end
-
-    describe '#item_edition' do
-      let(:marc_json_struct) { edition_imprint_fixture }
-
-      it { expect(url.item_edition).to be_nil }
-    end
-
     describe '#item_conditions' do
       let(:marc_json_struct) { hoover_request_fixture }
 
diff --git a/spec/policies/location_request_link_policy_spec.rb b/spec/policies/location_request_link_policy_spec.rb
index 99900121f..f1f946c2b 100644
--- a/spec/policies/location_request_link_policy_spec.rb
+++ b/spec/policies/location_request_link_policy_spec.rb
@@ -3,8 +3,8 @@
 RSpec.describe LocationRequestLinkPolicy do
   subject(:policy) { described_class.new(location:, library:, items:) }
 
-  let(:location) { 'HOOVER' }
-  let(:library) { 'STACKS' }
+  let(:library) { 'HILA' }
+  let(:location) { 'STACKS' }
 
   describe '#show?' do
     subject { policy.show? }