diff --git a/Gemfile.lock b/Gemfile.lock index 9d844b19..c4e4d013 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - bolognese (1.8.2) + bolognese (1.8.3) activesupport (>= 4.2.5) benchmark_methods (~> 0.7) bibtex-ruby (>= 5.1.0) @@ -58,7 +58,8 @@ GEM csl (~> 1.0) diff-lcs (1.4.4) docile (1.3.2) - ebnf (2.1.0) + ebnf (2.1.1) + htmlentities (~> 4.3) rdf (~> 3.1) scanf (~> 1.0) sxp (~> 1.1) @@ -120,7 +121,7 @@ GEM namae (1.0.1) nokogiri (1.10.10) mini_portile2 (~> 2.4.0) - oj (3.10.7) + oj (3.10.8) oj_mimic_json (1.0.1) optimist (3.0.1) postrank-uri (1.0.24) diff --git a/lib/bolognese/readers/crossref_reader.rb b/lib/bolognese/readers/crossref_reader.rb index 00a00e8b..7bc2c018 100644 --- a/lib/bolognese/readers/crossref_reader.rb +++ b/lib/bolognese/readers/crossref_reader.rb @@ -41,6 +41,7 @@ def read_crossref(string: nil, **options) journal_issue = {} journal_metadata = nil publisher = query.dig("crm_item", 0) + publisher = nil unless publisher.is_a?(String) case model when "book" @@ -69,7 +70,7 @@ def read_crossref(string: nil, **options) end when "posted_content" bibliographic_metadata = meta.dig("crossref", "posted_content").to_h - publisher = bibliographic_metadata.dig("institution", "institution_name") + publisher ||= bibliographic_metadata.dig("institution", "institution_name") when "sa_component" bibliographic_metadata = meta.dig("crossref", "sa_component", "component_list", "component").to_h related_identifier = Array.wrap(query.to_h["crm_item"]).find { |cr| cr["name"] == "relation" } diff --git a/lib/bolognese/version.rb b/lib/bolognese/version.rb index d9325f46..371a3062 100644 --- a/lib/bolognese/version.rb +++ b/lib/bolognese/version.rb @@ -1,3 +1,3 @@ module Bolognese - VERSION = "1.8.2" + VERSION = "1.8.3" end diff --git a/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_crossref_metadata/posted_content_copernicus.yml b/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_crossref_metadata/posted_content_copernicus.yml new file mode 100644 index 00000000..7c8fc1e6 --- /dev/null +++ b/spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_crossref_metadata/posted_content_copernicus.yml @@ -0,0 +1,94 @@ +--- +http_interactions: +- request: + method: get + uri: https://doi.org/ra/10.5194 + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Mozilla/5.0 (compatible; Maremma/4.7.1; mailto:info@datacite.org) + Accept: + - text/html,application/json,application/xml;q=0.9, text/plain;q=0.8,image/png,*/*;q=0.5 + response: + status: + code: 200 + message: '' + headers: + Date: + - Wed, 29 Jul 2020 06:09:32 GMT + Content-Type: + - application/json;charset=UTF-8 + Connection: + - keep-alive + Set-Cookie: + - __cfduid=d405b79b8c70ba4b495e3fcba1355b80c1596002972; expires=Fri, 28-Aug-20 + 06:09:32 GMT; path=/; domain=.doi.org; HttpOnly; SameSite=Lax; Secure + Cf-Cache-Status: + - DYNAMIC + Cf-Request-Id: + - 043ac9cad6000005bbc5b4f200000001 + Expect-Ct: + - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Server: + - cloudflare + Cf-Ray: + - 5ba4abf15d0705bb-FRA + body: + encoding: ASCII-8BIT + string: |- + [ + { + "DOI": "10.5194", + "RA": "Crossref" + } + ] + http_version: + recorded_at: Wed, 29 Jul 2020 06:09:32 GMT +- request: + method: get + uri: https://api.crossref.org/works/10.5194/cp-2020-95/transform/application/vnd.crossref.unixsd+xml + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Mozilla/5.0 (compatible; Maremma/4.7.1; mailto:info@datacite.org) + Accept: + - text/xml + response: + status: + code: 200 + message: OK + headers: + Link: + - ; rel="canonical", ; + rel="license", ; title="Jun Shao"; rel="author", + ; title="Laurie Menviel"; rel="author", + ; title="Mayhar Mohtadi"; rel="author" + Access-Control-Allow-Origin: + - "*" + Access-Control-Allow-Headers: + - X-Requested-With + Content-Length: + - '7366' + Server: + - http-kit + Date: + - Wed, 29 Jul 2020 06:09:33 GMT + X-Rate-Limit-Limit: + - '50' + X-Rate-Limit-Interval: + - 1s + Connection: + - close + body: + encoding: ASCII-8BIT + string: !binary |- + PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPGNyb3NzcmVmX3Jlc3VsdCB4bWxucz0iaHR0cDovL3d3dy5jcm9zc3JlZi5vcmcvcXJzY2hlbWEvMy4wIiB2ZXJzaW9uPSIzLjAiIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhzaTpzY2hlbWFMb2NhdGlvbj0iaHR0cDovL3d3dy5jcm9zc3JlZi5vcmcvcXJzY2hlbWEvMy4wIGh0dHA6Ly93d3cuY3Jvc3NyZWYub3JnL3NjaGVtYXMvY3Jvc3NyZWZfcXVlcnlfb3V0cHV0My4wLnhzZCI+DQogIDxxdWVyeV9yZXN1bHQ+DQogICAgPGhlYWQ+DQogICAgICA8ZG9pX2JhdGNoX2lkPm5vbmU8L2RvaV9iYXRjaF9pZD4NCiAgICA8L2hlYWQ+DQogICAgPGJvZHk+DQogICAgICA8cXVlcnkgc3RhdHVzPSJyZXNvbHZlZCI+DQogICAgICAgIDxkb2kgdHlwZT0icG9zdGVkX2NvbnRlbnQiPjEwLjUxOTQvY3AtMjAyMC05NTwvZG9pPg0KICAgICAgICA8Y3JtLWl0ZW0gbmFtZT0icHVibGlzaGVyLW5hbWUiIHR5cGU9InN0cmluZyI+Q29wZXJuaWN1cyBHbWJIPC9jcm0taXRlbT4NCiAgICAgICAgPGNybS1pdGVtIG5hbWU9InByZWZpeC1uYW1lIiB0eXBlPSJzdHJpbmciPkNvcGVybmljdXMgR21iSDwvY3JtLWl0ZW0+DQogICAgICAgIDxjcm0taXRlbSBuYW1lPSJtZW1iZXItaWQiIHR5cGU9Im51bWJlciI+MzE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U+DQogICAgICAgICAgICAgICAgICA8T1JDSUQ+aHR0cHM6Ly9vcmNpZC5vcmcvMDAwMC0wMDAyLTUwNjgtMTU5MTwvT1JDSUQ+DQogICAgICAgICAgICAgICAgPC9wZXJzb25fbmFtZT4NCiAgICAgICAgICAgICAgICA8cGVyc29uX25hbWUgc2VxdWVuY2U9ImFkZGl0aW9uYWwiIGNvbnRyaWJ1dG9yX3JvbGU9ImF1dGhvciI+DQogICAgICAgICAgICAgICAgICA8Z2l2ZW5fbmFtZT5BbmR5PC9naXZlbl9uYW1lPg0KICAgICAgICAgICAgICAgICAgPHN1cm5hbWU+UmlkZ3dlbGw8L3N1cm5hbWU+DQogICAgICAgICAgICAgICAgPC9wZXJzb25fbmFtZT4NCiAgICAgICAgICAgICAgICA8cGVyc29uX25hbWUgc2VxdWVuY2U9ImFkZGl0aW9uYWwiIGNvbnRyaWJ1dG9yX3JvbGU9ImF1dGhvciI+DQogICAgICAgICAgICAgICAgICA8Z2l2ZW5fbmFtZT5NYWxpbjwvZ2l2ZW5fbmFtZT4NCiAgICAgICAgICAgICAgICAgIDxzdXJuYW1lPsOWZGFsZW48L3N1cm5hbWU+DQogICAgICAgICAgICAgICAgPC9wZXJzb25fbmFtZT4NCiAgICAgICAgICAgICAgICA8cGVyc29uX25hbWUgc2VxdWVuY2U9ImFkZGl0aW9uYWwiIGNvbnRyaWJ1dG9yX3JvbGU9ImF1dGhvciI+DQogICAgICAgICAgICAgICAgICA8Z2l2ZW5fbmFtZT5NYXloYXI8L2dpdmVuX25hbWU+DQogICAgICAgICAgICAgICAgICA8c3VybmFtZT5Nb2h0YWRpPC9zdXJuYW1lPg0KICAgICAgICAgICAgICAgICAgPE9SQ0lEPmh0dHBzOi8vb3JjaWQub3JnLzAwMDAtMDAwMy0zMzA2LTA5Njk8L09SQ0lEPg0KICAgICAgICAgICAgICAgIDwvcGVyc29uX25hbWU+DQogICAgICAgICAgICAgIDwvY29udHJpYnV0b3JzPg0KICAgICAgICAgICAgICA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pb24+DQogICAgICAgICAgICAgICAgICA8L2ZyOmFzc2VydGlvbj4NCiAgICAgICAgICAgICAgICAgIDxmcjphc3NlcnRpb24gbmFtZT0iYXdhcmRfbnVtYmVyIj4xNTU4OTkwPC9mcjphc3NlcnRpb24+DQogICAgICAgICAgICAgICAgICA8ZnI6YXNzZXJ0aW9uIG5hbWU9ImF3YXJkX251bWJlciI+MTczNjc3MTwvZnI6YXNzZXJ0aW9uPg0KICAgICAgICAgICAgICAgIDwvZnI6YXNzZXJ0aW9uPg0KICAgICAgICAgICAgICAgIDxmcjphc3NlcnRpb24gbmFtZT0iZnVuZGdyb3VwIj4NCiAgICAgICAgICAgICAgICAgIDxmcjphc3NlcnRpb24gbmFtZT0iZnVuZGVyX25hbWUiPg0KICAgICAgICAgICAgICAgICAgICBBdXN0cmFsaWFuIFJlc2VhcmNoIENvdW5jaWwNCiAgICAgICAgICAgICAgICAgICAgPGZyOmFzc2VydGlvbiBuYW1lPSJmdW5kZXJfaWRlbnRpZmllciI+aHR0cDovL2R4LmRvaS5vcmcvMTAuMTMwMzkvNTAxMTAwMDAwOTIzPC9mcjphc3NlcnRpb24+DQogICAgICAgICAgICAgICAgICA8L2ZyOmFzc2VydGlvbj4NCiAgICAgICAgICAgICAgICAgIDxmcjphc3NlcnRpb24gbmFtZT0iYXdhcmRfbnVtYmVyIj5GVDE4MDEwMDYwNjwvZnI6YXNzZXJ0aW9uPg0KICAgICAgICAgICAgICAgICAgPGZyOmFzc2VydGlvbiBuYW1lPSJhd2FyZF9udW1iZXIiPkRQMTgwMTAwMDQ4PC9mcjphc3NlcnRpb24+DQogICAgICAgICAgICAgICAgPC9mcjphc3NlcnRpb24+DQogICAgICAgICAgICAgIDwvZnI6cHJvZ3JhbT4NCiAgICAgICAgICAgICAgPGFpOnByb2dyYW0geG1sbnM6YWk9Imh0dHA6Ly93d3cuY3Jvc3NyZWYub3JnL0FjY2Vzc0luZGljYXRvcnMueHNkIiBuYW1lPSJBY2Nlc3NJbmRp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IDwvcXVlcnk+DQogICAgPC9ib2R5Pg0KICA8L3F1ZXJ5X3Jlc3VsdD4NCjwvY3Jvc3NyZWZfcmVzdWx0Pg== + http_version: + recorded_at: Wed, 29 Jul 2020 06:09:33 GMT +recorded_with: VCR 3.0.3 diff --git a/spec/readers/crossref_reader_spec.rb b/spec/readers/crossref_reader_spec.rb index c0a57554..06bf1963 100644 --- a/spec/readers/crossref_reader_spec.rb +++ b/spec/readers/crossref_reader_spec.rb @@ -175,7 +175,7 @@ expect(subject.descriptions.first["description"]).to start_with("This article presents a practical roadmap") expect(subject.dates).to include({"date"=>"2017-10-09", "dateType"=>"Issued"}) expect(subject.publication_year).to eq("2017") - expect(subject.publisher).to eq("bioRxiv") + expect(subject.publisher).to eq("Cold Spring Harbor Laboratory") expect(subject.agency).to eq("Crossref") end @@ -602,6 +602,27 @@ expect(subject.date_registered).to eq("2019-11-02T09:30:06Z") end + it "posted content copernicus" do + input = "https://doi.org/10.5194/CP-2020-95" + subject = Bolognese::Metadata.new(input: input) + expect(subject.valid?).to be true + expect(subject.url).to eq("https://cp.copernicus.org/preprints/cp-2020-95/") + expect(subject.types).to eq("bibtex"=>"article", "citeproc"=>"article-journal", "resourceType"=>"PostedContent", "resourceTypeGeneral"=>"Text", "ris"=>"JOUR", "schemaOrg"=>"ScholarlyArticle") + expect(subject.creators.count).to eq(6) + expect(subject.creators.first).to eq("nameType" => "Personal", "familyName" => "Shao", + "givenName" => "Jun", + "name" => "Shao, Jun", + "nameIdentifiers" => [{"nameIdentifier"=>"https://orcid.org/0000-0001-6130-6474", "nameIdentifierScheme"=>"ORCID", "schemeUri"=>"https://orcid.org"}]) + expect(subject.titles).to eq([{"title"=>"The Atmospheric Bridge Communicated the δ<sup>13</sup>C Declineduring the Last Deglaciation to the Global Upper Ocean"}]) + expect(subject.id).to eq("https://doi.org/10.5194/cp-2020-95") + expect(subject.identifiers).to be_empty + expect(subject.descriptions.first["description"]).to start_with("Abstract. During the early last glacial termination") + expect(subject.dates).to include({"date"=>"2020-07-28", "dateType"=>"Issued"}) + expect(subject.publication_year).to eq("2020") + expect(subject.publisher).to eq("Copernicus GmbH") + expect(subject.agency).to eq("Crossref") + end + it "journal issue" do input = "https://doi.org/10.6002/ect.2015.0371" subject = Bolognese::Metadata.new(input: input)