From 8273f588ba882fd4f5a3cc1bfda6130a3de27ebc Mon Sep 17 00:00:00 2001 From: "Erin E. Sullivan" Date: Tue, 29 Oct 2024 13:39:44 -0400 Subject: [PATCH 1/2] Adding `isbn`, `issn`, and `oclc` fields. --- lib/models/carousel_list.rb | 15 +++++++++++++++ spec/models/carousel_list_spec.rb | 12 ++++++++++++ 2 files changed, 27 insertions(+) diff --git a/lib/models/carousel_list.rb b/lib/models/carousel_list.rb index 0557cd6..6bb3292 100644 --- a/lib/models/carousel_list.rb +++ b/lib/models/carousel_list.rb @@ -34,6 +34,18 @@ def call_number @browse_doc["callnumber"]&.strip end + def isbn + @catalog_doc["isbn"]&.first&.strip + end + + def issn + @catalog_doc["issn"]&.first&.strip + end + + def oclc + @catalog_doc["oclc"]&.first&.strip + end + def mms_id @browse_doc["bib_id"] end @@ -52,6 +64,9 @@ def to_h author: author, date: date, call_number: call_number, + isbn: isbn, + issn: issn, + oclc: oclc, url: url } end diff --git a/spec/models/carousel_list_spec.rb b/spec/models/carousel_list_spec.rb index 4679e24..9ee0393 100644 --- a/spec/models/carousel_list_spec.rb +++ b/spec/models/carousel_list_spec.rb @@ -34,6 +34,15 @@ def body(file_name) it "has a call_number" do expect(subject.call_number).to eq("Z 253 .U6 1963") end + it "has an isbn" do + expect(subject.isbn).to eq(nil) + end + it "has an issn" do + expect(subject.issn).to eq(nil) + end + it "has an oclc" do + expect(subject.oclc).to eq("2497305") + end it "has an mms_id" do expect(subject.mms_id).to eq("990011613060106381") end @@ -49,6 +58,9 @@ def body(file_name) author: "United States. Government Printing Office", call_number: "Z 253 .U6 1963", date: "1950", + isbn: nil, + issn: nil, + oclc: "2497305", title: "Theory and practice of composition.", url: "#{S.search_url}/catalog/record/990011613060106381" From d29da55ffa338b60aff05d17a7f45c0793c4b978 Mon Sep 17 00:00:00 2001 From: "Erin E. Sullivan" Date: Tue, 5 Nov 2024 11:58:12 -0500 Subject: [PATCH 2/2] Adding values for `isbn`, and `issn`. --- spec/models/carousel_list_spec.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/spec/models/carousel_list_spec.rb b/spec/models/carousel_list_spec.rb index 9ee0393..edadec9 100644 --- a/spec/models/carousel_list_spec.rb +++ b/spec/models/carousel_list_spec.rb @@ -20,6 +20,8 @@ def body(file_name) describe CarouselList::CarouselItem do before(:each) do @catalog_doc = JSON.parse(fixture("biblio_results.json"))["response"]["docs"].first + @catalog_doc["isbn"] = ["1-5011-8342-7"] + @catalog_doc["issn"] = ["1096-9942"] @browse_doc = JSON.parse(fixture("callnumbers_results.json"))["response"]["docs"].first end subject do @@ -35,10 +37,10 @@ def body(file_name) expect(subject.call_number).to eq("Z 253 .U6 1963") end it "has an isbn" do - expect(subject.isbn).to eq(nil) + expect(subject.isbn).to eq("1-5011-8342-7") end it "has an issn" do - expect(subject.issn).to eq(nil) + expect(subject.issn).to eq("1096-9942") end it "has an oclc" do expect(subject.oclc).to eq("2497305") @@ -58,8 +60,8 @@ def body(file_name) author: "United States. Government Printing Office", call_number: "Z 253 .U6 1963", date: "1950", - isbn: nil, - issn: nil, + isbn: "1-5011-8342-7", + issn: "1096-9942", oclc: "2497305", title: "Theory and practice of composition.", url: "#{S.search_url}/catalog/record/990011613060106381"