From 8834f2c77745bf1f6b54b653d0683ec07796130c Mon Sep 17 00:00:00 2001 From: Mike Bennett Date: Thu, 20 Jan 2022 11:21:34 +0000 Subject: [PATCH] Add in friendly querystring for Crossref and update VCR cassettes accordingly --- app/controllers/index_controller.rb | 5 +- coverage/.last_run.json | 2 +- coverage/.resultset.json | 299 +- coverage/index.html | 4127 ++++++++++------- .../vnd_datacite_datacite_xml/not_found.yml | 52 + .../registration_agency_op/header.yml | 52 + .../application/ld_json/header.yml | 61 + .../application/ld_json/link.yml | 61 + .../vnd_citationstyles_csl_json/header.yml | 61 + .../header_crossref.yml | 443 ++ .../vnd_citationstyles_csl_json/link.yml | 61 + .../link_crossref.yml | 443 ++ .../vnd_crossref_unixref_xml/header.yml | 61 + .../vnd_crossref_unixref_xml/link.yml | 61 + .../vnd_datacite_datacite_json/header.yml | 61 + .../vnd_datacite_datacite_json/link.yml | 61 + .../vnd_datacite_datacite_xml/header.yml | 61 + .../vnd_datacite_datacite_xml/link.yml | 61 + .../vnd_datacite_datacite_xml/not_found.yml | 52 + .../application/vnd_jats_xml/header.yml | 61 + .../application/vnd_jats_xml/link.yml | 61 + .../vnd_schemaorg_ld_json/header.yml | 61 + .../vnd_schemaorg_ld_json/link.yml | 61 + .../application/x-bibtex/header.yml | 61 + .../application/x-bibtex/link.yml | 61 + .../x-research-info-systems/header.yml | 61 + .../x-research-info-systems/link.yml | 61 + .../text/x-bibliography/header.yml | 61 + .../text/x-bibliography/header_with_style.yml | 61 + .../header_with_style_and_locale.yml | 61 + .../text/x-bibliography/link.yml | 61 + .../text/x-bibliography/link_with_style.yml | 61 + .../link_with_style_and_locale.yml | 61 + .../link_with_style_not_found.yml | 61 + .../unknown_accept_header/header.yml | 61 + .../vnd_citationstyles_csl_json/header.yml | 52 + .../vnd_citationstyles_csl_json/link.yml | 52 + .../vnd_datacite_datacite_json/header.yml | 52 + .../vnd_datacite_datacite_json/link.yml | 52 + .../vnd_datacite_datacite_xml/header.yml | 52 + .../vnd_datacite_datacite_xml/link.yml | 52 + .../vnd_datacite_datacite_xml/not_found.yml | 52 + .../application/vnd_jats_xml/header.yml | 52 + .../application/vnd_jats_xml/link.yml | 52 + .../vnd_schemaorg_ld_json/header.yml | 52 + .../vnd_schemaorg_ld_json/link.yml | 52 + .../application/x-bibtex/header.yml | 52 + .../application/x-bibtex/link.yml | 52 + .../x-research-info-systems/header.yml | 52 + .../x-research-info-systems/link.yml | 52 + .../text/x-bibliography/header.yml | 52 + .../text/x-bibliography/link.yml | 52 + .../text/x-bibliography/link_with_style.yml | 52 + .../link_with_style_and_locale.yml | 52 + .../link_with_style_not_found.yml | 52 + .../unknown_accept_header/header.yml | 52 + spec/rails_helper.rb | 1 + 57 files changed, 6295 insertions(+), 1859 deletions(-) diff --git a/app/controllers/index_controller.rb b/app/controllers/index_controller.rb index 0438b03..b3c58ef 100644 --- a/app/controllers/index_controller.rb +++ b/app/controllers/index_controller.rb @@ -14,9 +14,8 @@ def show if response.status == 200 @metadata = Bolognese::Metadata.new(input: response.body.fetch("data", nil), from: "datacite_json") else - url = "https://api.crossref.org/works/#{@doi}/transform/application/vnd.crossref.unixsd+xml" - useragent = "Mozilla/5.0 (compatible; Maremma/#{Maremma::VERSION}; +https://github.com/datacite/maremma; mailto:support@datacite.org)" - response = Maremma.get(url, accept: "text/xml", raw: true, timeout: 2, useragent: useragent) + url = "https://api.crossref.org/works/#{@doi}/transform/application/vnd.crossref.unixsd+xml?mailto=support@datacite.org" + response = Maremma.get(url, accept: "text/xml", raw: true, timeout: 2) if response.status == 200 string = response.body.fetch("data", nil) diff --git a/coverage/.last_run.json b/coverage/.last_run.json index abaa047..960ce1f 100644 --- a/coverage/.last_run.json +++ b/coverage/.last_run.json @@ -1,5 +1,5 @@ { "result": { - "covered_percent": 69.09 + "covered_percent": 93.17 } } diff --git a/coverage/.resultset.json b/coverage/.resultset.json index 3e80327..244d3ea 100644 --- a/coverage/.resultset.json +++ b/coverage/.resultset.json @@ -1,37 +1,30 @@ { "RSpec": { "coverage": { - "/Users/mfenner/Documents/git/content-negotiation/config/environment.rb": [ + "/work/projects/content-negotiation/config/environment.rb": [ null, 1, null, null, 1 ], - "/Users/mfenner/Documents/git/content-negotiation/config/application.rb": [ + "/work/projects/content-negotiation/config/application.rb": [ 1, null, 1, null, 1, - null, - null, 1, null, null, null, - null, - null, - null, - null, - null, 1, null, null, 1, 1, - 1, - 1, + 0, + 0, null, null, null, @@ -40,6 +33,7 @@ 1, 0, 0, + 0, null, null, null, @@ -51,6 +45,7 @@ 1, 1, 1, + 1, null, 1, 1, @@ -70,14 +65,6 @@ 1, null, null, - 1, - 1, - 1, - 1, - 1, - 1, - null, - null, null, 1, null, @@ -92,12 +79,12 @@ null, null ], - "/Users/mfenner/Documents/git/content-negotiation/config/boot.rb": [ + "/work/projects/content-negotiation/config/boot.rb": [ 1, null, 1 ], - "/Users/mfenner/Documents/git/content-negotiation/config/environments/test.rb": [ + "/work/projects/content-negotiation/config/environments/test.rb": [ 1, null, null, @@ -114,6 +101,9 @@ null, null, 1, + null, + null, + 1, 1, null, null, @@ -146,15 +136,20 @@ null, null ], - "/Users/mfenner/Documents/git/content-negotiation/config/initializers/application_controller_renderer.rb": [ - null, + "/work/projects/content-negotiation/config/initializers/_version.rb": [ + 1, + 1, + 1, null, + 72, null, + 1, null, + 1, null, null ], - "/Users/mfenner/Documents/git/content-negotiation/config/initializers/backtrace_silencers.rb": [ + "/work/projects/content-negotiation/config/initializers/backtrace_silencers.rb": [ null, null, null, @@ -163,21 +158,31 @@ null, null ], - "/Users/mfenner/Documents/git/content-negotiation/config/initializers/bugsnag.rb": [ + "/work/projects/content-negotiation/config/initializers/cors.rb": [ + null, + null, + null, + null, + null, + null, + null, 1, - 0, - 0, - 0, + 1, + 1, + null, + 1, + null, + null, null, null ], - "/Users/mfenner/Documents/git/content-negotiation/config/initializers/filter_parameter_logging.rb": [ + "/work/projects/content-negotiation/config/initializers/filter_parameter_logging.rb": [ null, null, null, 1 ], - "/Users/mfenner/Documents/git/content-negotiation/config/initializers/inflections.rb": [ + "/work/projects/content-negotiation/config/initializers/inflections.rb": [ null, null, null, @@ -195,15 +200,30 @@ null, null ], - "/Users/mfenner/Documents/git/content-negotiation/config/initializers/lograge.rb": [ + "/work/projects/content-negotiation/config/initializers/lograge.rb": [ + null, + null, + 1, + 1, + 1, 1, 1, + null, + 1, + 1, + null, + 1, + 84, + null, + 84, + null, + null, null ], - "/Users/mfenner/Documents/git/content-negotiation/config/initializers/mime_types.rb": [ + "/work/projects/content-negotiation/config/initializers/mime_types.rb": [ null, - 35, - 34, + 53, + 52, null, null, null, @@ -229,70 +249,90 @@ null, null, 1, - 6, - 0, - 0, - null, - 0, - 0, + 8, null, null, + 1, null, + 19, + 19, + 19, null, - 1, - 4, - 0, - 0, - 0, + 3, + 3, + 3, null, - 0, - 0, null, null, + 1, + 11, + 44, null, + null + ], + "/work/projects/content-negotiation/config/initializers/name_detector.rb": [ + 1, null, + 1 + ], + "/work/projects/content-negotiation/config/initializers/sentry.rb": [ 1, - 0, - 0, - 0, + 1, + 1, + 1, + null + ], + "/work/projects/content-negotiation/config/initializers/wrap_parameters.rb": [ + null, + null, null, - 0, - 0, null, null, null, 1, - 0, - 0, - 0, + 2, null, - 0, - 0, null, null, null, - 1, - 0, - 0, null, - 0, - 0, null ], - "/Users/mfenner/Documents/git/content-negotiation/config/initializers/name_detector.rb": [ + "/work/projects/content-negotiation/config/routes.rb": [ + 1, 1, null, - 1 - ], - "/Users/mfenner/Documents/git/content-negotiation/config/initializers/wrap_parameters.rb": [ null, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, null, + 1, + 1, null, null, + 1, null, null, 1, - 1, + null + ], + "/work/projects/content-negotiation/spec/api/heartbeat_spec.rb": [ + null, + null, + null, + null, null, null, null, @@ -300,123 +340,178 @@ null, null ], - "/Users/mfenner/Documents/git/content-negotiation/config/routes.rb": [ + "/work/projects/content-negotiation/spec/concerns/helpable_spec.rb": [ 1, - 1, - null, null, 1, 1, 1, 1, - 1, null, - 1, null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null + ], + "/work/projects/content-negotiation/app/models/help.rb": [ null, 1, + 1, null ], - "/Users/mfenner/Documents/git/content-negotiation/spec/api/heartbeat_spec.rb": [ + "/work/projects/content-negotiation/app/controllers/concerns/helpable.rb": [ + 1, 1, null, 1, 1, - 0, null, + 1, + 2, + 2, + null, + 2, 0, 0, null, + null, + 2, + 23, + 1, + null, + null, null ], - "/Users/mfenner/Documents/git/content-negotiation/spec/concerns/helpable_spec.rb": [ + "/work/projects/content-negotiation/app/controllers/index_controller.rb": [ 1, - null, 1, + null, 1, + null, 1, 0, - 0, null, null, 1, - 0, - 0, + 79, + 79, null, + 79, + 26, null, + 53, + 53, null, - 1, - 0, - 0, + 53, + 28, + 28, + 28, null, + 25, null, + 25, null, - 1, - 1, - 0, + 21, + 21, + 21, + null, + 21, + 21, null, + 4, null, null, null, null, + 75, null, + 75, + 75, null, + 1, null, + 75, null, + 19, + 10, + 10, + 10, null, null, null, + 19, null, + 127, null, null, null, + 3, null, - null - ], - "/Users/mfenner/Documents/git/content-negotiation/app/models/help.rb": [ null, 1, - 1, - null - ], - "/Users/mfenner/Documents/git/content-negotiation/app/controllers/concerns/helpable.rb": [ 1, 1, null, + null, 1, + 0, + null, + null, 1, null, 1, + 83, + 83, + null, + null + ], + "/work/projects/content-negotiation/app/controllers/application_controller.rb": [ 1, 1, null, 1, - 0, - 0, + null, + null, null, null, null, 1, - 0, - 0, - 0, - 0, + 1, + 8, + null, + 8, null, 0, + null, 0, + null, 0, + null, 0, + null, 0, null, null, - 1, - 0, - 0, + 8, null, null, null ] }, - "timestamp": 1524469712 + "timestamp": 1642676099 } } diff --git a/coverage/index.html b/coverage/index.html index 74dc557..7f3f3a1 100644 --- a/coverage/index.html +++ b/coverage/index.html @@ -3,38 +3,38 @@ Code coverage for Content-negotiation - + - + - +
loading